예제 #1
0
        public virtual void CreateHtmlString(StringBuilder sb)
        {
            sb.Append("<td ");
            if (Align != EnumAlign.Default)
            {
                sb.Append("align=\"");
                sb.Append(Align);
                sb.Append("\" ");
            }
            if (VerticalAlign != EnumVAlign.Default)
            {
                sb.Append("valign=\"");
                sb.Append(VerticalAlign);
                sb.Append("\" ");
            }
            if (ColumnSpan > 1)
            {
                sb.Append("colspan=\"");
                sb.Append(ColumnSpan);
                sb.Append("\" ");
            }
            OnCreateHtmlAttributeString(sb);

            StringBuilder sl = new StringBuilder();

            if (TextFont != null)
            {
                sl.Append(ObjectCreationCodeGen.GetFontStyleString(TextFont));
            }
            if (TextColor != Color.Empty && TextColor != Color.Black)
            {
                sl.Append("color:");
                sl.Append(ObjectCreationCodeGen.GetColorString(TextColor));
                sl.Append("; ");
            }
            if (BackColor != Color.Empty)            // && col.BackColor != this.HeadBackColor)
            {
                sl.Append("background-color:");
                sl.Append(ObjectCreationCodeGen.GetColorString(BackColor));
                sl.Append("; ");
            }
            OnCreateHtmlContentStyle(sl);
            if (sl.Length > 0)
            {
                sb.Append("style=\"");
                sb.Append(sl.ToString());
                sb.Append("\"");
            }
            sb.Append(">");
            OnCreateHtmlContentString(sb);
            sb.Append("</td>");
        }
        public override bool OnExportJavaScriptCode(ActionBranch previousAction, ActionBranch nextAction, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            string indexName = RepeatIndex.CodeName;

            methodCode.Add(Indentation.GetIndent());
            methodCode.Add("for(");
            methodCode.Add(indexName);
            methodCode.Add("=0;");
            methodCode.Add(indexName);
            methodCode.Add("<");
            methodCode.Add(RepeatCount.CreateJavaScript(methodCode));
            methodCode.Add(";");
            methodCode.Add(indexName);
            methodCode.Add("++) {\r\n");
            Indentation.IndentIncrease();
            string           indents = Indentation.GetIndent();
            StringCollection sc      = new StringCollection();

            if (_iconList != null)
            {
                foreach (ComponentIcon ci in _iconList)
                {
                    ComponentIconLocal cil = ci as ComponentIconLocal;
                    if (cil != null && cil.ScopeGroupId == this.BranchId)
                    {
                        sc.Add(indents);
                        sc.Add("var ");
                        sc.Add(cil.LocalPointer.CodeName);
                        sc.Add("=");
                        sc.Add(ObjectCreationCodeGen.ObjectCreateJavaScriptCode(VPLUtil.GetDefaultValue(cil.LocalPointer.BaseClassType)));
                        sc.Add(";\r\n");
                    }
                }
            }
            SetWithinLoop();
            Method.SubMethod.Push(this);
            data.AddSubMethod(this);
            bool bRet = base.OnExportJavaScriptCode(previousAction, nextAction, jsCode, sc, data);

            Method.SubMethod.Pop();
            //
            for (int i = 0; i < sc.Count; i++)
            {
                methodCode.Add(sc[i]);
            }
            Indentation.IndentDecrease();
            methodCode.Add(Indentation.GetIndent());
            methodCode.Add("}\r\n");
            return(bRet);
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }

            XmlUtil.SetAttribute(node, "border", 0);

            if (this.BackColor != Color.Empty && this.BackColor != Color.White)
            {
                XmlUtil.SetAttribute(node, "bgColor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            }


            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style);
            WebPageCompilerUtility.CreateElementPosition(this, style, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false);
            if (this.ForeColor != Color.Empty && this.ForeColor != Color.Black)
            {
                style.Append(" color:");
                style.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
                style.Append(";");
            }
            style.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
            XmlUtil.SetAttribute(node, "style", style.ToString());
            //
            XmlNode tr = node.OwnerDocument.CreateElement("tr");

            node.AppendChild(tr);
            for (int i = 0; i < MenuItems.Count; i++)
            {
                createTD(tr, MenuItems[i]);
            }
            //
        }
        private void createPageNavigator(HtmlNode node, int pos)
        {
            HtmlNode nd;

            if (this.AutoColumnsAndRows && pos == 1)
            {
                nd = node.OwnerDocument.CreateElement("br");
                node.AppendChild(nd);
            }
            nd = node.OwnerDocument.CreateElement("input");
            node.AppendChild(nd);
            nd.SetAttributeValue("type", "button");
            nd.SetAttributeValue("value", "|<");
            nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoFirstPage();", this.CodeName));
            nd = node.OwnerDocument.CreateElement("input");
            node.AppendChild(nd);
            nd.SetAttributeValue("type", "button");
            nd.SetAttributeValue("value", "<");
            nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoPrevPage();", this.CodeName));
            //
            nd = node.OwnerDocument.CreateElement("span");
            node.AppendChild(nd);
            nd.SetAttributeValue("id", string.Format(CultureInfo.InvariantCulture, "{0}_sp{1}", this.CodeName, pos));
            nd.SetAttributeValue("name", string.Format(CultureInfo.InvariantCulture, "{0}_sp", this.CodeName));
            StringBuilder sb = new StringBuilder();

            if (PageNavigatorFont != null)
            {
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(PageNavigatorFont));
            }
            sb.Append("color:blue;");
            nd.SetAttributeValue("style", sb.ToString());
            nd = node.OwnerDocument.CreateElement("input");
            node.AppendChild(nd);
            nd.SetAttributeValue("type", "button");
            nd.SetAttributeValue("value", ">");
            nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoNextPage();", this.CodeName));
            nd = node.OwnerDocument.CreateElement("input");
            node.AppendChild(nd);
            nd.SetAttributeValue("type", "button");
            nd.SetAttributeValue("value", ">|");
            nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoLastPage();", this.CodeName));
            if (this.AutoColumnsAndRows && pos == 0)
            {
                nd = node.OwnerDocument.CreateElement("br");
                node.AppendChild(nd);
            }
        }
예제 #5
0
        public void CreateHtmlContent(XmlNode tr)
        {
            XmlNode td = tr.OwnerDocument.CreateElement("td");

            tr.AppendChild(td);
            if (Align != EnumAlign.Default)
            {
                XmlUtil.SetAttribute(td, "align", Align);
            }
            if (VerticalAlign != EnumVAlign.Default)
            {
                XmlUtil.SetAttribute(td, "valign", VerticalAlign);
            }
            if (ColumnSpan > 1)
            {
                XmlUtil.SetAttribute(td, "colspan", ColumnSpan);
            }
            StringBuilder slc = new StringBuilder();

            if (TextFont != null)
            {
                slc.Append(ObjectCreationCodeGen.GetFontStyleString(TextFont));
            }
            if (TextColor != Color.Empty && TextColor != Color.Black)
            {
                slc.Append(" color:");
                slc.Append(ObjectCreationCodeGen.GetColorString(TextColor));
                slc.Append("; ");
            }
            if (BackColor != Color.Empty)            // && BackColor != this.HeadBackColor)
            {
                slc.Append("background-color:");
                slc.Append(ObjectCreationCodeGen.GetColorString(BackColor));
                slc.Append("; ");
            }
            OnCreateHtmlContentStyle(slc);
            if (slc.Length > 0)
            {
                XmlUtil.SetAttribute(td, "style", slc.ToString());
            }
            OnCreateHtmlContect(td);
        }
