Inheritance: PanelBaseDesigner
Exemple #1
0
        private Control BuildRegion(BorderLayoutRegion region, Unit width, Unit height)
        {
            if (!this.SchemeMode && region.Items.Count > 0)
            {
                Component item = region.Items[0];

                if (ReflectionUtils.IsTypeOf(item, typeof(PanelBase), false))
                {
                    this.AddIcon(((PanelBase)item).Icon);
                }


                PanelBaseDesigner designer;

                if (ReflectionUtils.IsTypeOf(item, typeof(Panel), false))
                {
                    designer = new PanelDesigner();
                }
                else if (ReflectionUtils.IsTypeOf(item, typeof(TabPanel), false))
                {
                    designer = new TabPanelDesigner();
                }
                else
                {
                    return(BuildStub(region, height, width, true));
                }

                designer.Width = width;

                if (region == this.layout.North || region == this.layout.South)
                {
                    designer.Height = height;
                }
                designer.Layout       = LayoutType.Border;
                designer.BorderRegion = region;

                designer.CurrentDesigner = this.CurrentDesigner;
                designer.Initialize(item);

                return(new LiteralControl(designer.GetDesignTimeHtml(this.designerRegions)));
            }
            else
            {
                return(BuildStub(region, height, width, false));
            }
        }
        private Control BuildRegion(BorderLayoutRegion region, Unit width, Unit height)
        {
            if (!this.SchemeMode && region.Items.Count > 0)
            {
                Component item = region.Items[0];

                if (ReflectionUtils.IsTypeOf(item, typeof(PanelBase), false))
                {
                    this.AddIcon(((PanelBase)item).Icon); 
                }
                
                
                PanelBaseDesigner designer;

                if (ReflectionUtils.IsTypeOf(item, typeof(Panel), false))
                {
                    designer = new PanelDesigner();
                }
                else if (ReflectionUtils.IsTypeOf(item, typeof(TabPanel), false))
                {
                    designer = new TabPanelDesigner();
                }
                else
                {
                    return BuildStub(region, height, width, true);
                }

                designer.Width = width;

                if (region == this.layout.North || region == this.layout.South)
                {
                    designer.Height = height;
                }
                designer.Layout = LayoutType.Border;
                designer.BorderRegion = region;

                designer.CurrentDesigner = this.CurrentDesigner;
                designer.Initialize(item);

                return new LiteralControl(designer.GetDesignTimeHtml(this.designerRegions));
            }
            else
            {
                return BuildStub(region, height, width, false);
            }
        }
Exemple #3
0
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
            this.htmlWriter = new HtmlTextWriter(writer);

            designerRegions = regions;

            StringBuilder sb = new StringBuilder(256);

            if (this.fitLayout.Items.Count == 0)
            {
                sb.Append(begin);

                object[] prms = new object[]
                    {
                        this.GetWebResourceUrl("Ext.Net.Build.Ext.Net.icons.add.png"),
                        this.GetDesignerRegionAttribute(FitLayoutClickAction.AddPanel),
                        this.GetDesignerRegionAttribute(FitLayoutClickAction.AddTabPanel)
                    };

                sb.AppendFormat(content, prms);
                sb.Append(end);
            }
            else
            {
                PanelBase item = this.fitLayout.Items[0] as PanelBase;
                PanelBaseDesigner designer;

                if (ReflectionUtils.IsTypeOf(item, typeof(Panel), false))
                {
                    designer = new PanelDesigner();
                }
                else if (ReflectionUtils.IsTypeOf(item, typeof(TabPanel), false))
                {
                    designer = new TabPanelDesigner();
                }
                else
                {
                    return unsupported;
                }

                designer.Width = Unit.Percentage(100);

                designer.Layout = LayoutType.Fit;

                designer.CurrentDesigner = CurrentDesigner;
                designer.Initialize(item);

                int addBottomMargins = 27;// +(this.fitLayout.Items[0] is TabPanel ? 2 : 0);

                if (item.Collapsible && item.Collapsed && item is Panel)
                {
                    addBottomMargins = 0;
                }

                sb.AppendFormat("<div style='width:100%;height:auto;margins:0;padding-bottom:{0}px;'>",
                                addBottomMargins);
                sb.AppendFormat(designer.GetDesignTimeHtml(designerRegions));
                sb.Append(this.GetIconStyleBlock() + "</div>");
            }

            return sb.ToString();
        }
Exemple #4
0
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);

            this.htmlWriter = new HtmlTextWriter(writer);

            designerRegions = regions;

            StringBuilder sb = new StringBuilder(256);

            if (this.fitLayout.Items.Count == 0)
            {
                sb.Append(begin);

                object[] prms = new object[]
                {
                    this.GetWebResourceUrl("Ext.Net.Build.Ext.Net.icons.add.png"),
                    this.GetDesignerRegionAttribute(FitLayoutClickAction.AddPanel),
                    this.GetDesignerRegionAttribute(FitLayoutClickAction.AddTabPanel)
                };

                sb.AppendFormat(content, prms);
                sb.Append(end);
            }
            else
            {
                PanelBase         item = this.fitLayout.Items[0] as PanelBase;
                PanelBaseDesigner designer;

                if (ReflectionUtils.IsTypeOf(item, typeof(Panel), false))
                {
                    designer = new PanelDesigner();
                }
                else if (ReflectionUtils.IsTypeOf(item, typeof(TabPanel), false))
                {
                    designer = new TabPanelDesigner();
                }
                else
                {
                    return(unsupported);
                }

                designer.Width = Unit.Percentage(100);

                designer.Layout = LayoutType.Fit;

                designer.CurrentDesigner = CurrentDesigner;
                designer.Initialize(item);

                int addBottomMargins = 27;// +(this.fitLayout.Items[0] is TabPanel ? 2 : 0);

                if (item.Collapsible && item.Collapsed && item is Panel)
                {
                    addBottomMargins = 0;
                }

                sb.AppendFormat("<div style='width:100%;height:auto;margins:0;padding-bottom:{0}px;'>",
                                addBottomMargins);
                sb.AppendFormat(designer.GetDesignTimeHtml(designerRegions));
                sb.Append(this.GetIconStyleBlock() + "</div>");
            }

            return(sb.ToString());
        }