コード例 #1
0
 protected virtual void AddDesignerRegions(DesignerRegionCollection regions)
 {
     if (this.SupportsDesignerRegions)
     {
         foreach (WizardStepBase base2 in this._wizard.WizardSteps)
         {
             if (base2 is TemplatedWizardStep)
             {
                 TemplateDefinition templateDefinition = new TemplateDefinition(this, "ContentTemplate", this._wizard, "ContentTemplate", this.TemplateStyleArray[5]);
                 DesignerRegion region = new WizardStepTemplatedEditableRegion(templateDefinition, base2) {
                     Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
                 };
                 regions.Add(region);
             }
             else
             {
                 DesignerRegion region2 = new WizardStepEditableRegion(this, base2) {
                     Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
                 };
                 regions.Add(region2);
             }
         }
         foreach (WizardStepBase base3 in this._wizard.WizardSteps)
         {
             regions.Add(new WizardSelectableRegion(this, "Move to " + this.GetRegionName(base3), base3));
         }
     }
 }
コード例 #2
0
ファイル: SimpleFormDesigner.cs プロジェクト: g992com/esb
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            string title = CurrentControl.Title;
            if (String.IsNullOrEmpty(title))
            {
                title = String.Format("[{0}]", CurrentControl.ID);
            }

            EditableDesignerRegion itemsRegion = new EditableDesignerRegion(this, "Items", true);
            regions.Add(itemsRegion);

            string itemsContent = String.Format("<div style=\"border:solid 1px #ccc;\"><div style=\"font-size:11px;background-color:#ddd;\">Items</div><div style=\"padding:2px;\" {0}=\"{1}\">{2}</div></div>",
                DesignerRegion.DesignerRegionAttributeName, "0", GetEditableDesignerRegionContent(itemsRegion));


            string toolbarsContent = "";

            if (CurrentControl.Toolbars.Count > 0)
            {
                EditableDesignerRegion toolbarsRegion = new EditableDesignerRegion(this, "Toolbars", true);
                regions.Add(toolbarsRegion);

                toolbarsContent = String.Format("<div style=\"border:solid 1px #ccc;margin-bottom:5px;\"><div style=\"font-size:11px;background-color:#ddd;\">Toolbars</div><div style=\"padding:2px;\" {0}=\"{1}\">{2}</div></div>",
                    DesignerRegion.DesignerRegionAttributeName, "1", GetEditableDesignerRegionContent(toolbarsRegion));
            }
            
            return String.Format(TEMPLATE, title, toolbarsContent, itemsContent);
        }
コード例 #3
0
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append(@"<table style=""border:1px solid #CCC"">");
     EditableDesignerRegion region = GetEditableRegion(_Control.FirstTemplate, "First", "0", sb);
     EditableDesignerRegion region2 = GetEditableRegion(_Control.SecondTemplate, "Second", "1", sb);
     sb.Append("</table>");
     regions.Add(region);
     regions.Add(region2);
     return sb.ToString();
 }
コード例 #4
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            this.CreateChildControls();

            for (int i = 0; i < _nbRegions; i++)
            {

                DesignerRegion r;

                if (_currentRegion == i)

                    r = new EditableDesignerRegion(this, i.ToString());

                else

                    r = new DesignerRegion(this, i.ToString());

                regions.Add(r);

            }

            if ((_currentRegion >= 0) && (_currentRegion < _nbRegions))

                regions[_currentRegion].Highlight = true;

            return base.GetDesignTimeHtml(regions);
        }
コード例 #5
0
        public override String GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            int i = 0;
            foreach (TabPage tabPage in tabControl.TabPages)
            {
                regions.Add(new DesignerRegion(this, HEADER_PREFIX + i.ToString()));
                i++;
            }

            EditableDesignerRegion editableRegion =
                new EditableDesignerRegion(this,
                    CONTENT_PREFIX + tabControl.CurrentDesignTab, false);
            regions.Add(editableRegion);
            regions[tabControl.CurrentDesignTab].Highlight = true;
            return base.GetDesignTimeHtml();
        }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     try
     {
         WebPartZone viewControl = (WebPartZone) base.ViewControl;
         bool flag = base.UseRegions(regions, this._zone.ZoneTemplate, viewControl.ZoneTemplate);
         if ((viewControl.ZoneTemplate == null) && !flag)
         {
             return this.GetEmptyDesignTimeHtml();
         }
         ((ICompositeControlDesignerAccessor) viewControl).RecreateChildControls();
         if (flag)
         {
             viewControl.Controls.Clear();
             WebPartEditableDesignerRegion region = new WebPartEditableDesignerRegion(viewControl, base.TemplateDefinition) {
                 IsSingleInstanceTemplate = true,
                 Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
             };
             regions.Add(region);
         }
         return base.GetDesignTimeHtml();
     }
     catch (Exception exception)
     {
         return this.GetErrorDesignTimeHtml(exception);
     }
 }