예제 #6
0
        public override CodeExpression ExportCode(IMethodCompile method)        //)
        {
            CodeStatementCollection supprtStatements = method.MethodCode.Statements;

            if (this.UseDefaultValue)
            {
                if (_default == null)
                {
                    MathNode.Trace("MathNodeParameter.ExportCode: Use default case 0:null");
                    return(ValueTypeUtil.GetDefaultCodeByType(this.DataType.Type));
                }
                else
                {
                    MathNode.Trace("MathNodeParameter.ExportCode: Use default case 1:{0}", _default);
                    return(ObjectCreationCodeGen.ObjectCreationCode(_default));
                }
            }
            else
            {
                if (this.InPort != null && this.InPort.LinkedPortID != 0)
                {
                    MathNode.Trace("MathNodeParameter.ExportCode: call linked item");
                    IMathExpression rootContainer = this.root.RootContainer;
                    if (rootContainer == null)
                    {
                        throw new MathException(XmlSerialization.FormatString("Parameter {0} not associated with a root container", this.TraceInfo));
                    }
                    MathExpItem LinkedItem = rootContainer.GetItemByID(this.InPort.LinkedPortID);
                    if (LinkedItem == null)
                    {
                        throw new MathException(string.Format("Linked Port ID {0} from ({1}) does not match an item", InPort.LinkedPortID, this.TraceInfo));
                    }
                    CodeExpression ce = LinkedItem.ReturnCodeExpression(method);
                    return(RaisDataType.GetConversionCode(LinkedItem.MathExpression.DataType, ce, this.DataType, supprtStatements));
                }
                //
                MathNode.Trace("MathNodeParameter.ExportCode: call MathNodeVariable.ExportCode");
                return(base.ExportCode(method));
            }
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            if (!string.IsNullOrEmpty(_imageFilepath))
            {
                if (File.Exists(_imageFilepath))
                {
                    WebResourceFile wf = new WebResourceFile(_imageFilepath, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _imageFilepath = wf.ResourceFile;
                    }
                    XmlNode imgNode = node.OwnerDocument.CreateElement("img");
                    node.AppendChild(imgNode);
                    XmlUtil.SetAttribute(imgNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_imageFilepath)));
                }
            }
            XmlElement ndTxt = node.OwnerDocument.CreateElement("span");

            node.AppendChild(ndTxt);
            ndTxt.InnerText = this.Text;
            ndTxt.IsEmpty   = false;
            //
            XmlUtil.SetAttribute(node, "direction", _direction.ToString().ToLowerInvariant());
            XmlUtil.SetAttribute(node, "scrollamount", _scrollAmount);
            if (_bounce)
            {
                XmlUtil.SetAttribute(node, "behavior", "alternate");
            }
            else
            {
                XmlUtil.SetAttribute(node, "behavior", "scroll");
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            if (!string.IsNullOrEmpty(_bkImageFilepath))
            {
                if (File.Exists(_bkImageFilepath))
                {
                    _resourceFiles.Add(new WebResourceFile(_bkImageFilepath, WebResourceFile.WEBFOLDER_Images, out b));
                    sb.Append("background-image:url(");
                    sb.Append(WebResourceFile.WEBFOLDER_Images);
                    sb.Append("/");
                    sb.Append(Path.GetFileName(_bkImageFilepath));
                    sb.Append("); ");
                }
            }
            //
            sb.Append("border-width:");
            sb.Append(_borderWidth.ToString(CultureInfo.InvariantCulture));
            sb.Append("; ");
            //
            sb.Append("border-style:");
            sb.Append(_borderStyle.ToString().ToLowerInvariant());
            sb.Append("; ");
            //
            sb.Append("border-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(_brColor));
            sb.Append("; ");
            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
예제 #8
0
        /// <summary>Generates a property setter or event setter statement</summary>
        /// <param name="cx"><see cref="CodeExpression"/> for which property has to be set</param>
        /// <param name="objType"><see cref="Type"/> of <see cref="object"/>, <paramref name="cx"/> is
        /// representing</param>
        /// <param name="x">Property Name</param>
        /// <param name="y">Property Value</param>
        private static CodeStatement setPropEvent(CodeExpression cx, Type objType, string x, string y)
        {
            CodeStatement as1    = null;
            MemberTypes   result = ReflectionHelper.GetMember(x, objType);

            if (result == MemberTypes.Property)
            {
                // A Property Encountered.
                CodePropertyReferenceExpression prop = new CodePropertyReferenceExpression(cx, x);
                Type t = ReflectionHelper.GetPropertyType(x, objType);
                if (t.IsPrimitive || t.Equals(typeof(System.String)))
                {
                    // A Primitive or string Property is Encountered
                    object o = ReflectionHelper.ConvertFrom(y, t);
                    if (t.Equals(typeof(IntPtr)))
                    {
                        IntPtr val = (IntPtr)o;
                        if (IntPtr.Size == 4)
                        {
                            as1 = new CodeAssignStatement(prop, new CodeObjectCreateExpression(typeof(IntPtr), new CodePrimitiveExpression(val.ToInt32())));
                        }
                        else
                        {
                            as1 = new CodeAssignStatement(prop, new CodeObjectCreateExpression(typeof(IntPtr), new CodePrimitiveExpression(val.ToInt64())));
                        }
                    }
                    else if (t.Equals(typeof(UIntPtr)))
                    {
                        UIntPtr val = (UIntPtr)o;
                        if (IntPtr.Size == 4)
                        {
                            as1 = new CodeAssignStatement(prop, new CodeObjectCreateExpression(typeof(UIntPtr), new CodePrimitiveExpression(val.ToUInt32())));
                        }
                        else
                        {
                            as1 = new CodeAssignStatement(prop, new CodeObjectCreateExpression(typeof(UIntPtr), new CodePrimitiveExpression(val.ToUInt64())));
                        }
                    }
                    else
                    {
                        as1 = new CodeAssignStatement(prop, new CodePrimitiveExpression(o));
                    }
                }
                else if (t.IsEnum)
                {
                    // An Enum Property Encountered
                    CodeTypeReferenceExpression  xpType  = new CodeTypeReferenceExpression(t);
                    CodeFieldReferenceExpression xpField = new CodeFieldReferenceExpression(xpType, y);
                    as1 = new CodeAssignStatement(prop, xpField);
                }
                else
                {
                    InstanceDescriptor idc    = ReflectionHelper.GetInstance(y, t);
                    CodeExpression     xpRite = null;
                    if (idc.Arguments == null || idc.Arguments.Count <= 0)
                    {
                        xpRite = new CodePropertyReferenceExpression(new CodeTypeReferenceExpression(t), idc.MemberInfo.Name);
                    }
                    else
                    {
                        CodeExpression[] cpargs = new CodeExpression[idc.Arguments.Count];
                        int i = 0;
                        foreach (object o in idc.Arguments)
                        {
                            cpargs[i++] = ObjectCreationCodeGen.ObjectCreationCode(o);
                        }
                        xpRite = new CodeObjectCreateExpression(t, cpargs);
                    }
                    as1 = new CodeAssignStatement(prop, xpRite);
                }
            }
            else if (result == MemberTypes.Event)
            {
                Type typeEvent = ReflectionHelper.GetEventType(x, objType);
                CodeDelegateCreateExpression xpDele = new CodeDelegateCreateExpression(
                    new CodeTypeReference(typeEvent), new CodeThisReferenceExpression(), y);
                as1 = new CodeAttachEventStatement(cx, x, xpDele);
            }
            return(as1);
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            StringBuilder sb;
            XmlNode       pNode;
            string        id = XmlUtil.GetAttribute(node, "id");

            if (string.IsNullOrEmpty(id))
            {
                id = CodeName;
            }
            XmlUtil.SetAttribute(node, "id", string.Format(CultureInfo.InvariantCulture, "{0}sp", id));
            XmlUtil.RemoveAttribute(node, "name");
            sb = new StringBuilder();
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            if (_dataNode != null)
            {
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            XmlNode chkNode = node.OwnerDocument.CreateElement("input");

            node.AppendChild(chkNode);
            XmlUtil.SetAttribute(chkNode, "id", id);
            XmlUtil.SetAttribute(chkNode, "type", "radio");
            XmlUtil.SetAttribute(chkNode, "value", this.Value);
            if (this.Parent != null)
            {
                if (groupId >= 0)
                {
                    XmlUtil.SetAttribute(chkNode, "name", string.Format(CultureInfo.InvariantCulture, "r{0}_{1}", this.Parent.Name, groupId));
                }
                else
                {
                    XmlUtil.SetAttribute(chkNode, "name", string.Format(CultureInfo.InvariantCulture, "r{0}", this.Parent.Name));
                }
            }
            if (this.Checked)
            {
                XmlUtil.SetAttribute(chkNode, "checked", this.Checked);
            }
            sb = new StringBuilder();
            if (_dataNode != null)
            {
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(chkNode, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            string st = sb.ToString();

            if (st.Length > 0)
            {
                XmlUtil.SetAttribute(chkNode, "style", st);
            }
            {
                XmlElement tn = node.OwnerDocument.CreateElement("span");
                if (string.IsNullOrEmpty(this.Text))
                {
                    tn.IsEmpty = false;
                }
                else
                {
                    tn.InnerText = this.Text;
                }
                //
                XmlUtil.SetAttribute(tn, "id", string.Format(CultureInfo.InvariantCulture, "{0}tx", id));
                //
                sb = new StringBuilder();
                //
                if (this.Parent != null)
                {
                    if (this.BackColor != this.Parent.BackColor)
                    {
                        sb.Append("background-color:");
                        sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                        sb.Append("; ");
                    }
                }
                //
                sb.Append("color:");
                sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
                sb.Append("; ");
                //
                WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, true);
                //
                XmlUtil.SetAttribute(tn, "style", sb.ToString());
                node.InsertAfter(tn, chkNode);
            }
        }
예제 #10
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            if (borderStyle != EnumBorderStyle.none && (borderWidth > 0 || (borderWidthStyle != EnumBorderWidthStyle.inherit && borderWidthStyle != EnumBorderWidthStyle.useNumber)))
            {
                sb.Append("border:");
                if (borderWidthStyle != EnumBorderWidthStyle.inherit && borderWidthStyle != EnumBorderWidthStyle.useNumber)
                {
                    sb.Append(borderWidthStyle);
                    sb.Append(" ");
                }
                else
                {
                    sb.Append(borderWidth);
                    sb.Append("px ");
                }
                sb.Append(borderStyle);
                if (borderColor != Color.Empty)
                {
                    sb.Append(" ");
                    sb.Append(ObjectCreationCodeGen.GetColorString(borderColor));
                }
                sb.Append(";");
            }
            //
            bool b;

            if (!string.IsNullOrEmpty(_bkImgFile))
            {
                if (File.Exists(_bkImgFile))
                {
                    WebResourceFile wf = new WebResourceFile(_bkImgFile, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _bkImgFile = wf.ResourceFile;
                    }
                    sb.Append("background-image:url(");
                    sb.Append(WebResourceFile.WEBFOLDER_Images);
                    sb.Append("/");
                    sb.Append(Path.GetFileName(_bkImgFile));
                    sb.Append(");");
                }
            }
            if (!BackgroundImageTile)
            {
                sb.Append("background-repeat: no-repeat;");
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                //sb.Append("disabled:true; ");
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            if (this.Controls.Count == 0)
            {
                node.InnerText = "";
            }
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
예제 #11
0
 public string GetValueJsCode()
 {
     return(ObjectCreationCodeGen.ObjectCreateJavaScriptCode(_value));
 }
        public void OnWebPageLoaded(StringCollection sc)
        {
            ClassPointer cp = this.Owner as ClassPointer;

            //
            if (_resourceFiles == null)
            {
                _resourceFiles = new List <WebResourceFile>();
            }
            bool   b;
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "dropdownbutton.jpg");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "calendar.jpg");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
            }
            string[] jsFiles = new string[14];
            jsFiles[0]  = "backstripes.gif";
            jsFiles[1]  = "bg_header.jpg";
            jsFiles[2]  = "bullet1.gif";
            jsFiles[3]  = "bullet2.gif";
            jsFiles[4]  = "cal.gif";
            jsFiles[5]  = "cal-grey.gif";
            jsFiles[6]  = "datepicker.js";
            jsFiles[7]  = "gradient-e5e5e5-ffffff.gif";
            jsFiles[8]  = "ok.png";
            jsFiles[9]  = "cancel.png";
            jsFiles[10] = "qry.jpg";
            jsFiles[11] = "chklist.jpg";
            jsFiles[12] = "plus.gif";
            jsFiles[13] = "minus.gif";
            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]);
                if (File.Exists(btimg))
                {
                    WebResourceFile w = new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b);
                    _resourceFiles.Add(w);
                    string tgt = Path.Combine(Path.Combine(cp.Project.WebPhysicalFolder(null), w.WebFolder), Path.GetFileName(btimg));
                    File.Copy(btimg, tgt, true);
                }
            }
            //
            sc.Add("\r\n");
            sc.Add(string.Format(CultureInfo.InvariantCulture, "var {0} = document.getElementById('{0}');\r\n", CodeName));
            if (this.ReadOnly)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.ReadOnly=true;\r\n", CodeName));
            }
            if (_highlightCellColor != Color.Empty)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.HighlightCellColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(_highlightCellColor)));
            }
            if (_alternateColor != Color.Empty)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.AlternateBackgroundColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(_alternateColor)));
            }
            if (_highlightRowColor != Color.Empty)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.HighlightRowColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(_highlightRowColor)));
            }
            if (_selectRowColor != Color.Empty)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.SelectedRowColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(_selectRowColor)));
            }
            if (DatePickerFonstSize != 12)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.DatePickerFonstSize={1};\r\n", CodeName, DatePickerFonstSize));
            }
            IDataSetSource ds = DataSource as IDataSetSource;

            if (ds != null)
            {
                string[] flds = ds.GetReadOnlyFields();
                if (flds != null && flds.Length > 0)
                {
                    sc.Add(string.Format(CultureInfo.InvariantCulture,
                                         "{0}.ReadOnlyFields = [\r\n", CodeName));
                    for (int i = 0; i < flds.Length; i++)
                    {
                        if (i > 0)
                        {
                            sc.Add(",");
                        }
                        sc.Add("'");
                        sc.Add(flds[i]);
                        sc.Add("'");
                    }
                    sc.Add("\r\n];\r\n");
                }
            }
            _useDatetimePicker = false;
            if (_editorList != null)
            {
                sc.Add(string.Format(CultureInfo.InvariantCulture,
                                     "{0}.FieldEditors = {{}};\r\n", CodeName));
                for (int i = 0; i < FieldCount; i++)
                {
                    string cn = this.GetFieldNameByIndex(i);
                    for (int j = 0; j < _editorList.Count; j++)
                    {
                        if (_editorList[j] != null && !(_editorList[j] is WebDataEditorNone))
                        {
                            if (string.Compare(cn, _editorList[j].ValueField, StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                string s = _editorList[j].CreateJavascriptEditor(sc);
                                sc.Add(string.Format(CultureInfo.InvariantCulture,
                                                     "{0}.FieldEditors[{1}] = {2};\r\n",
                                                     CodeName, i, s));
                                if (_editorList[j] is WebDataEditorDatetime)
                                {
                                    _useDatetimePicker = true;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            if (ActionControls.Count > 0)
            {
                bool          first = true;
                StringBuilder sbAc  = new StringBuilder();
                for (int j = 0; j < ActionControls.Count; j++)
                {
                    string nmAct = ActionControls[j];
                    if (!string.IsNullOrEmpty(nmAct))
                    {
                        if (first)
                        {
                            first = false;
                        }
                        else
                        {
                            sbAc.Append(",");
                        }
                        sbAc.Append(string.Format(CultureInfo.InvariantCulture, "'{0}'", nmAct));
                    }
                }
                if (!first)
                {
                    sc.Add(string.Format(CultureInfo.InvariantCulture,
                                         "{0}.ActControls = [{1}];\r\n", CodeName, sbAc.ToString()));
                    if (ActionColumnWidth > 0)
                    {
                        sc.Add(string.Format(CultureInfo.InvariantCulture,
                                             "{0}.ActColWidth={1};\r\n", CodeName, ActionColumnWidth));
                    }
                }
            }
        }
예제 #13
0
 public void OnWebPageLoaded(StringCollection sc)
 {
     sc.Add("\r\n");
     //
     sc.Add(string.Format(CultureInfo.InvariantCulture, "var {0} = document.getElementById('{0}');\r\n", CodeName));
     sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData=JsonDataBinding.CreateFileBrowser({0},'{1}','{2}','{3}', {4});\r\n", CodeName, StartWebFolder, StartWebFolderTitle, FileTypes, this.DontLoadRootFoldersOnStart ? "true" : "false"));
     //
     if (!string.IsNullOrEmpty(noteFontFamily))
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getFolderElement().noteFontFamily='{1}';\r\n", CodeName, noteFontFamily));
     }
     if (noteFontSize > 0)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getFolderElement().noteFontSize={1};\r\n", CodeName, noteFontSize));
     }
     if (noteFontColor != Color.Empty)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getFolderElement().noteFontColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(noteFontColor)));
     }
     if (mouseOverColor != Color.Empty)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getFolderElement().mouseOverColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(mouseOverColor)));
     }
     if (nodeBackColor != Color.Empty)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getFolderElement().nodeBackColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(nodeBackColor)));
     }
     if (selectedNodeColor != Color.Empty)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getFolderElement().selectedNodeColor='{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(nodeBackColor)));
     }
 }
 public override CodeExpression ExportCode(IMethodCompile method)
 {
     MathNode.Trace("{0}.ExportCode: reference to [{1}]", this.GetType().Name, _value);
     return(ObjectCreationCodeGen.ObjectCreationCode(_value));
 }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            if (this.RightToLeft == RightToLeft.Yes)
            {
                XmlUtil.SetAttribute(node, "dir", "RTL");
            }
            WebPageCompilerUtility.SetTextContentsToNode(node, this.Text);
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            if (this.Parent != null)
            {
                if (this.ForeColor != this.Parent.ForeColor)
                {
                    sb.Append("color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
                    sb.Append("; ");
                }
            }
            //
            if (_float != EnumInlineFloat.none && positionType == EnumWebElementPositionType.Absolute)
            {
                sb.Append("float:");
                sb.Append(_float.ToString());
                sb.Append("; ");
                if (WidthType != SizeType.AutoSize)
                {
                    sb.Append("width:");
                    if (WidthType == SizeType.Absolute)
                    {
                        sb.Append(Width.ToString(CultureInfo.InvariantCulture));
                        sb.Append("px; ");
                    }
                    else
                    {
                        sb.Append(WidthInPercent.ToString(CultureInfo.InvariantCulture));
                        sb.Append("%; ");
                    }
                }
                //
                if (HeightType != SizeType.AutoSize)
                {
                    sb.Append("height:");
                    if (HeightType == SizeType.Absolute)
                    {
                        sb.Append(Height.ToString(CultureInfo.InvariantCulture));
                        sb.Append("px; ");
                    }
                    else
                    {
                        sb.Append(HeightInPercent.ToString(CultureInfo.InvariantCulture));
                        sb.Append("%; ");
                    }
                }
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap);
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            //
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();

            bool   b;
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "limnortabs.css");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
            }
            //
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            WebPageCompilerUtility.GetElementStyleSize(this, out _widthStyle, out _heighStyle);
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent is HtmlFlowLayout)
            {
                sb.Append("min-height:");
                sb.Append(this.Height.ToString(CultureInfo.InvariantCulture));
                sb.Append("px;overflow:hidden;");
            }
            else
            {
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            //
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            string   fnt = ObjectCreationCodeGen.GetFontStyleString(this.Font);
            Graphics g   = this.CreateGraphics();

            g.PageUnit = GraphicsUnit.Pixel;
            float tabloc = (float)10;

            //
            for (int i = 0; i < TabPages.Count; i++)
            {
                TabPage p        = this.TabPages[i];
                XmlNode pageNode = node.OwnerDocument.CreateElement("section");
                node.AppendChild(pageNode);
                XmlUtil.SetAttribute(pageNode, "id", p.Name);
                XmlNode h2 = node.OwnerDocument.CreateElement("h2");
                pageNode.AppendChild(h2);
                XmlNode a = node.OwnerDocument.CreateElement("a");
                h2.AppendChild(a);
                a.InnerText = p.Text;
                XmlUtil.SetAttribute(a, "href", string.Format(CultureInfo.InvariantCulture, "#{0}", p.Name));
                SizeF         txtSize  = g.MeasureString(p.Text, this.Font);
                float         txtwidth = txtSize.Width + (float)6.0;
                StringBuilder h2style  = new StringBuilder(fnt);
                h2style.Append(string.Format(CultureInfo.InvariantCulture, "width:{0}px;", Math.Round(txtwidth, 2)));
                if (i > 0)
                {
                    h2style.Append(string.Format(CultureInfo.InvariantCulture, "left:{0}px;", Math.Round(tabloc, 2)));
                }
                tabloc = tabloc + txtwidth + (float)3;
                XmlUtil.SetAttribute(h2, "style", h2style.ToString());
                foreach (Control ct in p.Controls)
                {
                    createControlWebContents(ct, pageNode);
                }
                StringBuilder sbPageStyle = new StringBuilder();
                if (p.BackColor != Color.Empty && p.BackColor != Color.Transparent)
                {
                    sbPageStyle.Append("background-color:");
                    sbPageStyle.Append(ObjectCreationCodeGen.GetColorString(p.BackColor));
                    sbPageStyle.Append(";");
                }
                if (!string.IsNullOrEmpty(_widthStyle))
                {
                    sbPageStyle.Append("width:");
                    sbPageStyle.Append(_widthStyle);
                }
                if (!string.IsNullOrEmpty(_heighStyle))
                {
                    sbPageStyle.Append("height:");
                    sbPageStyle.Append(_heighStyle);
                }
                if (sbPageStyle.Length > 0)
                {
                    XmlUtil.SetAttribute(pageNode, "style", sbPageStyle.ToString());
                }
            }
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            string idCust = string.Format(CultureInfo.InvariantCulture, "c{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture));

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlUtil.SetAttribute(node, "action", _serverPage);
            XmlUtil.SetAttribute(node, "method", "post");
            XmlUtil.SetAttribute(node, "enctype", "multipart/form-data");
            XmlUtil.SetAttribute(node, HtmlFileUpload.HIDDENRequest, idCust);
            //
            XmlNode jsonNode = node.OwnerDocument.CreateElement("input");

            node.AppendChild(jsonNode);
            XmlUtil.SetAttribute(jsonNode, "type", "hidden");
            XmlUtil.SetAttribute(jsonNode, "id", idCust);
            XmlUtil.SetNameAttribute(jsonNode, HtmlFileUpload.HIDDENRequest);
            //
            string ifId = HtmlFileUploadGroup.CreateIFrame(node);

            XmlUtil.SetAttribute(node, "target", ifId);
            //
            StringBuilder sb = new StringBuilder();

            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            IWebPageLayout wl = this.Parent as IWebPageLayout;

            if (wl != null)
            {
                sb.Append("width:100%; height:100%; ");
            }
            else
            {
                if (WidthType != SizeType.AutoSize)
                {
                    sb.Append("width:");
                    if (WidthType == SizeType.Absolute)
                    {
                        sb.Append(Width.ToString(CultureInfo.InvariantCulture));
                        sb.Append("px; ");
                    }
                    else
                    {
                        sb.Append(WidthInPercent.ToString(CultureInfo.InvariantCulture));
                        sb.Append("%; ");
                    }
                }
                //
                if (HeightType != SizeType.AutoSize)
                {
                    sb.Append("height:");
                    if (HeightType == SizeType.Absolute)
                    {
                        sb.Append(Height.ToString(CultureInfo.InvariantCulture));
                        sb.Append("px; ");
                    }
                    else
                    {
                        sb.Append(HeightInPercent.ToString(CultureInfo.InvariantCulture));
                        sb.Append("%; ");
                    }
                }
            }
            sb.Append("border: solid 1px #40a0c0;");
            if (_xmlNode != null)
            {
                XmlNode pNode = _xmlNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                        "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlElement tNode = node.OwnerDocument.CreateElement("legend");

            node.AppendChild(tNode);
            tNode.InnerText = this.Text;
            tNode.IsEmpty   = false;
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
예제 #19
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();

            foreach (Control ct in this.Controls)
            {
                createControlWebContents(ct, node, groupId);
            }
            //
            StringBuilder sb = new StringBuilder();

            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            if (this.BorderStyle != BorderStyle.None)
            {
                sb.Append("border:1px solid black;");
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
        public override bool OnExportJavaScriptCode(ActionBranch previousAction, ActionBranch nextAction, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            string c;

            if (_logicExpression == null)
            {
                c = "true";
            }
            else
            {
                _logicExpression.PrepareForCompile(this.Method);
                c = _logicExpression.CreateJavaScript(methodCode);
            }
            methodCode.Add(Indentation.GetIndent());
            string initCodeStr  = null;
            string increCodeStr = null;

            if (_initAction != null)
            {
                if (_initAction.Action == null)
                {
                    _initAction.OnPostRootDeserialize();
                }
                if (_initAction.Action != null)
                {
                    StringCollection initCode = new StringCollection();
                    _initAction.Action.ExportJavaScriptCode(null, null, methodCode, initCode, data);
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < initCode.Count; i++)
                    {
                        sb.Append(initCode[i]);
                    }
                    initCodeStr = sb.ToString().Replace("\r\n", "");
                }
            }
            if (_increAction != null)
            {
                if (_increAction.Action == null)
                {
                    _increAction.OnPostRootDeserialize();
                }
                if (_increAction.Action != null)
                {
                    StringCollection increCode = new StringCollection();
                    _increAction.Action.ExportJavaScriptCode(null, null, methodCode, increCode, data);
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < increCode.Count; i++)
                    {
                        sb.Append(increCode[i]);
                    }
                    increCodeStr = sb.ToString().Replace("\r\n", "");
                }
            }
            if (string.IsNullOrEmpty(initCodeStr))
            {
                initCodeStr = ";";
            }
            if (!string.IsNullOrEmpty(increCodeStr))
            {
                increCodeStr = increCodeStr.Trim();
                while (increCodeStr.EndsWith(";", StringComparison.Ordinal))
                {
                    increCodeStr = increCodeStr.Substring(0, increCodeStr.Length - 1);
                    increCodeStr = increCodeStr.Trim();
                }
            }
            methodCode.Add("for(");
            methodCode.Add(initCodeStr);
            methodCode.Add(c);
            methodCode.Add(";");
            methodCode.Add(increCodeStr);
            methodCode.Add(") {\r\n");
            Indentation.IndentIncrease();
            string           indents = Indentation.GetIndent();
            StringCollection sc      = new StringCollection();

            if (_iconList != null)
            {
                foreach (ComponentIcon ci in _iconList)
                {
                    ComponentIconLocal cil = ci as ComponentIconLocal;
                    if (cil != null && cil.ScopeGroupId == this.BranchId)
                    {
                        sc.Add(indents);
                        sc.Add("var ");
                        sc.Add(cil.LocalPointer.CodeName);
                        sc.Add("=");
                        sc.Add(ObjectCreationCodeGen.ObjectCreateJavaScriptCode(VPLUtil.GetDefaultValue(cil.LocalPointer.BaseClassType)));
                        sc.Add(";\r\n");
                    }
                }
            }
            Method.SubMethod.Push(this);
            data.AddSubMethod(this);
            bool bRet = base.OnExportJavaScriptCode(previousAction, nextAction, jsCode, sc, data);

            Method.SubMethod.Pop();
            //
            for (int i = 0; i < sc.Count; i++)
            {
                methodCode.Add(sc[i]);
            }
            Indentation.IndentDecrease();
            methodCode.Add(Indentation.GetIndent());
            methodCode.Add("}\r\n");
            return(bRet);
        }
예제 #21
0
        public static CodeExpression GetDefaultCodeByType(Type t)
        {
            if (t.Equals(typeof(void)))
            {
                return(new CodePrimitiveExpression(null));
            }

            TypeCode tc = Type.GetTypeCode(t);

            switch (tc)
            {
            case TypeCode.Boolean:
                return(new CodePrimitiveExpression(false));

            case TypeCode.Byte:
                return(new CodePrimitiveExpression(default(byte)));

            case TypeCode.Char:
                return(new CodePrimitiveExpression(default(char)));

            case TypeCode.DateTime:
                return(ObjectCreationCodeGen.ObjectCreationCode(default(DateTime)));

            case TypeCode.Decimal:
                return(new CodePrimitiveExpression((decimal)0));

            case TypeCode.Double:
                return(new CodePrimitiveExpression(default(double)));

            case TypeCode.Int16:
                return(new CodePrimitiveExpression(default(Int16)));

            case TypeCode.Int32:
                if (t.IsEnum)
                {
                    Array a = Enum.GetValues(t);
                    return(new CodeFieldReferenceExpression(
                               new CodeTypeReferenceExpression(t), a.GetValue(0).ToString()));
                }
                return(new CodePrimitiveExpression(default(Int32)));

            case TypeCode.Int64:
                return(new CodePrimitiveExpression(default(Int64)));

            case TypeCode.SByte:
                return(new CodePrimitiveExpression(default(sbyte)));

            case TypeCode.Single:
                return(new CodePrimitiveExpression(default(Single)));

            case TypeCode.String:
                return(new CodePrimitiveExpression(""));

            case TypeCode.UInt16:
                return(new CodePrimitiveExpression(default(UInt16)));

            case TypeCode.UInt32:
                return(new CodePrimitiveExpression(default(UInt32)));

            case TypeCode.UInt64:
                return(new CodePrimitiveExpression(default(UInt64)));

            case TypeCode.Object:
                return(ObjectCreationCodeGen.ObjectCreationCode(VPLUtil.GetDefaultValue(t)));

            case TypeCode.DBNull:
                return(new CodePrimitiveExpression(null));

            case TypeCode.Empty:
                return(new CodePrimitiveExpression(null));

            default:
                return(new CodeDefaultValueExpression(new CodeTypeReference(t)));
            }
        }
        public static void CreateElementPosition(Control c, StringBuilder sb, EnumWebElementPositionType positionType)
        {
            IWebClientControl wcc = c as IWebClientControl;

            if (wcc != null)
            {
                if (wcc.textAlign != EnumTextAlign.left)
                {
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "text-align:{0};", wcc.textAlign));
                }
                //
                string widthStyle, heightStyle;
                GetElementStyleSize(wcc, out widthStyle, out heightStyle);
                if (!string.IsNullOrEmpty(widthStyle))
                {
                    sb.Append("width:");
                    sb.Append(widthStyle);
                }
                if (!string.IsNullOrEmpty(heightStyle))
                {
                    sb.Append("height:");
                    sb.Append(heightStyle);
                }
                //
            }
            IWebBox wb = c as IWebBox;

            if (wb != null)
            {
                if (wb.Box.BorderRadius > 0)
                {
                    sb.Append("border-radius:");
                    sb.Append(wb.Box.BorderRadius.ToString(CultureInfo.InvariantCulture));
                    sb.Append("px;");
                }
                if (wb.Box.BoxShadow > 0)
                {
                    int bs = 1;
                    if (wb.Box.BoxShadow > 2)
                    {
                        bs = wb.Box.BoxShadow / 2;
                    }
                    string cs;
                    if (wb.Box.ShadowColor == Color.Empty)
                    {
                        cs = ObjectCreationCodeGen.GetColorString(Color.DarkGray);
                    }
                    else
                    {
                        cs = ObjectCreationCodeGen.GetColorString(wb.Box.ShadowColor);
                    }
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "box-shadow:{0}px {0}px {1}px {2};", wb.Box.BoxShadow, bs, cs));
                }
                if (wb.Box.GradientEndColor != Color.Empty || wb.Box.GradientStartColor != Color.Empty)
                {
                    string c1;
                    if (wb.Box.GradientStartColor != Color.Empty)
                    {
                        c1 = ObjectCreationCodeGen.GetColorString(wb.Box.GradientStartColor);
                    }
                    else
                    {
                        c1 = ObjectCreationCodeGen.GetColorString(Color.White);
                    }
                    string c2;
                    if (wb.Box.GradientEndColor != Color.Empty)
                    {
                        c2 = ObjectCreationCodeGen.GetColorString(wb.Box.GradientEndColor);
                    }
                    else
                    {
                        c2 = ObjectCreationCodeGen.GetColorString(Color.White);
                    }
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "background-image:-ms-linear-gradient({0}deg, {1}, {2});", wb.Box.GradientAngle, c1, c2));
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "background-image:-o-linear-gradient({0}deg, {1}, {2});", wb.Box.GradientAngle, c1, c2));
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "background-image:-moz-linear-gradient({0}deg, {1}, {2});", wb.Box.GradientAngle, c1, c2));
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "background-image:-webkit-linear-gradient({0}deg, {1}, {2});", wb.Box.GradientAngle, c1, c2));
                }
            }
            IScrollableWebControl sw = c as IScrollableWebControl;

            if (sw != null)
            {
                if (sw.Overflow != EnumOverflow.visible)
                {
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "overflow:{0};", sw.Overflow));
                }
            }
            if (c.RightToLeft == RightToLeft.Yes)
            {
                sb.Append("direction:rtl;");
            }
            if (positionType != EnumWebElementPositionType.Auto)
            {
                if (positionType == EnumWebElementPositionType.Absolute)
                {
                    sb.Append("position: absolute; ");
                    Point pointForm = c.Location;
                    sb.Append("left:");
                    sb.Append(pointForm.X.ToString(CultureInfo.InvariantCulture));
                    sb.Append("px; ");
                    sb.Append("top:");
                    sb.Append(pointForm.Y.ToString(CultureInfo.InvariantCulture));
                    sb.Append("px; ");
                }
                else if (positionType == EnumWebElementPositionType.Relative)
                {
                    sb.Append("position: relative; ");
                    sb.Append("left:");
                    sb.Append(c.Left.ToString(CultureInfo.InvariantCulture));
                    sb.Append("px; ");
                    //
                    sb.Append("top:");
                    sb.Append(c.Top.ToString(CultureInfo.InvariantCulture));
                    sb.Append("px; ");
                }
                else if (positionType == EnumWebElementPositionType.FloatLeft)
                {
                    sb.Append("float:left; ");
                }
                else if (positionType == EnumWebElementPositionType.FloatRight)
                {
                    sb.Append("float:right; ");
                }
                else if (positionType == EnumWebElementPositionType.FloatCenter)
                {
                    sb.Append("float:center; ");
                }
            }
            IWebClientControl wc = c as IWebClientControl;

            if (wc != null)
            {
                if (wc.Opacity < 100)
                {
                    sb.Append(string.Format(CultureInfo.InvariantCulture, "opacity:{0};filter:alpha(opacity={1}); ", ((double)wc.Opacity / (double)100).ToString("#.##", CultureInfo.InvariantCulture), wc.Opacity));
                }
            }
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            for (int i = 0; i < Items.Count; i++)
            {
                string v;
                string s = VPLUtil.ObjectToString(Items[i]);
                if (!string.IsNullOrEmpty(s))
                {
                    int n = s.IndexOf('|');
                    if (n >= 0)
                    {
                        v = s.Substring(n + 1).Trim();
                        s = s.Substring(0, n).Trim();
                    }
                    else
                    {
                        v = s;
                    }
                }
                else
                {
                    v = string.Empty;
                }
                XmlElement oNode = node.OwnerDocument.CreateElement("option");
                node.AppendChild(oNode);
                XmlUtil.SetAttribute(oNode, "value", v);
                oNode.InnerText = s;
                oNode.IsEmpty   = false;
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            StringBuilder dbs = new StringBuilder();

            if (this.DataBindings != null && this.DataBindings.Count > 0)
            {
                string tbl2    = null;
                string sIdx    = string.Empty;
                string slItem  = string.Empty;
                string slValue = string.Empty;
                for (int i = 0; i < DataBindings.Count; i++)
                {
                    if (DataBindings[i].DataSource != null)
                    {
                        if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(DataBindings[i].PropertyName, "selectedIndex", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex",
                                                 DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember);
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2   = DataBindings[i].BindingMemberInfo.BindingPath;
                            slItem = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2    = DataBindings[i].BindingMemberInfo.BindingPath;
                            slValue = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(sIdx))
                {
                    dbs.Append(sIdx);
                }
                if (!string.IsNullOrEmpty(tbl2))
                {
                    if (dbs.Length > 0)
                    {
                        dbs.Append(";");
                    }
                    dbs.Append(tbl2);
                    dbs.Append(":");
                    dbs.Append(slItem);
                    dbs.Append(":");
                    dbs.Append(slValue);
                }
                if (dbs.Length > 0)
                {
                    XmlUtil.SetAttribute(node, "jsdb", dbs.ToString());
                }
                if (this.AddBlankOnDataBinding)
                {
                    XmlUtil.SetAttribute(node, "useblank", "true");
                }
            }
            //
            if (this.Items.Count == 0)
            {
                node.InnerText = "";
            }
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
예제 #24
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            if (ReadOnly)
            {
                XmlUtil.SetAttribute(node, "readonly", true);
            }
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();
            Dictionary <int, Dictionary <int, List <Control> > > ctrls = new Dictionary <int, Dictionary <int, List <Control> > >();

            for (int r = 0; r < RowCount; r++)
            {
                Dictionary <int, List <Control> > cr = new Dictionary <int, List <Control> >();
                ctrls.Add(r, cr);
                for (int c = 0; c < ColumnCount; c++)
                {
                    List <Control> cs = new List <Control>();
                    cr.Add(c, cs);
                }
            }
            foreach (Control ct in this.Controls)
            {
                int i = this.GetRow(ct);
                int j = this.GetColumn(ct);
                if (i >= 0 && i < RowCount)
                {
                    if (j >= 0 && j < ColumnCount)
                    {
                        Dictionary <int, List <Control> > cr;
                        ctrls.TryGetValue(i, out cr);
                        List <Control> cs;
                        cr.TryGetValue(j, out cs);
                        cs.Add(ct);
                    }
                }
            }
            for (int r = 0; r < RowCount; r++)
            {
                Dictionary <int, List <Control> > cr;
                ctrls.TryGetValue(r, out cr);
                XmlNode rNode = node.OwnerDocument.CreateElement("tr");
                node.AppendChild(rNode);
                if (_eventHandlers != null)
                {
                    foreach (KeyValuePair <string, string> kv in _eventHandlers)
                    {
                        if (string.CompareOrdinal(kv.Key, "onRowClick") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onclick", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseDown") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmousedown", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseUp") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmouseup", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }

                        else if (string.CompareOrdinal(kv.Key, "onRowMouseMove") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmousemove", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseOver") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmouseover", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseOut") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmouseout", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                    }
                }
                for (int c = 0; c < ColumnCount; c++)
                {
                    XmlNode cNode = node.OwnerDocument.CreateElement("td");
                    rNode.AppendChild(cNode);
                    if (_eventHandlers != null)
                    {
                        foreach (KeyValuePair <string, string> kv in _eventHandlers)
                        {
                            if (string.CompareOrdinal(kv.Key, "onCellClick") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onclick", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseDown") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmousedown", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseUp") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmouseup", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }

                            else if (string.CompareOrdinal(kv.Key, "onCellMouseMove") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmousemove", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseOver") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmouseover", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseOut") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmouseout", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                        }
                    }
                    List <Control> cs;
                    cr.TryGetValue(c, out cs);
                    foreach (Control ct in cs)
                    {
                        createControlWebContents(ct, cNode, groupId);
                    }
                }
            }
            //
            XmlUtil.SetAttribute(node, "border", _cellBorderWidth);
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            IDataSetSource ids = DataSource as IDataSetSource;

            if (ids != null && !string.IsNullOrEmpty(ids.TableName))
            {
                XmlUtil.SetAttribute(node, "jsdb", ids.TableName);
            }
        }
 public void OnWebPageLoaded(StringCollection sc)
 {
     if (_resourceFiles == null)
     {
         _resourceFiles = new List <WebResourceFile>();
     }
     sc.Add("\r\n");
     //
     sc.Add(string.Format(CultureInfo.InvariantCulture, "var {0} = document.getElementById('{0}');\r\n", CodeName));
     sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData=JsonDataBinding.CreateMenu({0});\r\n", CodeName));
     //
     if (mouseOverColor != Color.Empty)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.mouseOverColor = '{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(mouseOverColor)));
     }
     if (selectedMenuBackColor != Color.Empty)
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.selectedMenuBackColor = '{1}';\r\n", CodeName, ObjectCreationCodeGen.GetColorString(selectedMenuBackColor)));
     }
     for (int i = 0; i < MenuItems.Count; i++)
     {
         if (MenuItems[i].MenuItems.Count > 0)
         {
             sc.Add(string.Format(CultureInfo.InvariantCulture, "var {0} = [\r\n", MenuItems[i].id));
             createSubmenus(sc, MenuItems[i].MenuItems);
             sc.Add("];\r\n");
             sc.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.addSubMenu('{1}',{1});\r\n", CodeName, MenuItems[i].id));
         }
     }
 }
