예제 #1
0
파일: XState.cs 프로젝트: g992com/esb
 public XState(ControlBase control)
 {
     _control = control;
 }
예제 #2
0
        ///// <summary>
        ///// 是否允许调整大小
        ///// </summary>
        //public override bool AllowResize
        //{
        //    get
        //    {
        //        return false;
        //    }
        //}

        #endregion

        #region Initialize

        /// <summary>
        /// 初始化控件设计时
        /// </summary>
        /// <param name="component"></param>
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            currentControl = component as ControlBase;
        }
예제 #3
0
        /// <summary>
        /// 把实体成员的值设置到控件上
        /// </summary>
        /// <param name="field"></param>
        /// <param name="control"></param>
        /// <param name="canSave"></param>
        protected virtual void SetFormItem(FieldItem field, System.Web.UI.Control control, Boolean canSave)
        {
            if (field == null || control == null)
            {
                return;
            }

            String toolTip = String.IsNullOrEmpty(field.Description) ? field.Name : field.Description;

            if (field.IsNullable)
            {
                toolTip = String.Format("请填写{0}!", toolTip);
            }
            else
            {
                toolTip = String.Format("必须填写{0}!", toolTip);
            }

            if (control is Label)
            {
                toolTip = null;
            }

            if (control is ExtAspNet.ControlBase)
            {
                ExtAspNet.ControlBase wc = control as ExtAspNet.ControlBase;

                // 设置ToolTip
                //if (String.IsNullOrEmpty(wc.ToolTip) && !String.IsNullOrEmpty(toolTip)) wc.ToolTip = toolTip;

                //// 必填项
                //if (!field.IsNullable) SetNotAllowNull(field, control, canSave);

                // 设置只读,只有不能保存时才设置,因为一般都不是只读,而前端可能自己设置了控件为只读,这种情况下这里再设置就会修改前端的意思
                if (!canSave)
                {
                    if (wc is ExtAspNet.TextBox)
                    {
                        (wc as TextBox).Enabled = !canSave;
                    }
                    else
                    {
                        wc.Enabled = canSave;
                    }
                }

                // 分控件处理
                if (wc is TextBox || wc is DatePicker)
                {
                    SetFormItemTextBox(field, wc as RealTextField, canSave);
                }
                else if (wc is Label)
                {
                    SetFormItemLabel(field, wc as Label, canSave);
                }
                else if (wc is RadioButton)
                {
                    SetFormItemRadioButton(field, wc as RadioButton, canSave);
                }
                else if (wc is CheckBox)
                {
                    SetFormItemCheckBox(field, wc as CheckBox, canSave);
                }
                else if (wc is DropDownList)
                {
                    SetFormItemListControl(field, wc as DropDownList, canSave);
                }
                else
                {
                    SetControlValue(control as ControlBase, Entity[field.Name]);
                }
            }
            else
            {
                SetControlValue(control as ControlBase, Entity[field.Name]);

                PropertyInfoX pix = PropertyInfoX.Create(control.GetType(), "ToolTip");
                if (pix != null && String.IsNullOrEmpty((String)pix.GetValue(control)))
                {
                    pix.SetValue(control, toolTip);
                }
            }
        }