コード例 #7
0
        public override string GetDesignTimeHtml(System.Web.UI.Design.DesignerRegionCollection regions)
        {
            regions.Clear();
            DesignerRegion content = new DesignerRegion(this, "0", true);

            regions.Add(content);
            return(base.GetDesignTimeHtml(regions));
        }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     EditableDesignerRegion region = new EditableDesignerRegion(this, "Text") {
         Description = System.Design.SR.GetString("LocalizeDesigner_RegionWatermark")
     };
     region.Properties[typeof(Control)] = base.Component;
     regions.Add(region);
     return string.Format(CultureInfo.InvariantCulture, "<span {0}=0></span>", new object[] { DesignerRegion.DesignerRegionAttributeName });
 }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     IDesignerHost service = (IDesignerHost) this.GetService(typeof(IDesignerHost));
     if (!(service.RootComponent is MasterPage))
     {
         throw new InvalidOperationException(System.Design.SR.GetString("ContentPlaceHolder_Invalid_RootComponent"));
     }
     regions.Add(new EditableDesignerRegion(this, "Content"));
     return this.CreateDesignTimeHTML();
 }
コード例 #10
0
ファイル: ToolbarDesigner.cs プロジェクト: g992com/esb
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content", true);
            regions.Add(editableRegion);

            string content = String.Format("<div {0}='{1}'>{2}</div>",
                DesignerRegion.DesignerRegionAttributeName, 0, GetEditableDesignerRegionContent(editableRegion));

            return content;
        }
コード例 #11
0
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     EditableDesignerRegion region = new EditableDesignerRegion(this, "Content");
     regions.Add(region);
     Font captionFont = SystemFonts.CaptionFont;
     Color controlText = SystemColors.ControlText;
     Color control = SystemColors.Control;
     string str = base.Component.GetType().Name + " - " + base.Component.Site.Name;
     return string.Format(CultureInfo.InvariantCulture, "<table cellspacing=0 cellpadding=0 style=\"border:1px solid black; width:100%; height:200px\">\r\n            <tr>\r\n              <td style=\"width:100%; height:25px; font-family:Tahoma; font-size:{2}pt; color:{3}; background-color:{4}; padding:5px; border-bottom:1px solid black;\">\r\n                &nbsp;{0}\r\n              </td>\r\n            </tr>\r\n            <tr>\r\n              <td style=\"width:100%; height:175px; vertical-align:top;\" {1}=\"0\">\r\n              </td>\r\n            </tr>\r\n          </table>", new object[] { str, DesignerRegion.DesignerRegionAttributeName, captionFont.SizeInPoints, ColorTranslator.ToHtml(controlText), ColorTranslator.ToHtml(control) });
 }
コード例 #12
0
ファイル: TabViewDesigner.cs プロジェクト: Confirmit/Portal
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            Table tabViewTable = (Table)tabView.Controls[0];
              int i = 0, designerRegionIndex = 0;
              string designTimeHtml = "";

              if (tabViewTable.Rows.Count > 0)
              {
            Table headerTable = (Table)tabViewTable.Rows[0].Cells[0].Controls[0];
            for (i = 0; i < headerTable.Rows[0].Cells.Count; i++)
            {
              regions.Add(new DesignerRegion(this, "Header" + designerRegionIndex.ToString()));
              ++designerRegionIndex;
            }

            Table contentTable = (Table)tabViewTable.Rows[1].Cells[0].Controls[0];
            //for (i = 1; i < /*2*/tabView.Tabs.Count; i++)
            //for (i = 0; i < /*2*/tabView.Tabs.Count; i++)
            {
              EditableDesignerRegion editableRegion =
            new EditableDesignerRegion(this,
                "Content" + tabView.CurrentTabIndex, false);
              ++designerRegionIndex;
              editableRegion.UserData = i;
              regions.Add(editableRegion);
            }

            //Set the highlight for the selected region
            if (tabView.Tabs.Count > 0)
              regions[tabView.CurrentTabIndex].Highlight = true;

            designTimeHtml = base.GetDesignTimeHtml(regions);
              }
              else designTimeHtml = GetDesignTimeHtml();

              return designTimeHtml;
        }
コード例 #13
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            Control component = (Control)base.Component;

            component.Controls.Clear();
            EditableDesignerRegion region = new EditableDesignerRegion(this, "Content")
            {
                Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
            };

            region.Properties[typeof(Control)] = component;
            region.EnsureSize = true;
            regions.Add(region);
            return(this.GenerateDesignTimeHtml());
        }
コード例 #14
0
ファイル: WindowDesigner.cs プロジェクト: g992com/esb
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content", true);
            regions.Add(editableRegion);

            string title = CurrentControl.Title;
            if (String.IsNullOrEmpty(title))
            {
                title = String.Format("[{0}]", CurrentControl.ID);
            }
            string content = String.Format("<div {0}='{1}'>{2}</div>",
                DesignerRegion.DesignerRegionAttributeName, 0, GetEditableDesignerRegionContent(editableRegion));

            return String.Format(PANEL_TEMPLATE, title, content);
        }
