Пример #1
0
		public void TestGetLookupListDoesntExist()
		{
			ClassDef.ClassDefs.Clear();
			_itsClassDef = MyBO.LoadClassDefWithNoLookup();
			MyBO bo = new MyBO();
			BOMapper mapper = new BOMapper(bo);
			Assert.AreEqual(0, mapper.GetLookupList("TestProp").Count);
		}
        ///// <summary>
        ///// Gets or sets whether the user is able to right-click to
        ///// add additional items to the drop-down list
        ///// </summary>
        //public override bool RightClickEnabled
        //{
        //    get { return base.RightClickEnabled && _allowRightClick; }
        //    set
        //    {
        //        _allowRightClick = value;
        //        base.RightClickEnabled = value;
        //    }
        //}

        /// <summary>
        /// Sets up the list of items to display and calls SetLookupList()
        /// to populate the ComboBox with this list
        /// </summary>
        private void SetupLookupList()
        {
            if (_businessObject == null)
            {
                Dictionary<string, string> emptyList = new Dictionary<string, string>();
                LookupList = emptyList;
                return;
            }
            BOMapper mapper = new BOMapper(_businessObject);
            Dictionary<string, string> col = mapper.GetLookupList(PropertyName);
            //if (!_isRightClickInitialised)
            //{
            //    //SetupRightClickBehaviour();
            //    if (_attributes != null && !_attributes.Contains("rightClickEnabled") &&
            //        GlobalUIRegistry.UISettings != null &&
            //        GlobalUIRegistry.UISettings.PermitComboBoxRightClick != null)
            //    {
            //        ClassDef lookupClassDef = mapper.GetLookupListClassDef(_propertyName);
            //        if (lookupClassDef != null)
            //        {
            //            Type boType = lookupClassDef.ClassType;
            //            if (GlobalUIRegistry.UISettings.PermitComboBoxRightClick(boType, this))
            //            {
            //                RightClickEnabled = _allowRightClick;
            //            }
            //        }
            //    }
            //    else
            //    {
            //        RightClickEnabled = _allowRightClick;
            //    }
            //    _isRightClickInitialised = true;
            //}
            CustomiseLookupList(col);
            LookupList = col;
            var boPropertyValue = GetPropertyValue();
            if (col.Count > 0 && boPropertyValue != null)
            {
                SetLookupListValueFromBO(boPropertyValue);
            }
        }