/// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public virtual DextopFormField ToField(String memberName, Type memberType)
        {
            if (this.fieldLabel == null && this.boxLabel == null)
            {
                fieldLabel = memberName;
            }
            var res = new DextopFormField
            {
                allowBlank = NullableUtil.DefaultNull(allowBlank, true),
                anchor     = anchor,
                boxLabel   = boxLabel,
                disabled   = NullableUtil.DefaultNull(disabled, false),
                emptyText  = emptyText,
                name       = name ?? memberName,
                readOnly   = NullableUtil.DefaultNull(readOnly, false),
                tooltip    = tooltip,
                xtype      = xtype ?? GetXType(memberType),
                flex       = NullableUtil.DefaultNull(flex, 0.0),
                inputType  = inputType,
                vtype      = vtype,
                vtypeText  = vtypeText,
                margin     = margin,
                width      = width,
                Raw        = RawJS,
                style      = style,
                fieldStyle = fieldStyle,
                fieldCls   = fieldCls,
                cls        = cls
            };

            res.ApplyLabelable(this);
            return(res);
        }
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            if (format != null)
            {
                field["format"] = format;
            }
            if (increment != 0)
            {
                field["increment"] = increment;
            }
            if (maxValue != null)
            {
                field["maxValue"] = maxValue;
            }
            if (minValue != null)
            {
                field["minValue"] = minValue;
            }
            if (submitFormat != null)
            {
                field["submitFormat"] = submitFormat;
            }
            return(field);
        }
Exemple #3
0
        /// <summary>
        /// Converts this attribute to a list of form fields. Usually attributes
        /// are mapped to a single form field, but sometimes single attribute
        /// is mapped to multiple fields (e.g. DextopFormRadio).
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">Type of the member.</param>
        /// <returns></returns>
        public override DextopFormField[] ToFields(string memberName, Type memberType)
        {
            int count;

            if (boxLabels != null)
            {
                count = boxLabels.Length;
            }
            else if (fieldLabels != null)
            {
                count = fieldLabels.Length;
            }
            else
            {
                return(new DextopFormField[0]);
            }

            var res = new DextopFormField[count];

            for (var i = 0; i < res.Length; i++)
            {
                res[i] = ToField(memberName, memberType, i);
            }
            return(res);
        }
Exemple #4
0
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            if (step != 0)
            {
                field["step"] = step;
            }
            if (!allowDecimals)
            {
                field["allowDecimals"] = allowDecimals;
            }
            if (baseChars != null)
            {
                field["baseChars"] = baseChars;
            }
            if (decimalPrecision != 2)
            {
                field["decimalPrecision"] = decimalPrecision;
            }
            if (maxValue != int.MinValue)
            {
                field["maxValue"] = maxValue;
            }
            if (minValue != int.MaxValue)
            {
                field["minValue"] = minValue;
            }
            return(field);
        }
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            if (minLength > 0)
            {
                field["minLength"] = minLength;
            }
            if (maxLength > 0)
            {
                field["maxLength"] = maxLength;
            }
            if (regex != null)
            {
                field["regex"] = new DextopRawJs("/" + regex + "/");
            }
            if (regexText != null)
            {
                field["regexText"] = new DextopLocalizedText(field.ItemName + "RegextText", regexText);
            }
            if (maskRe != null)
            {
                field["maskRe"] = new DextopRawJs("/" + maskRe + "/");
            }
            return(field);
        }
Exemple #6
0
        DextopFormField ToField(string memberName, Type memberType, int index)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            field.NameSuffix = "_" + index.ToString() + "_";
            if (inputValues != null && index < inputValues.Length)
            {
                field["inputValue"] = inputValues[index];
            }
            else
            {
                field["inputValue"] = index;
            }

            field.fieldLabel = field.boxLabel = null;
            field.Properties.Remove("fieldLabel");
            field.Properties.Remove("boxLabel");

            if (fieldLabels != null && index < fieldLabels.Length)
            {
                field.fieldLabel = fieldLabels[index];
            }

            if (boxLabels != null)
            {
                field.boxLabel = boxLabels[index];
            }

            return(field);
        }
        /// <summary>
        /// Converts this attribute to a form field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">The type of the member.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type memberType)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            if (grow)
            {
                field["grow"] = grow;
            }
            if (growMin > 0)
            {
                field["growMin"] = growMin;
            }
            if (growMax > 0)
            {
                field["growMax"] = growMax;
            }
            if (height > 0)
            {
                field["height"] = height;
            }
            if (preventScrollbars)
            {
                field["preventScrollbars"] = preventScrollbars;
            }
            return(field);
        }
