Beispiel #1
0
        private void WriteBeginPanel(HtmlTextWriter writer, int column, CheckBoxPanel panel)
        {
            // The single panel in the first column is a little different.

            // <div id="js_panel1" class="checkboxes_field field minilist">

            writer.WriteBeginTag("div");
            if (column != 0)
            {
                writer.WriteAttribute("id", GetPanelClientId(panel.Tag));
            }
            var classText = "checkboxes_field field minilist"
                            + (column == 0 ? " js_root-menu-panel" : "");

            writer.WriteAttribute("class", classText);
            writer.Write(HtmlTextWriter.TagRightChar);
            writer.WriteLine();

            // <div class="minilist-header">
            //   <a class="close_button button js_close-menu" title="Close this sub-menu" href="javascript:void(0);">Close</a>
            //   Education
            // </div>

            if (!string.IsNullOrEmpty(panel.Text))
            {
                writer.WriteBeginTag("div");
                writer.WriteAttribute("class", "minilist-header");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.WriteLine();

                writer.WriteBeginTag("a");
                writer.WriteAttribute("class", "close_button button js_close-menu");
                writer.WriteAttribute("title", "Close this sub-menu");
                writer.WriteAttribute("href", "javascript:void(0);");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.WriteEncodedText("Close");
                writer.WriteEndTag("a");
                writer.WriteLine();

                writer.WriteEncodedText(panel.Text);
                writer.WriteEndTag("div");
                writer.WriteLine();
            }

            // <div id="js_checkboxes1" class="checkboxes_control control js_menu-items">

            writer.WriteBeginTag("div");
            if (column != 0)
            {
                writer.WriteAttribute("id", GetCheckboxesClientId(panel.Tag));
            }
            classText = "checkboxes_control control js_menu-items"
                        + (column == 0 ? " js_root-checkboxes" : "");
            writer.WriteAttribute("class", classText);
            writer.Write(HtmlTextWriter.TagRightChar);
            writer.WriteLine();
        }
Beispiel #2
0
 private void WriteColumnPanel(HtmlTextWriter writer, int column, CheckBoxPanel panel)
 {
     WriteBeginPanel(writer, column, panel);
     for (var index = 0; index < panel.PanelItems.Count; ++index)
     {
         WritePanelItem(writer, column, index, panel.PanelItems[index]);
     }
     WriteEndPanel(writer);
 }
Beispiel #3
0
        private IList <IList <CheckBoxPanel> > GetColumnPanels()
        {
            var columnPanels = new List <IList <CheckBoxPanel> >();

            // The first column has a single panel consisting of the top level menu items.

            var panel = new CheckBoxPanel("", "");

            GetPanels(columnPanels, 0).Add(panel);
            GetPanelItems(0, panel, _menuItems, columnPanels);

            return(columnPanels);
        }
Beispiel #4
0
        private static void GetPanelItems(int column, CheckBoxPanel panel, CheckBoxMenuItemCollection menuItems, IList <IList <CheckBoxPanel> > columnPanels)
        {
            for (var index = 0; index < menuItems.Count; ++index)
            {
                // Add a panel item for each menu item.

                var menuItem = menuItems[index];
                var tag      = CreateTag(panel.Tag, index);
                panel.PanelItems.Add(new CheckBoxPanelItem(tag, menuItem));

                // If this menu item has children, then create a new panel for it in the next column.

                if (menuItem.ChildMenuItems.Count > 0)
                {
                    var childPanel = new CheckBoxPanel(menuItem.Text, tag);
                    GetPanels(columnPanels, column + 1).Add(childPanel);
                    GetPanelItems(column + 1, childPanel, menuItem.ChildMenuItems, columnPanels);
                }
            }
        }