コード例 #15
0
ファイル: FieldSetDesigner.cs プロジェクト: pgodwin/Ext.net
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            EditableDesignerRegion region = new EditableDesignerRegion(this, "Body", false);
            regions.Add(region);

            StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            FieldSet c = (FieldSet)this.Control;

            string width = " width: {0};".FormatWith(c.Width.ToString());
            string height = " height: {0}px;".FormatWith((c.Height.Value - 39).ToString());

            string buttons = "";
            buttons += (c.CheckboxToggle && !c.Collapsible) ? "<input name=\"ext-comp-1002-checkbox\" type=\"checkbox\">" : "";
            buttons += (c.Collapsible && !c.CheckboxToggle) ? "<div class=\"x-tool x-tool-toggle\">&nbsp;</div>" : "";
            
            /*
             * 0 - ClientID
             * 1 - Title
             * 2 - Width
             * 3 - Height
             * 4 - Buttons
             * 5 - BodyStyle
             */

            object[] args = new object[6];
            args[0] = c.ClientID;
            args[1] = c.Title;
            args[2] = width;
            args[3] = height;
            args[4] = buttons;
            args[5] = c.BodyStyle;

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args));
            topCtrl.RenderControl(htmlWriter);

            HtmlGenericControl div = (HtmlGenericControl)c.ContentContainer;
            div.Attributes[DesignerRegion.DesignerRegionAttributeName] = "0";
            div.InnerHtml = this.GetEditableDesignerRegionContent(region);
            div.RenderControl(htmlWriter);

            LiteralControl bottomCtrl = new LiteralControl(this.HtmlEnd);
            bottomCtrl.RenderControl(htmlWriter);

            return writer.ToString();
        }
コード例 #16
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            //// Width and Height
            //string sizeStyle = String.Empty;
            //if (CurrentControl.Width != Unit.Empty)
            //{
            //    sizeStyle += String.Format("width:{0}px;", CurrentControl.Width);
            //}
            //if (CurrentControl.Height != Unit.Empty)
            //{
            //    sizeStyle += String.Format("height:{0}px;", CurrentControl.Height);
            //}

            // Title
            string title = CurrentControl.Title;
            if (String.IsNullOrEmpty(title))
            {
                title = String.Format("[{0}]", CurrentControl.ID);
            }

            // Items
            EditableDesignerRegion itemsRegion = new EditableDesignerRegion(this, "Items", true);
            regions.Add(itemsRegion);

            string itemsContent = String.Format("<div style=\"border:solid 1px #ccc;font-size:11px;background-color:#ddd;\">Items</div><div style=\"padding:2px;\" {0}=\"{1}\"></div>",
                DesignerRegion.DesignerRegionAttributeName, "0"); //GetEditableDesignerRegionContent(itemsRegion));

            // Toolbars
            string toolbarsContent = "";
            if (CurrentControl.Toolbars.Count > 0)
            {
                EditableDesignerRegion toolbarsRegion = new EditableDesignerRegion(this, "Toolbars", true);
                regions.Add(toolbarsRegion);

                toolbarsContent = String.Format("<div style=\"border:solid 1px #ccc;font-size:11px;background-color:#ddd;\">Toolbars</div><div style=\"padding:2px;\" {0}=\"{1}\"></div>",
                    DesignerRegion.DesignerRegionAttributeName, "1");
            }

            return String.Format(PANEL_TEMPLATE, title, toolbarsContent + itemsContent);
        }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     string emptyDesignTimeHtml;
     try
     {
         CatalogZone viewControl = (CatalogZone) base.ViewControl;
         bool flag = base.UseRegions(regions, this._zone.ZoneTemplate, viewControl.ZoneTemplate);
         if ((viewControl.ZoneTemplate == null) && !flag)
         {
             emptyDesignTimeHtml = this.GetEmptyDesignTimeHtml();
         }
         else
         {
             ((ICompositeControlDesignerAccessor) viewControl).RecreateChildControls();
             if (flag)
             {
                 viewControl.Controls.Clear();
                 CatalogPartEditableDesignerRegion region = new CatalogPartEditableDesignerRegion(viewControl, base.TemplateDefinition);
                 region.Properties[typeof(Control)] = viewControl;
                 region.IsSingleInstanceTemplate = true;
                 region.Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark");
                 regions.Add(region);
             }
             emptyDesignTimeHtml = base.GetDesignTimeHtml();
         }
         if (base.ViewInBrowseMode && (viewControl.ID != "AutoFormatPreviewControl"))
         {
             emptyDesignTimeHtml = base.CreatePlaceHolderDesignTimeHtml();
         }
     }
     catch (Exception exception)
     {
         emptyDesignTimeHtml = this.GetErrorDesignTimeHtml(exception);
     }
     return emptyDesignTimeHtml;
 }
