예제 #1
0
        private void InitializeItem(PanelBase item, BorderLayoutRegion region)
        {
            region.Split       = true;
            region.Collapsible = item is Panel;
            item.Title         = region.Region.ToString();
            switch (region.Region)
            {
            case RegionPosition.North:
            case RegionPosition.South:
                item.Height = Unit.Pixel(150);
                break;

            case RegionPosition.East:
            case RegionPosition.West:
                item.Width = Unit.Pixel(175);
                break;

            case RegionPosition.Center:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (item is TabPanel)
            {
                TabPanel tabPanel = item as TabPanel;

                Tab tab = new Tab();
                tab.Title = "Tab 1";
                tabPanel.Tabs.Add(tab);

                tab       = new Tab();
                tab.Title = "Tab 2";
                tabPanel.Tabs.Add(tab);

                tab       = new Tab();
                tab.Title = "Tab 3";
                tabPanel.Tabs.Add(tab);

                tabPanel.ActiveTabIndex = 0;

                region.Collapsible = false;
            }
        }
예제 #2
0
        public void RemovePanel()
        {
            int oldIndex = this.layout.ExpandedPanelIndex;

            if (this.layout.ExpandedPanelIndex > -1)
            {
                IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

                if (host != null)
                {
                    using (DesignerTransaction dt = host.CreateTransaction("Remove Panel"))
                    {
                        IComponentChangeService changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
                        PanelBase panel = this.layout.Items[oldIndex] as PanelBase;

                        try
                        {
                            changeService.OnComponentChanging(this.layout, TypeDescriptor.GetProperties(this.layout)["Items"]);
                            this.layout.Items.Remove(panel);

                            if (this.layout.Items.Count > 0)
                            {
                                PanelBase activeItem =
                                    this.layout.Items[Math.Min(oldIndex, this.layout.Items.Count - 1)] as PanelBase;

                                this.ExpandItem(activeItem);
                            }
                        }
                        finally
                        {
                            changeService.OnComponentChanged(this.layout, TypeDescriptor.GetProperties(this.layout)["Items"], null, null);
                        }

                        panel.Dispose();

                        this.UpdateDesignTimeHtml();
                        dt.Commit();
                    }
                    this.Tag.SetDirty(true);
                }
            }
        }
예제 #3
0
        private void InitializeItem(PanelBase item)
        {
            item.Title = "Title";
            if (item is TabPanel)
            {
                TabPanel tabPanel = item as TabPanel;

                Tab tab = new Tab();
                tab.Title = "Tab 1";
                tabPanel.Tabs.Add(tab);

                tab       = new Tab();
                tab.Title = "Tab 2";
                tabPanel.Tabs.Add(tab);

                tab       = new Tab();
                tab.Title = "Tab 3";
                tabPanel.Tabs.Add(tab);

                tabPanel.ActiveTabIndex = 0;
            }
        }
예제 #4
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());
        }
예제 #5
0
        public override string GetDesignTimeHtml(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("Coolite.Ext.Web.Build.Resources.Coolite.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());
        }
예제 #6
0
 public virtual void HideTabStripItem(PanelBase item)
 {
     this.HideTabStripItem(item.ClientID);
 }