Exemplo n.º 1
0
        private string GetDesignerRegionAttribute(RegionPosition region, BorderLayoutDesigner.BorderLayoutClickAction action)
        {
            string name = string.Format("{0}_{1}", region, action);

            designerRegions.Add(new DesignerRegion(CurrentDesigner, name, false));
            return(string.Format("{0}=\"{1}\"", DesignerRegion.DesignerRegionAttributeName, designerRegions.Count - 1));
        }
Exemplo n.º 2
0
        private string GetEditableDesignerAttribute()
        {
            EditableDesignerRegion region = new EditableDesignerRegion(this, "Body", true);

            designerRegions.Add(region);
            return(string.Format("{0}=\"{1}\"", DesignerRegion.DesignerRegionAttributeName, designerRegions.Count - 1));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        /// <summary>
        /// GetDesignTimeHtml
        /// </summary>
        /// <param name="regions"></param>
        /// <returns></returns>
        /// <remarks>
        /// GetDesignTimeHtml
        /// </remarks>
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            this.CreateChildControls();

            for (int i = 0; i < this.nbRegions; i++)
            {
                DesignerRegion r;
                if (this.currentRegion == i)
                {
                    r = new EditableDesignerRegion(this, i.ToString());
                }
                else
                {
                    r = new DesignerRegion(this, i.ToString());
                }
                regions.Add(r);
            }

            if ((this.currentRegion >= 0) && (this.currentRegion < this.nbRegions))
            {
                regions[this.currentRegion].Highlight = true;
            }
            UpdateDesignTimeHtml();
            return(base.GetDesignTimeHtml(regions));
        }
Exemplo n.º 6
0
        protected virtual void BuildRegions(DesignerRegionCollection regions)
        {
            //regions.Add(new DesignerRegion(this, "Header0"));
            //regions.Add(new DesignerRegion(this, "Header1"));

            //int i = 0;
            //foreach (RibbonTab lTab in _ListTabs)
            //{

            //    i++;
            //}

            for (int i = 0; i < _ListTabs.Count; i++)
            {
                regions.Add(new DesignerRegion(this, "Tab_" + i.ToString()));
            }

            // If the current view is for all, we need another editable region
            //EditableDesignerRegion edr0 = new EditableDesignerRegion(this, "Content" + _currentView, false);
            //regions.Add(edr0);

            // Set the highlight, depending upon the selected region
            //if (_currentView == 0 || _currentView == 1 || _currentView == 2)
            regions[CurrentTab].Highlight = true;
        }
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            IDictionary data = new HybridDictionary(2);

            data["CurrentView"] = this.CurrentView;
            if (base.UseRegions(regions, this.GetTemplate(this._changePassword)))
            {
                ((WebControl)base.ViewControl).Enabled = true;
                data.Add("RegionEditing", true);
                EditableDesignerRegion region = new TemplatedEditableDesignerRegion(this.TemplateDefinition)
                {
                    Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
                };
                regions.Add(region);
            }
            try
            {
                ((IControlDesignerAccessor)base.ViewControl).SetDesignModeState(data);
                ((ICompositeControlDesignerAccessor)base.ViewControl).RecreateChildControls();
                return(base.GetDesignTimeHtml());
            }
            catch (Exception exception)
            {
                return(this.GetErrorDesignTimeHtml(exception));
            }
        }
Exemplo n.º 8
0
 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));
     }
 }
Exemplo n.º 9
0
        private string GetDesignerRegionAttribute(int index)
        {
            string name = string.Format("Toggle_{0}", index);

            designerRegions.Add(new DesignerRegion(this, name, false));
            return(string.Format("{0}=\"{1}\"", DesignerRegion.DesignerRegionAttributeName, designerRegions.Count - 1));
        }
Exemplo n.º 10
0
        protected virtual void BuildRegions(DesignerRegionCollection regions)
        {
            EditableDesignerRegion edr0 = new EditableDesignerRegion(this, "Content", false);

            regions.Add(edr0);

            regions[0].Highlight = true;
        }
Exemplo n.º 11
0
        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;
            }
        }
Exemplo n.º 12
0
        // Create the regions and design-time markup. Called by the designer host.
        public override String GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            // Create 3 regions: 2 clickable headers and an editable row
            regions.Add(new DesignerRegion(this, "Header0"));
            regions.Add(new DesignerRegion(this, "Header1"));

            // Create an editable region and add it to the regions
            EditableDesignerRegion editableRegion =
                new EditableDesignerRegion(this,
                                           "Content" + myControl.CurrentView, false);

            regions.Add(editableRegion);

            // Set the highlight for the selected region
            regions[myControl.CurrentView].Highlight = true;

            // Use the base class to render the markup
            return(base.GetDesignTimeHtml());
        }
Exemplo n.º 13
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)
        {
            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());
        }
Exemplo n.º 15
0
        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);
        }
        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)
        {
            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) }));
        }