コード例 #18
0
ファイル: PanelDesigner.cs プロジェクト: pgodwin/Ext.net
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            designerRegions = regions;
            Panel c = (Panel)this.Control;
            
            StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            string width = " width: {0};".FormatWith((c.Width == Unit.Empty) ? "auto" : c.Width.ToString());
            string height = " height: {0};".FormatWith((c.Height == Unit.Empty) ? "auto" : (c.Height.Value - 27).ToString() + "px");
            
            string buttons = "";
            buttons += (c.Collapsible) ? "<a {0}><div class=\"x-tool x-tool-toggle\">&nbsp;</div></a>" : "";

            if (this.Layout.HasValue && this.Layout.Value != LayoutType.Border || !this.Layout.HasValue)
            {
                if (buttons.IsNotEmpty())
                {
                    buttons = string.Format(buttons, GetDesignerRegionAttribute(PanelClickAction.Toggle));
                }
                else
                {
                    // for prevent shifting regions
                    designerRegions.Add(new DesignerRegion(CurrentDesigner, "Empty", false));
                }
            }
            
            if (this.Layout.HasValue)
            {
                if (!Width.IsEmpty)
                {
                    width = " width: {0};".FormatWith((Width == Unit.Empty) ? "auto" : Width.ToString());
                }

                if (!Height.IsEmpty)
                {
                    if (Height.Type == UnitType.Pixel)
                    {
                        height = " height: {0}px;".FormatWith(Height.Value - 27);  
                    }
                    else
                    {
                        height = " height: {0};".FormatWith(Height);  
                    }
                }

                if (this.Layout.Value == LayoutType.Border)
                {
                    if (BorderRegion.Collapsible && BorderRegion.Region != RegionPosition.Center)
                    {
                        buttons = "<a {1}><div class=\"x-tool x-tool-toggle x-tool-collapse-{0}\">&nbsp;</div></a>".FormatWith(BorderRegion.Region.ToString().ToLower(), GetDesignerRegionAttribute(BorderRegion.Region, BorderLayoutDesigner.BorderLayoutClickAction.Collapse));
                    }
                    else
                    {
                        // for prevent shifting regions
                        designerRegions.Add(new DesignerRegion(CurrentDesigner, "Empty", false));
                        buttons = "";
                    }
                }
            }

            string iconCls = "";

            this.AddIcon(c.Icon);

            if (c.IconClsProxy.IsNotEmpty())
            {
                if (c.Frame)
                {
                    iconCls = "x-panel-icon " + c.IconClsProxy;
                }
                else
                {
                    iconCls = "<img src=\"{0}\" class=\"x-panel-inline-icon {1}\" />".FormatWith(c.ResourceManager.BLANK_IMAGE_URL, c.IconClsProxy);
                }
            }

            string header = "";

            if (c.Header)
            {
                /*
                 * 0  - x-panel-header-noborder
                 * 1  - IconCls
                 * 2  - Title
                 * 3  - Buttons
                 */

                object[] headerArgs = new object[4];
                headerArgs[0] = !c.Border ? "x-panel-header-noborder" : "";
                headerArgs[1] = iconCls;
                headerArgs[2] = c.Title;
                headerArgs[3] = buttons;

                header = string.Format(this.HtmlHeader, headerArgs);
            }

            /*
             0  - Width
             1  - x-panel-noborder
             2  - Collapsed style
             3  - Collapsed  display: block;
             4  - BodyStyle
             5  - Height
             6  - x-panel-body-noborder
             7  - HEADER 
             */

            object[] args = new object[8];
            args[0] = width;
            args[1] = !c.Border ? "x-panel-noborder" : "";
            args[2] = c.Collapsed && c.Collapsible ? "x-panel-collapsed" : "";
            args[3] = (c.Collapsed) ? "display: none;" : "display: block;";
            args[4] = c.BodyStyle;
            args[5] = height;
            args[6] = !c.Border ? "x-panel-body-noborder" : "";
            args[7] = header;

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args) + this.GetIconStyleBlock());
            topCtrl.RenderControl(htmlWriter);

            HtmlGenericControl div = (HtmlGenericControl)c.ContentContainer;
            EditableDesignerRegion region = new EditableDesignerRegion(CurrentDesigner, ContentRegionName, false);
            designerRegions.Add(region);

            if ((!c.Collapsible) || (c.Collapsible && !c.Collapsed) || (this.Layout.HasValue && this.Layout.Value == LayoutType.Border))
            {
                div.Attributes[DesignerRegion.DesignerRegionAttributeName] = (designerRegions.Count - 1).ToString();
                div.Style["height"] = "100%";
                div.Style["overflow"] = "hidden";
                div.RenderControl(htmlWriter);
            }
            
            LiteralControl bottomCtrl = new LiteralControl(this.HtmlEnd);
            bottomCtrl.RenderControl(htmlWriter);

            return writer.ToString();
        }
コード例 #19
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            string content = String.Empty;
            regions.Add(BuildRegion());
            
            StringBuilder sb = new StringBuilder(1024);
            if (CurrentTemplate == null)
            {
                sb.Append(String.Format(CultureInfo.InvariantCulture,
                                        _designtimeHTML,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.Control),
                                        ReorderList.ID,
                                        DesignerRegion.DesignerRegionAttributeName,
                                        content));
            }
            else
            {

                DataList dl = new DataList();

                sb.Append(String.Format(CultureInfo.InvariantCulture,
                                        _designtimeHTML_Template,
                                        CurrentViewName,
                                        dl.HeaderStyle,
                                        ReorderList.ControlStyle,
                                        DesignerRegion.DesignerRegionAttributeName,
                                        content,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.Control),                                        
                                        ReorderList.ID,
                                        ReorderList.GetType().Name));

                dl.Dispose();
            }


            return sb.ToString();
        }
