Ejemplo n.º 1
0
 public BsEditorToolbarHtmlBuilder(BsEditorTabBuilder tabBuilder, ViewContext viewContext)
 {
     this.renderer    = new BsEditorToolbarRenderer <TModel>(this);
     this.parts       = new List <BsEditorToolbarPart>();
     this.model       = (TModel)tabBuilder.GetModel();
     this.viewContext = viewContext;
 }
Ejemplo n.º 2
0
        private void InsertTab <TEditor, TRow>(object id, BsEditorTabBuilder <TEditor> tabBuilder)
            where TEditor : IBsEditorTabModel
            where TRow : BsItemModel
        {
            if (tabBuilder.IsSelected())
            {
                foreach (var tab in this.Tabs)
                {
                    if (tab.Key == id)
                    {
                        throw new Exception("Duplicate tab id " + id.ToString());
                    }

                    if (tab.Value.IsSelected())
                    {
                        tab.Value.SetSelected(false);
                    }
                }
            }
            this.Tabs.Add(id, tabBuilder);
        }
Ejemplo n.º 3
0
        private void Add <TEditor, TRow>(BsEditorTabAttribute attr, BsEditorTabModel <TRow> model, List <TabGroupConnection> connections, object[] groupIds, BsTheme theme)
            where TEditor : IBsEditorTabModel
            where TRow : BsItemModel
        {
            var tab =
                new BsEditorTabBuilder <TEditor>(model, this.viewContext, connections).ConnectsWith(groupIds)
                .DisplayName(attr.Name)
                .Id(attr.Id)
                .Selected(attr.Selected);

            if (attr.Editable)
            {
                tab.Editable();
            }

            tab.InitRenderer <TRow>(theme);

            if (attr.Selected)
            {
                navBuilder.Selected(attr.Id);
            }

            InsertTab <TEditor, TRow>(attr.Id, tab);
        }