Exemplo n.º 18
0
        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());
        }
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            // Create 3 regions: 2 clickable headers and an editable row

            // Create an editable region and add it to the regions
            EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "FirstPanel", false);

            editableRegion.Selectable = true;
            editableRegion.Highlight  = true;
            regions.Add(editableRegion);
            regions.Add(new DesignerRegion(this, "Divider"));
            editableRegion            = new EditableDesignerRegion(this, "SecondPanel", false);
            editableRegion.Selectable = true;
            editableRegion.Highlight  = true;
            regions.Add(editableRegion);

            // Set the highlight for the selected region

            /*
             * regions(myControl.CurrentView).Highlight = True
             */
            // Use the base class to render the markup
            return(GetDesignTimeHtml());
        }
 public override string GetDesignTimeHtml(DesignerRegionCollection regions)
 {
     if (base.UseRegions(regions, this._login.LayoutTemplate))
     {
         ((WebControl)base.ViewControl).Enabled = true;
         IDictionary data = new HybridDictionary(1);
         data.Add("RegionEditing", true);
         ((IControlDesignerAccessor)base.ViewControl).SetDesignModeState(data);
         EditableDesignerRegion region = new TemplatedEditableDesignerRegion(this.TemplateDefinition)
         {
             Description = System.Design.SR.GetString("ContainerControlDesigner_RegionWatermark")
         };
         regions.Add(region);
     }
     return(this.GetDesignTimeHtml());
 }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        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));
        }
        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());
        }
Exemplo n.º 24
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            regions.Add(BuildRegion());

            var builder = new StringBuilder(0x400);

            builder.Append("<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>".FormatWith(
                               new object[]
            {
                ColorTranslator.ToHtml(SystemColors.ControlText),
                ColorTranslator.ToHtml(SystemColors.Control),
                Microsoft.Security.Application.Encoder.HtmlEncode(_entityRightsView.ID ?? "EntityRightsView"),
                Microsoft.Security.Application.Encoder.HtmlAttributeEncode(DesignerRegion.DesignerRegionAttributeName),
                string.Empty
            }));

            return(builder.ToString());
        }
Exemplo n.º 25
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());
        }
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            string emptyDesignTimeHtml;

            try
            {
                EditorZone viewControl = (EditorZone)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 ((regions != null) && flag)
                    {
                        viewControl.Controls.Clear();
                        EditorPartEditableDesignerRegion region = new EditorPartEditableDesignerRegion(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);
        }
Exemplo n.º 27
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            designerRegions = regions;
            Panel c = (Panel)this.Control;

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

            string width  = string.Format(" width: {0};", (c.Width == Unit.Empty) ? "auto" : c.Width.ToString());
            string height = string.Format(" height: {0};", (c.Height == Unit.Empty) ? "auto" : (c.Height.Value - 27).ToString() + "px");

            string buttons = string.Empty;

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

            if (this.Layout.HasValue && this.Layout.Value != LayoutType.Border || !this.Layout.HasValue)
            {
                if (!string.IsNullOrEmpty(buttons))
                {
                    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 = string.Format(" width: {0};", (Width == Unit.Empty) ? "auto" : Width.ToString());
                }

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

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

            string iconCls = string.Empty;

            this.AddIcon(c.Icon);

            if (!string.IsNullOrEmpty(c.IconCls))
            {
                if (c.Frame)
                {
                    iconCls = "x-panel-icon " + c.IconCls;
                }
                else
                {
                    iconCls = string.Format("<img src=\"{0}\" class=\"x-panel-inline-icon {1}\" />", c.ScriptManager.BLANK_IMAGE_URL, c.IconCls);
                }
            }

            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" : string.Empty;
                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" : string.Empty;
            args[2] = c.Collapsed && c.Collapsible ? "x-panel-collapsed" : string.Empty;
            args[3] = (c.Collapsed) ? "display: none;" : "display: block;";
            args[4] = c.BodyStyle;
            args[5] = height;
            args[6] = !c.Border ? "x-panel-body-noborder" : string.Empty;
            args[7] = header;

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

            topCtrl.RenderControl(htmlWriter);

            HtmlGenericControl     div    = (HtmlGenericControl)c.BodyContainer;
            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());
        }
Exemplo n.º 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-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);
                var           actualHeight =
                    (!TabContainer.Height.IsEmpty && TabContainer.Height.Type == UnitType.Pixel)
                    ? (TabContainer.Height.Value - 62).ToString() + "px" :
                    "100%";

                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),
                                        actualHeight,
                                        HideOverflowContent ? "hidden" : "visible"
                                        ));
                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());
            }
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        public override string GetDesignTimeHtml(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 (!string.IsNullOrEmpty(iconCls))
                {
                    string s =
                        this.GetWebResourceUrl(
                            "Coolite.Ext.Web.Build.Resources.Coolite.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>", string.IsNullOrEmpty(item.Title) ? "&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());
        }