Esempio n. 1
0
        public XmlNode GenerateXML()
        {
            // Create XML Node and Attributes
            XmlDocument d = new XmlDocument();
            XmlNode output = d.CreateNode("element", "Field", null);
            XmlAttribute name = d.CreateAttribute("Name");
            XmlAttribute hint = d.CreateAttribute("Hint");
            XmlAttribute list = d.CreateAttribute("List");
            XmlAttribute prompt = d.CreateAttribute("Prompt");
            XmlAttribute question = d.CreateAttribute("Question");
            XmlAttribute readOnly = d.CreateAttribute("ReadOnly");
            XmlAttribute regEx = d.CreateAttribute("RegEx");

            // Set Attribute Values
            name.Value = Name;
            hint.Value = Hint;
            list.Value = List;
            prompt.Value = Prompt;
            question.Value = Question;
            readOnly.Value = ReadOnly.ToString();
            regEx.Value = RegEx;

            // Append Attributes
            output.Attributes.Append(name);
            if (!string.IsNullOrEmpty(Hint))
            {
                output.Attributes.Append(hint);
            }
            if (!string.IsNullOrEmpty(List))
            {
                output.Attributes.Append(list);
            }
            if (!string.IsNullOrEmpty(Prompt))
            {
                output.Attributes.Append(prompt);
            }
            if (!string.IsNullOrEmpty(Question))
            {
                output.Attributes.Append(question);
            }
            output.Attributes.Append(readOnly);
            if (!string.IsNullOrEmpty(RegEx))
            {
                output.Attributes.Append(regEx);
            }

            return output;
        }
Esempio n. 2
0
        public override string ToString()
        {
            // Coordinates
            string sCoord = "";

            if (Coordinates != null)
            {
                sCoord += "(" + Coordinates.X.ToString() + " ; " + Coordinates.Y.ToString() + ")";
            }
            else
            {
                sCoord = "(null)";
            }

            // Draft
            string sDraft = "[";

            if (Draft != null)
            {
                if (Draft.Count > 0)
                {
                    for (int i = 0; i < Draft.Count - 1; i++)
                    {
                        sDraft += Draft[i].ToString() + ", ";
                    }
                    sDraft += Draft[Draft.Count - 1] + "]";
                }
                else
                {
                    sDraft = "[]";
                }
            }
            else
            {
                sDraft = "(null)";
            }

            return("Cell{" +
                   "Coordinates=" + sCoord + ", " +
                   "Value=" + Value.ToString() + ", " +
                   "Draft=\"" + sDraft + "\"" +
                   "ReadOnly=\"" + ReadOnly.ToString() + "\"" +
                   "CellListeners=\"" + CellListeners?.ToString() + "\", " +
                   "}");
        }