コード例 #20
0
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     string designTimeHtml = this.GetDesignTimeHtml();
     GridView viewControl = (GridView) base.ViewControl;
     int count = viewControl.Columns.Count;
     GridViewRow headerRow = viewControl.HeaderRow;
     GridViewRow footerRow = viewControl.FooterRow;
     int selectedFieldIndex = this.SelectedFieldIndex;
     if (headerRow != null)
     {
         for (int j = 0; j < count; j++)
         {
             string name = System.Design.SR.GetString("GridView_Field", new object[] { j.ToString(NumberFormatInfo.InvariantInfo) });
             string headerText = viewControl.Columns[j].HeaderText;
             if (headerText.Length == 0)
             {
                 name = name + " - " + headerText;
             }
             DesignerRegion region = new DesignerRegion(this, name, true) {
                 UserData = j
             };
             if (j == selectedFieldIndex)
             {
                 region.Highlight = true;
             }
             regions.Add(region);
         }
     }
     for (int i = 0; i < viewControl.Rows.Count; i++)
     {
         GridViewRow row1 = viewControl.Rows[i];
         for (int k = 0; k < count; k++)
         {
             DesignerRegion region2 = new DesignerRegion(this, k.ToString(NumberFormatInfo.InvariantInfo), false) {
                 UserData = -1
             };
             if (k == selectedFieldIndex)
             {
                 region2.Highlight = true;
             }
             regions.Add(region2);
         }
     }
     if (footerRow != null)
     {
         for (int m = 0; m < count; m++)
         {
             DesignerRegion region3 = new DesignerRegion(this, m.ToString(NumberFormatInfo.InvariantInfo), false) {
                 UserData = -1
             };
             if (m == selectedFieldIndex)
             {
                 region3.Highlight = true;
             }
             regions.Add(region3);
         }
     }
     return designTimeHtml;
 }
コード例 #21
0
ファイル: WindowDesigner.cs プロジェクト: pgodwin/Ext.net
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            Window c = (Window)this.Control;
            designerRegions = regions;

            EditableDesignerRegion region = new EditableDesignerRegion(this, "Body", false);
            regions.Add(region);

            StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            string width = " width: {0};".FormatWith(c.Width.ToString());
            string height = " height: {0}px;".FormatWith((c.Height.Value - 30).ToString());

            string buttons = "";
            buttons += (c.Closable) ? "<div class=\"x-tool x-tool-close\">&nbsp;</div>" : "";
            buttons += (c.Maximizable) ? "<div class=\"x-tool x-tool-maximize\">&nbsp;</div>" : "";
            buttons += (c.Minimizable) ? "<div class=\"x-tool x-tool-minimize\">&nbsp;</div>" : "";
            buttons += (c.Collapsible) ? "<a {0}><div class=\"x-tool x-tool-toggle\">&nbsp;</div></a>" : "";


            if (c.Collapsible)
            {
                buttons = string.Format(buttons, GetDesignerRegionAttribute(WindowClickAction.Toggle));
            }
            else
            {
                // for prevent shifting regions
                designerRegions.Add(new DesignerRegion(this.CurrentDesigner, "Empty", false));
            }

            /*
             * 0 - ClientID
             * 1 - Title
             * 2 - Width
             * 3 - Height
             * 4 - Buttons
             * 5 - BodyStyle
             */

            object[] args = new object[9];
            args[0] = c.ClientID;
            args[1] = c.Title.IsEmpty() ? "&nbsp;" : c.Title;
            args[2] = width;
            args[3] = height;
            args[4] = buttons;
            args[5] = c.BodyStyle;
            args[6] = c.IconClsProxy.IsNotEmpty() ? "x-panel-icon " + c.IconClsProxy : "";
            args[7] = c.Collapsed && c.Collapsible ? "x-panel-collapsed" : "";
            args[8] = (c.Collapsed && c.Collapsible) ? "display: none;" : "display: block;";

            // NOTE: Make sure you add to the object[SIZE] above if adding to the args array.

            this.AddIcon(c.Icon);

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args) + this.GetIconStyleBlock());
  
            topCtrl.RenderControl(htmlWriter);

            if (!(c.Collapsed && c.Collapsible))
            {
                HtmlGenericControl div = (HtmlGenericControl)c.ContentContainer;
                div.Attributes[DesignerRegion.DesignerRegionAttributeName] = "0";
                div.Style["height"] = "100%";
                div.RenderControl(htmlWriter);
            }


            LiteralControl bottomCtrl = new LiteralControl(string.Format(this.HtmlEnd, args[8]));
            
            bottomCtrl.RenderControl(htmlWriter);

            string temp = writer.ToString();

            return temp;
        }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     string designTimeHtml = string.Empty;
     if (base.UseRegions(regions, this.CurrentTemplate, this.CurrentViewControlTemplate))
     {
         regions.Add(this.BuildRegion());
     }
     else
     {
         designTimeHtml = this.GetDesignTimeHtml();
     }
     StringBuilder builder = new StringBuilder(0x400);
     builder.Append(string.Format(CultureInfo.InvariantCulture, "<table cellspacing=0 cellpadding=0 border=0 style=\"display:inline-block\">\r\n                <tr>\r\n                    <td nowrap align=center valign=middle style=\"color:{0}; background-color:{1}; \">{2}</td>\r\n                </tr>\r\n                <tr>\r\n                    <td style=\"vertical-align:top;\" {3}='0'>{4}</td>\r\n                </tr>\r\n          </table>", new object[] { ColorTranslator.ToHtml(SystemColors.ControlText), ColorTranslator.ToHtml(SystemColors.Control), this._loginView.ID, DesignerRegion.DesignerRegionAttributeName, designTimeHtml }));
     return builder.ToString();
 }
