예제 #1
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            FluidLayout control = this.ControlHost.Content as FluidLayout;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/FluidLayout");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
                this.HtmlWriter.AddAttribute("name", this.ControlHost.Name);
            }
            if (control.Cols > 0)
            {
                this.HtmlWriter.AddAttribute("cols", control.Cols.ToString());
            }
            if (control.LabelWidth > 0)
            {
                this.HtmlWriter.AddAttribute("labelWidth", control.LabelWidth.ToString());
            }
            string[] alignHorizontals = new string[] { "left", "center", "right", "right" };
            string   labelHorizontal  = alignHorizontals[(int)control.LabelPosition];

            this.HtmlWriter.AddAttribute("labelPosition", labelHorizontal);
            this.HtmlWriter.AddAttribute("showLabels", control.ShowLabels.ToString().ToLower());

            StringBuilder sbProps       = new StringBuilder();
            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);

            if (!string.IsNullOrEmpty(props))
            {
                sbProps.AppendFormat("{0},", props);
            }
            if (sbProps.ToString().Length > 0)
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false);
            }

            base.SetAttributes();
        }
예제 #2
0
        /// <summary>
        /// 设置子元素
        /// </summary>
        protected override void SetChildElements()
        {
            FluidLayout control = this.ControlHost.Content as FluidLayout;

            foreach (var child in this.ControlHost.Children)
            {
                this.HtmlWriter.AddAttribute("dojoType", "Controls/ContentPane");
                this.HtmlWriter.AddAttribute("label", child.Title);
                string controlName = child.Content.GetType().Name;
                if (controlName == "Textarea")
                {
                    Textarea ctl = child.Content as Textarea;
                    if (ctl.Height != null && ctl.Height > 0)
                    {
                        this.HtmlWriter.AddAttribute("customHeight", ctl.Height.ToString());
                    }
                }
                else if (controlName == "RichTextBox")
                {
                    RichTextBox ctl = child.Content as RichTextBox;
                    if (ctl.Height != null && ctl.Height > 0)
                    {
                        this.HtmlWriter.AddAttribute("customHeight", ctl.Height.ToString());
                    }
                }
                FluidLayoutAttach formAttach = child.AttachObject as FluidLayoutAttach;
                if (formAttach.ColumnSpan > 1)
                {
                    this.HtmlWriter.AddAttribute("colspan", formAttach.ColumnSpan.ToString().ToLower());
                }
                //if (formAttach.CollapsedTitle) this.HtmlWriter.AddAttribute("spanLabel", "true");
                this.HtmlWriter.RenderBeginTag("div");
                var builder = child.GetBuilder(this.IsPreview, this.ScreenDefinition, this.Compile, this.ProjectDocument, this.PermissionData, this.HtmlWriter);
                builder.Parent = this;
                builder.Build();
                this.HtmlWriter.RenderEndTag();
            }
        }