Esempio n. 3
0
        /// <inheritdoc />
        /// <summary>
        /// Compare a modified document node (this) to a previous one and look for breaking as well as non-breaking changes.
        /// </summary>
        /// <param name="context">The modified document context.</param>
        /// <param name="previous">The original document model.</param>
        /// <returns>A list of messages from the comparison.</returns>
        public override IEnumerable <ComparisonMessage> Compare(
            ComparisonContext <ServiceDefinition> context,
            Schema previous
            )
        {
            var priorSchema = previous;

            if (priorSchema == null)
            {
                throw new ArgumentNullException("priorVersion");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            int referenced = 0;

            var thisSchema = this;

            if (!string.IsNullOrWhiteSpace(thisSchema.Reference))
            {
                thisSchema  = FindReferencedSchema(thisSchema.Reference, context.CurrentRoot.Definitions);
                referenced += 1;
                if (thisSchema == null)
                {
                    return(context.Messages);
                }
            }
            if (!string.IsNullOrWhiteSpace(priorSchema.Reference))
            {
                priorSchema = FindReferencedSchema(priorSchema.Reference, context.PreviousRoot.Definitions);
                referenced += 1;
                if (priorSchema == null)
                {
                    return(context.Messages);
                }
            }

            // Avoid doing the comparison repeatedly by marking for which direction it's already been done.

            if (context.Direction != DataDirection.None && referenced == 2)
            {
                // Comparing two referenced schemas in the context of a parameter or response -- did we already do this?

                if (thisSchema._compareDirection == context.Direction || thisSchema._compareDirection == DataDirection.Both)
                {
                    return(new ComparisonMessage[0]);
                }
                _compareDirection |= context.Direction;
            }

            if (thisSchema != this || priorSchema != previous)
            {
                if (_visitedSchemas.Contains(priorSchema))
                {
                    return(context.Messages);
                }
                _visitedSchemas.AddFirst(priorSchema);
                return(thisSchema.Compare(context, priorSchema));
            }

            base.Compare(context, previous);

            if (priorSchema.ReadOnly != ReadOnly)
            {
                context.LogBreakingChange(ComparisonMessages.ReadonlyPropertyChanged, priorSchema.ReadOnly.ToString().ToLower(), ReadOnly.ToString().ToLower());
            }

            if ((priorSchema.Discriminator == null && Discriminator != null) ||
                (priorSchema.Discriminator != null && !priorSchema.Discriminator.Equals(Discriminator)))
            {
                context.LogBreakingChange(ComparisonMessages.DifferentDiscriminator);
            }

            if ((priorSchema.Extends == null && Extends != null) ||
                (priorSchema.Extends != null && !priorSchema.Extends.Equals(Extends)))
            {
                context.LogBreakingChange(ComparisonMessages.DifferentExtends);
            }

            if ((priorSchema.AllOf == null && AllOf != null) ||
                (priorSchema.AllOf != null && AllOf == null))
            {
                context.LogBreakingChange(ComparisonMessages.DifferentAllOf);
            }
            else if (priorSchema.AllOf != null)
            {
                CompareAllOfs(context, priorSchema);
            }

            // Compare each properties of the model
            context.PushProperty("properties");
            CompareProperties(context, priorSchema);
            context.Pop();

            // Compare `required` list of properties of the model
            CompareRequired(context, priorSchema);

            return(context.Messages);
        }
Esempio n. 4
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            if (!string.IsNullOrWhiteSpace(PropertyName))
            {
                code.AppendLine($@"['PropertyName'] = '{PropertyName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['PropertyName'] = nil,");
            }

            code.AppendLine($@"['IsCaption'] ={(IsCaption.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Alias))
            {
                code.AppendLine($@"['Alias'] = '{Alias.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Alias'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(Group))
            {
                code.AppendLine($@"['Group'] = '{Group.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Group'] = nil,");
            }

            code.AppendLine($@"['CreateIndex'] ={(CreateIndex.ToString().ToLower())},");

            code.AppendLine($@"['IsPrimaryKey'] ={(IsPrimaryKey.ToString().ToLower())},");

            code.AppendLine($@"['IsExtendKey'] ={(IsExtendKey.ToString().ToLower())},");

            code.AppendLine($@"['IsIdentity'] ={(IsIdentity.ToString().ToLower())},");

            code.AppendLine($@"['IsGlobalKey'] ={(IsGlobalKey.ToString().ToLower())},");

            code.AppendLine($@"['UniqueIndex'] ={UniqueIndex},");

            code.AppendLine($@"['IsRequired'] ={(IsRequired.ToString().ToLower())},");

            code.AppendLine($@"['IsUserReadOnly'] ={(IsUserReadOnly.ToString().ToLower())},");

            code.AppendLine($@"['IsMemo'] ={(IsMemo.ToString().ToLower())},");


            code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Prefix))
            {
                code.AppendLine($@"['Prefix'] = '{Prefix.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Prefix'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(Suffix))
            {
                code.AppendLine($@"['Suffix'] = '{Suffix.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Suffix'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(InputType))
            {
                code.AppendLine($@"['InputType'] = '{InputType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['InputType'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ComboBoxUrl))
            {
                code.AppendLine($@"['ComboBoxUrl'] = '{ComboBoxUrl.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ComboBoxUrl'] = nil,");
            }

            code.AppendLine($@"['IsMoney'] ={(IsMoney.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(GridAlign))
            {
                code.AppendLine($@"['GridAlign'] = '{GridAlign.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['GridAlign'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DataFormater))
            {
                code.AppendLine($@"['DataFormater'] = '{DataFormater.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DataFormater'] = nil,");
            }

            code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},");

            code.AppendLine($@"['GridDetails'] ={(GridDetails.ToString().ToLower())},");

            code.AppendLine($@"['NoneGrid'] ={(NoneGrid.ToString().ToLower())},");

            code.AppendLine($@"['NoneDetails'] ={(NoneDetails.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(GridDetailsCode))
            {
                code.AppendLine($@"['GridDetailsCode'] = '{GridDetailsCode.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['GridDetailsCode'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CppType))
            {
                code.AppendLine($@"['CppType'] = '{CppType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CppType'] = nil,");
            }

            if (CppTypeObject != null)
            {
                code.AppendLine($@"['CppTypeObject'] ='{CppTypeObject}',");
            }

            if (!string.IsNullOrWhiteSpace(CppName))
            {
                code.AppendLine($@"['CppName'] = '{CppName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CppName'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CppLastType))
            {
                code.AppendLine($@"['CppLastType'] = '{CppLastType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CppLastType'] = nil,");
            }

            code.AppendLine($@"['IsIntDecimal'] ={(IsIntDecimal.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(CsType))
            {
                code.AppendLine($@"['CsType'] = '{CsType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CsType'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CustomType))
            {
                code.AppendLine($@"['CustomType'] = '{CustomType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CustomType'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(LastCsType))
            {
                code.AppendLine($@"['LastCsType'] = '{LastCsType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['LastCsType'] = nil,");
            }

            if (EnumConfig != null)
            {
                code.AppendLine($@"['EnumConfig'] = {EnumConfig.GetLuaStruct()},");
            }

            code.AppendLine($@"['IsCompute'] ={(IsCompute.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ComputeGetCode))
            {
                code.AppendLine($@"['ComputeGetCode'] = '{ComputeGetCode.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ComputeGetCode'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ComputeSetCode))
            {
                code.AppendLine($@"['ComputeSetCode'] = '{ComputeSetCode.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ComputeSetCode'] = nil,");
            }

            code.AppendLine($@"['IsMiddleField'] ={(IsMiddleField.ToString().ToLower())},");

            code.AppendLine($@"['InnerField'] ={(InnerField.ToString().ToLower())},");

            code.AppendLine($@"['IsSystemField'] ={(IsSystemField.ToString().ToLower())},");

            code.AppendLine($@"['IsInterfaceField'] ={(IsInterfaceField.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Initialization))
            {
                code.AppendLine($@"['Initialization'] = '{Initialization.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Initialization'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(EmptyValue))
            {
                code.AppendLine($@"['EmptyValue'] = '{EmptyValue.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['EmptyValue'] = nil,");
            }

            code.AppendLine($@"['DenyScope'] ='{DenyScope}',");

            code.AppendLine($@"['Nullable'] ={(Nullable.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Max))
            {
                code.AppendLine($@"['Max'] = '{Max.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Max'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(Min))
            {
                code.AppendLine($@"['Min'] = '{Min.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Min'] = nil,");
            }

            code.AppendLine($@"['UniqueString'] ={(UniqueString.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ColumnName))
            {
                code.AppendLine($@"['ColumnName'] = '{ColumnName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ColumnName'] = nil,");
            }

            code.AppendLine($@"['DbNullable'] ={(DbNullable.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(DbType))
            {
                code.AppendLine($@"['DbType'] = '{DbType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DbType'] = nil,");
            }

            code.AppendLine($@"['Precision'] ={Datalen},");

            if (!string.IsNullOrWhiteSpace(ArrayLen))
            {
                code.AppendLine($@"['ArrayLen'] = '{ArrayLen.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ArrayLen'] = nil,");
            }

            code.AppendLine($@"['Scale'] ={Scale},");

            code.AppendLine($@"['DbIndex'] ={DbIndex},");

            code.AppendLine($@"['Unicode'] ={(Unicode.ToString().ToLower())},");

            code.AppendLine($@"['FixedLength'] ={(FixedLength.ToString().ToLower())},");

            code.AppendLine($@"['IsBlob'] ={(IsBlob.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(StorageProperty))
            {
                code.AppendLine($@"['StorageProperty'] = '{StorageProperty.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['StorageProperty'] = nil,");
            }

            code.AppendLine($@"['DbInnerField'] ={(DbInnerField.ToString().ToLower())},");

            code.AppendLine($@"['NoStorage'] ={(NoStorage.ToString().ToLower())},");

            code.AppendLine($@"['KeepStorageScreen'] ='{KeepStorageScreen}',");

            code.AppendLine($@"['CustomWrite'] ={(CustomWrite.ToString().ToLower())},");

            code.AppendLine($@"['IsLinkField'] ={(IsLinkField.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(LinkTable))
            {
                code.AppendLine($@"['LinkTable'] = '{LinkTable.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['LinkTable'] = nil,");
            }

            code.AppendLine($@"['IsLinkKey'] ={(IsLinkKey.ToString().ToLower())},");

            code.AppendLine($@"['IsLinkCaption'] ={(IsLinkCaption.ToString().ToLower())},");

            code.AppendLine($@"['IsUserId'] ={(IsUserId.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(LinkField))
            {
                code.AppendLine($@"['LinkField'] = '{LinkField.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['LinkField'] = nil,");
            }

            code.AppendLine($@"['IsCustomCompute'] ={(IsCustomCompute.ToString().ToLower())},");

            code.AppendLine($@"['CanGet'] ={(CanGet.ToString().ToLower())},");

            code.AppendLine($@"['CanSet'] ={(CanSet.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(AccessType))
            {
                code.AppendLine($@"['AccessType'] = '{AccessType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['AccessType'] = nil,");
            }

            code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},");

            code.AppendLine($@"['CanInput'] ={(CanUserInput.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ExtendRole))
            {
                code.AppendLine($@"['ExtendRole'] = '{ExtendRole.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ExtendRole'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ValueSeparate))
            {
                code.AppendLine($@"['ValueSeparate'] = '{ValueSeparate.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ValueSeparate'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ArraySeparate))
            {
                code.AppendLine($@"['ArraySeparate'] = '{ArraySeparate.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ArraySeparate'] = nil,");
            }

            code.AppendLine($@"['ExtendArray'] ={(ExtendArray.ToString().ToLower())},");

            code.AppendLine($@"['IsKeyValueArray'] ={(IsKeyValueArray.ToString().ToLower())},");

            code.AppendLine($@"['IsRelation'] ={(IsRelation.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ExtendPropertyName))
            {
                code.AppendLine($@"['ExtendPropertyName'] = '{ExtendPropertyName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ExtendPropertyName'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ExtendClassName))
            {
                code.AppendLine($@"['ExtendClassName'] = '{ExtendClassName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ExtendClassName'] = nil,");
            }

            code.AppendLine($@"['ExtendClassIsPredestinate'] ={(ExtendClassIsPredestinate.ToString().ToLower())},");

            code.AppendLine($@"['IsRelationField'] ={(IsRelationField.ToString().ToLower())},");

            code.AppendLine($@"['IsRelationValue'] ={(IsRelationValue.ToString().ToLower())},");

            code.AppendLine($@"['IsRelationArray'] ={(IsRelationArray.ToString().ToLower())},");

            code.AppendLine($@"['IsExtendArray'] ={(IsExtendArray.ToString().ToLower())},");

            code.AppendLine($@"['IsExtendValue'] ={(IsExtendValue.ToString().ToLower())},");
        }
Esempio n. 5
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            idx = 0;
            code.AppendLine("['ApiItems'] ={");
            foreach (var val in ApiItems)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");

            idx = 0;
            code.AppendLine("['Entities'] ={");
            foreach (var val in Entities)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");

            code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(DataBaseObjectName))
            {
                code.AppendLine($@"['DataBaseObjectName'] = '{DataBaseObjectName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DataBaseObjectName'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(NameSpace))
            {
                code.AppendLine($@"['NameSpace'] = '{NameSpace.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['NameSpace'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(PagePath))
            {
                code.AppendLine($@"['PagePath'] = '{PagePath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['PagePath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(BusinessPath))
            {
                code.AppendLine($@"['BusinessPath'] = '{BusinessPath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['BusinessPath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ClientCsPath))
            {
                code.AppendLine($@"['ClientCsPath'] = '{ClientCsPath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ClientCsPath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ModelPath))
            {
                code.AppendLine($@"['ModelPath'] = '{ModelPath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ModelPath'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CodePath))
            {
                code.AppendLine($@"['CodePath'] = '{CodePath.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CodePath'] = nil,");
            }

            code.AppendLine($@"['DbType'] ='{DbType}',");

            if (!string.IsNullOrWhiteSpace(DbHost))
            {
                code.AppendLine($@"['DbHost'] = '{DbHost.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DbHost'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DbSoruce))
            {
                code.AppendLine($@"['DbSoruce'] = '{DbSoruce.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DbSoruce'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DbPassWord))
            {
                code.AppendLine($@"['DbPassWord'] = '******',");
            }
            else
            {
                code.AppendLine($@"['DbPassWord'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DbUser))
            {
                code.AppendLine($@"['DbUser'] = '******',");
            }
            else
            {
                code.AppendLine($@"['DbUser'] = nil,");
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Renders ToolbarItem attributes.
        /// </summary>
        /// <param name="writer">The HtmlTextWriter to receive markup.</param>
        protected override void WriteItemAttributes(HtmlTextWriter writer)
        {
            base.WriteItemAttributes(writer);

            string css = CssClass;

            if (css.Length > 0)
            {
                writer.WriteAttribute("class", css);
            }

            string style = String.Empty;

            Color color = ForeColor;

            if (!color.IsEmpty)
            {
                style += "color:" + ColorTranslator.ToHtml(color) + ";";
            }

            color = BackColor;
            if (!color.IsEmpty)
            {
                style += "background-color:" + ColorTranslator.ToHtml(color) + ";";
            }

            color = BorderColor;
            if (!color.IsEmpty)
            {
                style += "border-color:" + ColorTranslator.ToHtml(color) + ";";
            }

            BorderStyle bs   = BorderStyle;
            Unit        unit = BorderWidth;

            if (bs != BorderStyle.NotSet)
            {
                style += "border-style:" + Enum.Format(typeof(BorderStyle), bs, "G") + ";";
            }

            if (!unit.IsEmpty)
            {
                style += "border-width:" + unit.ToString(CultureInfo.InvariantCulture) + ";";

                if ((bs == BorderStyle.NotSet) && (unit.Value != 0.0))
                {
                    style += "border-style:solid;";
                }
            }

            FontInfo font = Font;

            string[] names = font.Names;
            if (names.Length > 0)
            {
                style += "font-family:";
                for (int i = 0; i < names.Length; i++)
                {
                    if (i > 0)
                    {
                        style += ",";
                    }
                    style += names[i];
                }
                style += ";";
            }

            FontUnit fu = font.Size;

            if (!fu.IsEmpty)
            {
                style += "font-size:" + fu.ToString(CultureInfo.InvariantCulture) + ";";
            }

            if (font.Bold)
            {
                style += "font-weight:bold;";
            }
            if (font.Italic)
            {
                style += "font-style:italic;";
            }

            bool   underline = font.Underline;
            bool   overline  = font.Overline;
            bool   strikeout = font.Strikeout;
            string td        = String.Empty;

            if (underline)
            {
                td = "underline";
            }
            if (overline)
            {
                td += " overline";
            }
            if (strikeout)
            {
                td += " line-through";
            }
            if (td.Length > 0)
            {
                style += "text-decoration:" + td + ";";
            }

            unit = Height;
            if (!unit.IsEmpty)
            {
                style += "height:" + unit.ToString(CultureInfo.InvariantCulture) + ";";
            }

            unit = Width;
            if (!unit.IsEmpty)
            {
                style += "width:" + unit.ToString(CultureInfo.InvariantCulture) + ";";
            }

            style += Style.CssText;

            writer.WriteAttribute("style", style);

            writer.WriteAttribute("type", (TextMode == ToolbarTextBoxMode.Password) ? "password" : "text");

            if (Columns > 0)
            {
                writer.WriteAttribute("size", Columns.ToString());
            }
            if (MaxLength > 0)
            {
                writer.WriteAttribute("maxlength", MaxLength.ToString());
            }
            if (ReadOnly)
            {
                writer.WriteAttribute("readonly", ReadOnly.ToString());
            }
            if ((Text != String.Empty) && (TextMode != ToolbarTextBoxMode.Password))
            {
                writer.WriteAttribute("value", Text, true);
            }

            if (Enabled)
            {
                writer.WriteAttribute("onpropertychange", "window.document.all." + HelperID + ".value=value");
                writer.WriteAttribute("onchange", "window.document.all." + HelperID + ".value=" + ParentToolbar.ClientID + ".getItem(" + Index + ").getAttribute('value')");
                writer.WriteAttribute("onkeyup", "window.document.all." + HelperID + ".value=" + ParentToolbar.ClientID + ".getItem(" + Index + ").getAttribute('value')");
            }
            else
            {
                writer.WriteAttribute("disabled", "true");
            }

            Toolbar parent = ParentToolbar;
            string  script = "if (event.keyCode==13){event.returnValue=false;";

            if (Enabled && (parent != null) && (parent.Page != null))
            {
                string postBackRef = "if (" + parent.ClientID + ".getAttribute('_submitting') == null){" + parent.ClientID + ".setAttribute('_submitting', 'true');window.setTimeout('" + parent.Page.GetPostBackEventReference(_TextBox).Replace("'", "\\'") + "', 0, 'JScript');}";
                if (AutoPostBack)
                {
                    // Blur will cause a postback when AutoPostBack is true
                    script += "blur();";

                    // Add the blur postback handler
                    writer.WriteAttribute("_origVal", (TextMode != ToolbarTextBoxMode.Password) ? Text : String.Empty, true);
                    writer.WriteAttribute("onblur", "JScript:if (value != _origVal)" + postBackRef);
                }
                else
                {
                    // Do the postback
                    script += postBackRef + ";";
                }
            }
            script += "}";
            writer.WriteAttribute("onkeydown", script);
        }