コード例 #23
0
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     string designTimeHtml = this.GetDesignTimeHtml();
     DetailsView viewControl = (DetailsView) base.ViewControl;
     int count = viewControl.Rows.Count;
     int selectedFieldIndex = this.SelectedFieldIndex;
     DetailsViewRowCollection rows = viewControl.Rows;
     for (int i = 0; i < viewControl.Fields.Count; i++)
     {
         string name = System.Design.SR.GetString("DetailsView_Field", new object[] { i.ToString(NumberFormatInfo.InvariantInfo) });
         string headerText = viewControl.Fields[i].HeaderText;
         if (headerText.Length == 0)
         {
             name = name + " - " + headerText;
         }
         if (i < count)
         {
             DetailsViewRow row = rows[i];
             for (int j = 0; j < row.Cells.Count; j++)
             {
                 TableCell cell1 = row.Cells[j];
                 if (j == 0)
                 {
                     DesignerRegion region = new DesignerRegion(this, name, true) {
                         UserData = i
                     };
                     if (i == selectedFieldIndex)
                     {
                         region.Highlight = true;
                     }
                     regions.Add(region);
                 }
                 else
                 {
                     DesignerRegion region2 = new DesignerRegion(this, i.ToString(NumberFormatInfo.InvariantInfo), false) {
                         UserData = -1
                     };
                     if (i == selectedFieldIndex)
                     {
                         region2.Highlight = true;
                     }
                     regions.Add(region2);
                 }
             }
         }
     }
     return designTimeHtml;
 }
コード例 #24
0
ファイル: FormDesigner.cs プロジェクト: g992com/esb
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            StringBuilder sb = new StringBuilder();

            int rowIndex = 0;
            foreach (FormRow row in CurrentControl.Rows)
            {
                #region oldcode
                //bool showInnerTable = row.Fields.Count > 1 ? true : false;
                //if (showInnerTable)
                //{
                //    sb.Append("<table cellpadding='0' cellspacing='2' border='0' width='100%'><tbody><tr>");
                //}

                //int columnIndex = 0;
                //foreach (Field field in row.Fields)
                //{
                //if (showInnerTable)
                //{
                //    sb.Append("<td>");
                //} 
                #endregion

                string regionName = String.Format("{0}_{1}", EDITOR_REGION_PREFIX, rowIndex);
                EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, regionName, false);
                editableRegion.Properties["RowIndex"] = rowIndex;
                regions.Add(editableRegion);

                sb.AppendFormat("<div style='margin:2px;' {0}='{1}'>{2}</div>",
                    DesignerRegion.DesignerRegionAttributeName, rowIndex, GetEditableDesignerRegionContent(editableRegion));

                rowIndex++;
            }


            string title = CurrentControl.Title;
            if (String.IsNullOrEmpty(title))
            {
                title = String.Format("[{0}]", CurrentControl.ID);
            }

            string content = String.Format(PANEL_TEMPLATE, title, sb.ToString());


            return content;
        }
コード例 #25
0
ファイル: Listing26-43.cs プロジェクト: netatomy/LearningNet
        protected virtual void BuildRegions(DesignerRegionCollection regions)
        {
            regions.Add(new DesignerRegion(this, "Header0"));
            regions.Add(new DesignerRegion(this, "Header1"));

            // If the current view is for all, we need another editable region
            EditableDesignerRegion edr0 = new
                EditableDesignerRegion(this, "Content" + _currentView, false);
            edr0.Description = "Add stuff in here if you dare:";
            regions.Add(edr0);

            // Set the highlight, depending upon the selected region
            if (_currentView == 0 || _currentView == 1)
                regions[_currentView].Highlight = true;
        }