예제 #26
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlNode brNode = node.OwnerDocument.CreateElement("br");

            ((XmlElement)node).IsEmpty = false;
            node.AppendChild(brNode);
            if (_resourceFiles == null)
            {
                _resourceFiles = new List <WebResourceFile>();
            }
            //
            string[] jsFiles = new string[16];
            jsFiles[0]  = "empty_0.png";
            jsFiles[1]  = "empty_dn.png";
            jsFiles[2]  = "empty_up.png";
            jsFiles[3]  = "empty_up_dn.png";
            jsFiles[4]  = "h1.png";
            jsFiles[5]  = "l_up_dn.png";
            jsFiles[6]  = "minus_0.png";
            jsFiles[7]  = "minus_dn.png";
            jsFiles[8]  = "minus_up.png";
            jsFiles[9]  = "minus_up_dn.png";
            jsFiles[10] = "plus_0.png";
            jsFiles[11] = "plus_dn.png";
            jsFiles[12] = "plus_up.png";
            jsFiles[13] = "plus_up_dn.png";
            jsFiles[14] = "vl.png";
            jsFiles[15] = "w20.png";
            string btimg;
            string dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "webTreeView");

            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(dir, jsFiles[i]);
                if (File.Exists(btimg))
                {
                    bool b;
                    _resourceFiles.Add(new WebResourceFile(btimg, "treeview", out b));
                }
            }
            dir   = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "libjs");
            btimg = Path.Combine(dir, "html_file.png");
            if (File.Exists(btimg))
            {
                bool b;
                _resourceFiles.Add(new WebResourceFile(btimg, "libjs", out b));
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("border-style:");
            sb.Append(_borderStyle);
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
 public override string CreateJavaScript(StringCollection method)
 {
     return(ObjectCreationCodeGen.ObjectCreateJavaScriptCode(_value));
 }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlNode okNode = node.OwnerDocument.CreateElement("img");

            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(okNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(okNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(okNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.onOK();", CodeName));
            node.AppendChild(okNode);
            bool            b;
            string          imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ok.png");
            WebResourceFile wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);

            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(okNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            //
            XmlNode spaceNode = node.OwnerDocument.CreateElement("span");

            spaceNode.InnerText = " ";
            node.AppendChild(spaceNode);
            //
            XmlNode cancelNode = node.OwnerDocument.CreateElement("img");

            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(cancelNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(cancelNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(cancelNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.onCancel();", CodeName));
            imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "cancel.png");
            wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);
            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(cancelNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            node.AppendChild(cancelNode);
            //
            spaceNode           = node.OwnerDocument.CreateElement("span");
            spaceNode.InnerText = "  ";
            node.AppendChild(spaceNode);
            //
            XmlNode chkAllNode = node.OwnerDocument.CreateElement("img");

            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(chkAllNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.selectAll();", CodeName));
            imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "checkbox.png");
            wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);
            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(chkAllNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            node.AppendChild(chkAllNode);
            //
            spaceNode           = node.OwnerDocument.CreateElement("span");
            spaceNode.InnerText = "  ";
            node.AppendChild(spaceNode);
            //
            chkAllNode = node.OwnerDocument.CreateElement("img");
            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(chkAllNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.selectNone();", CodeName));
            imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "box.png");
            wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);
            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(chkAllNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            node.AppendChild(chkAllNode);
            //
            XmlNode brNode = node.OwnerDocument.CreateElement("br");

            node.AppendChild(brNode);
            XmlNode lstNode = node.OwnerDocument.CreateElement("select");

            node.AppendChild(lstNode);
            XmlUtil.SetAttribute(lstNode, "id", string.Format(CultureInfo.InvariantCulture, "{0}_sel", CodeName));
            for (int i = 0; i < _listBox.Items.Count; i++)
            {
                string v;
                string s = VPLUtil.ObjectToString(_listBox.Items[i]);
                if (!string.IsNullOrEmpty(s))
                {
                    int n = s.IndexOf('|');
                    if (n >= 0)
                    {
                        v = s.Substring(n + 1).Trim();
                        s = s.Substring(0, n).Trim();
                    }
                    else
                    {
                        v = s;
                    }
                }
                else
                {
                    v = string.Empty;
                }
                XmlElement oNode = node.OwnerDocument.CreateElement("option");
                lstNode.AppendChild(oNode);
                XmlUtil.SetAttribute(oNode, "value", v);
                oNode.InnerText = s;
                oNode.IsEmpty   = false;
            }
            Graphics g  = this.CreateGraphics();
            SizeF    sf = g.MeasureString("H", this.Font);
            float    h  = (float)this.Height / sf.Height;

            XmlUtil.SetAttribute(lstNode, "size", Convert.ToInt32(h + 1));
            XmlUtil.SetAttribute(lstNode, "multiple", "multiple");
            //
            StringBuilder sblst = new StringBuilder();
            StringBuilder sb    = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            sblst.Append(sb.ToString());
            sblst.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
            XmlUtil.SetAttribute(lstNode, "style", sblst.ToString());
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            StringBuilder dbs = new StringBuilder();

            if (this.DataBindings != null && this.DataBindings.Count > 0)
            {
                string tbl2    = null;
                string sIdx    = string.Empty;
                string slItem  = string.Empty;
                string slValue = string.Empty;
                for (int i = 0; i < DataBindings.Count; i++)
                {
                    if (DataBindings[i].DataSource != null)
                    {
                        if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex",
                                                 DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember);
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2   = DataBindings[i].BindingMemberInfo.BindingPath;
                            slItem = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2    = DataBindings[i].BindingMemberInfo.BindingPath;
                            slValue = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(sIdx))
                {
                    dbs.Append(sIdx);
                }
                if (!string.IsNullOrEmpty(tbl2))
                {
                    if (dbs.Length > 0)
                    {
                        dbs.Append(";");
                    }
                    dbs.Append(tbl2);
                    dbs.Append(":");
                    dbs.Append(slItem);
                    dbs.Append(":");
                    dbs.Append(slValue);
                }
                if (dbs.Length > 0)
                {
                    XmlUtil.SetAttribute(lstNode, "jsdb", dbs.ToString());
                }
            }
            if (_listBox.Items.Count == 0)
            {
                lstNode.InnerText = "";
            }
            XmlElement xe = (XmlElement)lstNode;

            xe.IsEmpty = false;
        }
예제 #29
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlUtil.SetAttribute(node, "classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
            XmlUtil.SetAttribute(node, "width", this.Width);
            XmlUtil.SetAttribute(node, "height", this.Height);
            XmlUtil.SetAttribute(node, "align", "middle");
            if (!string.IsNullOrEmpty(PlayerDownloadUrl))
            {
                XmlUtil.SetAttribute(node, "codebase", PlayerDownloadUrl);
            }
            _resourceFiles = new List <WebResourceFile>();
            WebResourceFile wf;
            string          swf = string.Empty;

            if (!string.IsNullOrEmpty(_swfFile))
            {
                if (File.Exists(_swfFile))
                {
                    wf = new WebResourceFile(_swfFile, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _swfFile = wf.ResourceFile;
                    }
                    swf = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_swfFile));
                }
            }
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            setParam(node, "movie", swf);
            //
            setParam(node, "quality", Quality.ToString());
            //
            setParam(node, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            if (!Play)
            {
                setParam(node, "play", "false");
            }
            if (!Loop)
            {
                setParam(node, "loop", "false");
            }
            if (Menu)
            {
                setParam(node, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                setParam(node, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                setParam(node, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                setParam(node, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                setParam(node, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                setParam(node, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                setParam(node, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }
            //
            XmlNode embedNode = node.OwnerDocument.CreateElement("embed");

            node.AppendChild(embedNode);
            XmlUtil.SetNameAttribute(embedNode, this.CodeName);
            XmlUtil.SetAttribute(embedNode, "src", swf);
            XmlUtil.SetAttribute(embedNode, "width", this.Width);
            XmlUtil.SetAttribute(embedNode, "height", this.Height);
            XmlUtil.SetAttribute(embedNode, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            XmlUtil.SetAttribute(embedNode, "quality", this.Quality);
            XmlUtil.SetAttribute(embedNode, "name", Path.GetFileName(swf));
            XmlUtil.SetAttribute(embedNode, "type", "application/x-shockwave-flash");
            XmlUtil.SetAttribute(embedNode, "PLUGINSPAGE", "http://www.macromedia.com/go/getflashplayer");
            if (!Play)
            {
                XmlUtil.SetAttribute(embedNode, "play", "false");
            }
            if (!Loop)
            {
                XmlUtil.SetAttribute(embedNode, "loop", "false");
            }
            if (Menu)
            {
                XmlUtil.SetAttribute(embedNode, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                XmlUtil.SetAttribute(embedNode, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                XmlUtil.SetAttribute(embedNode, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                XmlUtil.SetAttribute(embedNode, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                XmlUtil.SetAttribute(embedNode, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                XmlUtil.SetAttribute(embedNode, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                XmlUtil.SetAttribute(embedNode, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }

            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style);
            WebPageCompilerUtility.CreateElementPosition(this, style, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false);

            XmlUtil.SetAttribute(node, "style", style.ToString());
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            OnSetType(node);
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            if (IncludeDatetimePickerButton)
            {
                bool   b;
                string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css");
                if (File.Exists(btimg))
                {
                    _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
                }
                string[] jsFiles = new string[8];
                jsFiles[0] = "backstripes.gif";
                jsFiles[1] = "bg_header.jpg";
                jsFiles[2] = "bullet1.gif";
                jsFiles[3] = "bullet2.gif";
                jsFiles[4] = "cal.gif";
                jsFiles[5] = "cal-grey.gif";
                jsFiles[6] = "datepicker.js";
                jsFiles[7] = "gradient-e5e5e5-ffffff.gif";
                for (int i = 0; i < jsFiles.Length; i++)
                {
                    btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]);
                    if (File.Exists(btimg))
                    {
                        _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b));
                    }
                }
                bool    inDataRepeater = false;
                Control p = this.Parent;
                while (p != null)
                {
                    if (p is HtmlDataRepeater)
                    {
                        inDataRepeater = true;
                        break;
                    }
                    p = p.Parent;
                }
                if (inDataRepeater)
                {
                    string fs = "10px";
                    if (!string.IsNullOrEmpty(this.DatetimePickerFontSize))
                    {
                        fs = DatetimePickerFontSize.Trim();
                        if (fs.Length == 0)
                        {
                            fs = "10px";
                        }
                    }
                    string includeTime = DatetimePickerIncludeTime ? "true" : "false";
                    XmlUtil.SetAttribute(node, "useDP", true);
                    XmlUtil.SetAttribute(node, "useDPTime", includeTime);
                    XmlUtil.SetAttribute(node, "useDPSize", fs);
                }
            }
            if (this.ReadOnly)
            {
                XmlUtil.SetAttribute(node, "readonly", "true");
            }
            if (this.MaxLength > 0 && this.MaxLength < int.MaxValue)
            {
                XmlUtil.SetAttribute(node, "maxlength", this.MaxLength.ToString(CultureInfo.InvariantCulture));
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap);
        }