Exemple #8
0
        /// <summary>
        /// Toes the field.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public override DextopFormField ToField(string memberName, Type type)
        {
            DextopFormField field = base.ToField(memberName, type);

            if (format != null)
            {
                field["format"] = format;
            }
            if (maxValue != null)
            {
                field["maxValue"] = maxValue;
            }
            if (minValue != null)
            {
                field["minValue"] = minValue;
            }
            if (!showToday)
            {
                field["showToday"] = showToday;
            }
            if (submitFormat != null)
            {
                field["submitFormat"] = submitFormat;
            }
            return(field);
        }
Exemple #9
0
        DextopFormField ToField(string memberName, Type memberType, int index)
        {
            DextopFormField field = base.ToField(memberName, memberType);

            field.NameSuffix = "_" + index.ToString() + "_";
            if (inputValues != null && index < inputValues.Length)
            {
                field["inputValue"] = inputValues[index];
            }
            else
            {
                field["inputValue"] = index;
            }

            field.fieldLabel = field.boxLabel = null;
            field.Properties.Remove("fieldLabel");
            field.Properties.Remove("boxLabel");

            field["checked"] = new DextopRawJs("options.data['{0}'] === {1}", field.name, DextopUtil.Encode(field["inputValue"]));

            if (fieldLabels != null && index < fieldLabels.Length)
            {
                field.fieldLabel = fieldLabels[index];
            }

            if (boxLabels != null)
            {
                field.boxLabel = boxLabels[index];
            }

            return(field);
        }
        /// <summary>
        /// Converts this attribute to a list of form fields. Usually attributes
        /// are mapped to a single form field, but sometimes single attribute
        /// is mapped to multiple fields (e.g. DextopFormRadio).
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberType">Type of the member.</param>
        /// <returns></returns>
        public override DextopFormField[] ToFields(string memberName, Type memberType)
        {
            int count;
            if (boxLabels != null)
                count = boxLabels.Length;
            else if (fieldLabels != null)
                count = fieldLabels.Length;
            else
                return new DextopFormField[0];

            var res = new DextopFormField[count];
            for (var i = 0; i < res.Length; i++)
                res[i] = ToField(memberName, memberType, i);
            return res;
        }
 /// <summary>
 /// Converts this attribute to a form field.
 /// </summary>
 /// <param name="memberName">Name of the member.</param>
 /// <param name="memberType">The type of the member.</param>
 /// <returns></returns>
 public virtual DextopFormField ToField(String memberName, Type memberType)
 {
     if (this.fieldLabel == null && this.boxLabel == null)
         fieldLabel = memberName;
     var res = new DextopFormField
     {
         allowBlank = NullableUtil.DefaultNull(allowBlank, true),
         anchor = anchor,
         boxLabel = boxLabel,
         disabled = NullableUtil.DefaultNull(disabled, false),
         emptyText = emptyText,
         name = name ?? memberName,
         readOnly = NullableUtil.DefaultNull(readOnly, false),
         tooltip = tooltip,
         xtype = xtype ?? GetXType(memberType),
         flex = NullableUtil.DefaultNull(flex, 0.0),
         inputType = inputType,
         vtype = vtype,
         vtypeText = vtypeText,
         margin = margin,
         width = width,
         Raw = RawJS,
         style = style,
         fieldStyle = fieldStyle,
         fieldCls = fieldCls,
         cls = cls
     };
     res.ApplyLabelable(this);
     return res;
 }