コード例 #26
0
ファイル: TabStripDesigner.cs プロジェクト: g992com/esb
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            if (CurrentControl.Tabs.Count == 0)
            {
                return GetEmptyDesignTimeHtml();
            }


            // 1. Add tabs title list
            StringBuilder sb = new StringBuilder();
            int tabIndex = 0;
            foreach (Tab tab in CurrentControl.Tabs)
            {
                HtmlNodeBuilder nb = new HtmlNodeBuilder("div");

                if (!String.IsNullOrEmpty(tab.Title))
                {
                    nb.InnerProperty = tab.Title;
                }
                else
                {
                    nb.InnerProperty = String.Format("[{0}]", tab.ID);
                }

                string styleStr = "padding:0 5px;margin-right:5px;display:inline;";
                if (CurrentControl.ActiveTabIndex == tabIndex)
                {
                    styleStr += "background-color:#666;";
                }
                nb.SetProperty("style", styleStr);

                nb.SetProperty(DesignerRegion.DesignerRegionAttributeName, tabIndex.ToString());

                DesignerRegion region = new DesignerRegion(this, "Tab_" + tabIndex, true);
                region.Properties["TabIndex"] = tabIndex.ToString();
                regions.Add(region);

                sb.Append(nb.ToString());
                tabIndex++;
            }
            string tabsHtml = sb.ToString();


            // 2. Add current active tab content
            // Note: Currently, we have add (CurrentControl.Tabs.Count - 1) items into regions,
            // So This editable region's index is CurrentControl.Tabs.Count.
            EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content", true);
            regions.Add(editableRegion);
            //editableRegion.Properties["ActiveTabIndex"] = CurrentControl.ActiveTabIndex.ToString();

            string contentHtml = String.Format("<div {0}='{1}'>{2}</div>",
                 DesignerRegion.DesignerRegionAttributeName, CurrentControl.Tabs.Count, GetEditableDesignerRegionContent(editableRegion));

            return String.Format(PANEL_TEMPLATE, tabsHtml, contentHtml);
        }
コード例 #27
0
ファイル: Designer.cs プロジェクト: trankimhieu/eCommerce-MVC
        protected virtual void BuildRegions(DesignerRegionCollection regions)
        {
            EditableDesignerRegion edr0 = new EditableDesignerRegion(this, "Content", false);
            regions.Add(edr0);

            regions[0].Highlight = true;
        }
コード例 #28
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            if (regions == null)
            {
                throw new ArgumentNullException("regions");
            }

            if (TabContainer.ActiveTab != null)
            {
                // create the main editable region
                //
                EditableDesignerRegion region = new EditableDesignerRegion(this, String.Format(CultureInfo.InvariantCulture, "c{0}", TabContainer.ActiveTab.ID));
                
                regions.Add(region);

                // build out the content HTML.  We'll need this later.
                //
                string contentHtml = GetTabContent(TabContainer.ActiveTab, true);               

                StringBuilder clickRegions = new StringBuilder();

                // now build out the design time tab UI.
                //
                // we do this by looping through the tabs and either building a link for clicking, and a plain DesignerRegion, or,
                // we build a plain span an attach an EditableDesigner region to it.

                int count = 2; // start with two since we've already got two regions. these numbers need to correspond to the order in the regions collection
                foreach (TabPanel tp in TabContainer.Tabs)
                {
                    bool isActive = tp.Active;

                    string headerText = GetTabContent(tp, false);

                    // Build out the HTML for one of the tabs.  No, I don't usually write code like this, but this is just kind
                    // of icky no matter how you do it.  Nothing to see here.
                    //
                    clickRegions.AppendFormat(CultureInfo.InvariantCulture, ClickRegionHtml, 
                        DesignerRegion.DesignerRegionAttributeName, 
                        (isActive ? 1 : count), // if it's the editable one, it has to be index 1, see below
                        String.Format(CultureInfo.InvariantCulture, isActive ? ActiveTabLink : TabLink, headerText),
                        ColorTranslator.ToHtml(SystemColors.ControlText),
                        (isActive ? ColorTranslator.ToHtml(SystemColors.Window) : "transparent"),
                        (isActive ? "border-top:thin white outset;border-left:thin white outset;border-right:thin white outset;" : "")
                      );


                    // the region names are arbitrary.  for this purpose, we encode them by a letter - h or t for header or tab, respectively,
                    // and then pop on the tab ID.
                    //
                    if (isActive) {
                        // the editable header region is always to be 1, so we insert it there.
                        //
                        regions.Insert(1, new EditableDesignerRegion(this, String.Format(CultureInfo.InvariantCulture, "h{0}", tp.ID)));
                    }
                    else {
                        // otherwise, just create a plain region.
                        //
                        DesignerRegion clickRegion = new DesignerRegion(this, String.Format(CultureInfo.InvariantCulture, "t{0}", tp.ID));
                        clickRegion.Selectable = true;
                        count++;
                        regions.Add(clickRegion);
                    }
                }


                // OK build out the final full HTML for this control.
                //
                StringBuilder sb = new StringBuilder(1024);
                sb.Append(String.Format(CultureInfo.InvariantCulture,
                                        DesignTimeHtml,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.ControlDark),
                                        TabContainer.ID,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.Control),
                                        clickRegions.ToString(),
                                        contentHtml,
                                        TabContainer.Width,
                                        TabContainer.Height,
                                        DesignerRegion.DesignerRegionAttributeName,
                                        ColorTranslator.ToHtml(SystemColors.Window)
                                        ));
                return sb.ToString();                
            }
            else
            {
                // build the empty tab html.

                StringBuilder sb = new StringBuilder(512);

                sb.AppendFormat(CultureInfo.InvariantCulture, EmptyDesignTimeHtml,
                                        ColorTranslator.ToHtml(SystemColors.ControlText),
                                        ColorTranslator.ToHtml(SystemColors.ControlDark),
                                        TabContainer.ID,
                                        DesignerRegion.DesignerRegionAttributeName);

                // add a designer region for the "AddTab" UI.
                //
                DesignerRegion dr = new DesignerRegion(this, AddTabName);
                regions.Add(dr);
                return sb.ToString();                                        
            }
        }
 protected override void AddDesignerRegions(DesignerRegionCollection regions)
 {
     if (base.SupportsDesignerRegions)
     {
         if (this._createUserWizard.CreateUserStep == null)
         {
             this.CreateChildControls();
             if (this._createUserWizard.CreateUserStep == null)
             {
                 return;
             }
         }
         bool flag = this._createUserWizard.CreateUserStep.ContentTemplate == null;
         bool flag2 = this._createUserWizard.CompleteStep.ContentTemplate == null;
         foreach (WizardStepBase base2 in this._createUserWizard.WizardSteps)
         {
             bool flag3 = (flag && (base2 is CreateUserWizardStep)) || (flag2 && (base2 is CompleteWizardStep));
             DesignerRegion region = null;
             if (!flag3)
             {
                 if (base2 is TemplatedWizardStep)
                 {
                     TemplateDefinition templateDefinition = new TemplateDefinition(this, "ContentTemplate", this._createUserWizard, "ContentTemplate", base.TemplateStyleArray[5]);
                     region = new WizardStepTemplatedEditableRegion(templateDefinition, base2) {
                         EnsureSize = false
                     };
                 }
                 else
                 {
                     region = new WizardStepEditableRegion(this, base2);
                 }
                 region.Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark");
             }
             else
             {
                 region = new WizardSelectableRegion(this, base.GetRegionName(base2), base2);
             }
             regions.Add(region);
         }
         foreach (WizardStepBase base3 in this._createUserWizard.WizardSteps)
         {
             WizardSelectableRegion region2 = new WizardSelectableRegion(this, "Move to " + base.GetRegionName(base3), base3);
             if (this._createUserWizard.ActiveStep == base3)
             {
                 region2.Selected = true;
             }
             regions.Add(region2);
         }
     }
 }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     Control component = (Control) base.Component;
     component.Controls.Clear();
     EditableDesignerRegion region = new EditableDesignerRegion(this, "Content") {
         Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
     };
     region.Properties[typeof(Control)] = component;
     region.EnsureSize = true;
     regions.Add(region);
     return this.GenerateDesignTimeHtml();
 }
コード例 #31
0
ファイル: AccordionDesigner.cs プロジェクト: pgodwin/Ext.net
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            StringBuilder sb = new StringBuilder(256);
            designerRegions = regions;

            EditableDesignerRegion editableDesignerRegion = new EditableDesignerRegion(CurrentDesigner, "Body_" + this.layout.ExpandedPanelIndex);
            designerRegions.Add(editableDesignerRegion);

            sb.AppendFormat("<div style='width:100%;height:100%;margins:0px;padding-addToStart:0px;padding-right:0px;padding-left:0px;padding-bottom:{0}px;'>",23*this.layout.Items.Count);

            bool wasExpaned = false;
            
            for (int i = 0; i < this.layout.Items.Count; i++)
            {
                PanelBase item = this.layout.Items[i] as PanelBase;

                this.AddIcon(item.Icon);

                sb.Append("<div class='x-panel ");

                if (!item.Border)
                {
                    sb.Append("x-panel-noborder ");
                }

                if (item.Collapsed || wasExpaned)
                {
                    SetCollapsed(item, true);
                    sb.Append("x-panel-collapsed");
                }
                else
                {
                    wasExpaned = true;
                }

                sb.Append("' style='width:auto;'>");

                sb.AppendFormat("<a href='#' {0}><div class='x-panel-header ", GetDesignerRegionAttribute(i));

                if (!item.Border)
                {
                    sb.Append("x-panel-header-noborder ");
                }

                sb.Append("x-accordion-hd'>");

                sb.Append("<div class='x-tool x-tool-toggle'></div>");

                string iconCls = item.IconCls;

                if (iconCls.IsNotEmpty())
                {
                    string s =
                        this.GetWebResourceUrl(
                            "Ext.Net.Build.Ext.Net.extjs.resources.images.default.s.gif");
                    sb.AppendFormat("<img class='x-panel-inline-icon {0}'src='{1}'/>", iconCls, s);
                }

                sb.AppendFormat("<span class='x-panel-header-text' style='text-decoration:none;'>{0}</span>", item.Title.IsEmpty() ? "&nbsp;" : item.Title);

                sb.Append("</div></a>");

                if (!item.Collapsed)
                {
                    sb.AppendFormat(@"<div class='x-panel-bwrap' style='DISPLAY: block; LEFT: auto; VISIBILITY: visible; POSITION: static; TOP: auto'>
                                    <div class='x-panel-body {0}' style='width:auto;height:100%;padding:0px;margins:0px;' {1}></div>
                                    </div>", item.Border ? "" : "x-panel-body-noborder", GetEditableDesignerRegionAttribute());
                }

                sb.Append("</div>");
            }

            sb.Append("</div>");

            return sb.ToString() + this.GetIconStyleBlock();
        }