private void FillPanelContent(NodeIdWrapper panelNodeId, Overview.DisplayMode displayMode, CollapsingPanel overviewPanel)
        {
            // Check the node type of the child items
              int itemNodeType;
              wbOverview.get_field(panelNodeId, (int)Overview.Columns.ChildNodeType, out itemNodeType);

              switch ((Overview.NodeType)itemNodeType)
              {
            case Overview.NodeType.Group:
              {
            // If the child items are of type Group, add them as tabs.
            EnableTabViewForPanel(displayMode, overviewPanel);

            // Fill child items
            if (wbOverview.count_children(panelNodeId) > 0)
              FillPanelContent(wbOverview.get_child(panelNodeId, 0), currentOverviewDisplayMode, overviewPanel);
              }
              break;
            case Overview.NodeType.Section:
              // If they are of item type Section populate the list view with sections and items.
              PopulateSections(overviewPanel, displayMode, true);
              break;
            case Overview.NodeType.Item:
              {
            // If the child entry is an item thean we don't have any intermediate structure.
            ListView sectionListview = GetSectionListview(panelNodeId, overviewPanel, false, displayMode, "", "");
            cacheListview(panelNodeId.toString(), sectionListview);
            PopulateListView(panelNodeId, sectionListview);
            break;
              }
              }
        }
        private void RefreshItemList(NodeIdWrapper node, Overview.NodeType nodeType)
        {
            if (listsByNode.ContainsKey(node.toString()))
              {
            ListView list = listsByNode[node.toString()];

            if (nodeType == Overview.NodeType.Section)
            {
              int childCount = wbOverview.count_children(node) - 1;
              String info = "(" + childCount + ((childCount == 1) ? " item" : " items") + ")";
              SetInfoLabelForList(list, info);
            }

            if (list.View == View.Details)
              SaveColumnStates(list);

            PopulateListView(node, list);

            if (list.View == View.Details)
              RestoreColumnStates(list);
              }
        }
        public void RefreshNodeChildren(NodeIdWrapper node)
        {
            int nodeType;

              if ((null == node) || !node.is_valid())
              {
            RebuildModelContents();
            return;
              }

              if (overviewInvalid)
            return;

              // find the container and refresh it
              if (wbOverview.get_field(node, (int)Overview.Columns.NodeType, out nodeType))
              {
            wbOverview.refresh_node(node, true);

            if (nodeType == (int)Overview.NodeType.Section)
            {
              RefreshItemList(node, (Overview.NodeType)nodeType);
            }
            else if (nodeType == (int)Overview.NodeType.Group)
            {
              CollapsingPanel panel = panelsByNode[node.toString()];
            }
            else if (nodeType == (int)Overview.NodeType.Division)
            {
              int childNodeType;
              wbOverview.get_field(node, (int)Overview.Columns.ChildNodeType, out childNodeType);

              switch ((Overview.NodeType)childNodeType)
              {
            case Overview.NodeType.Group:
              // Group as children of Division means a tabview
              RefreshGroupTabs(node);
              break;

            case Overview.NodeType.Section:
              break;

            case Overview.NodeType.Item:
              RefreshItemList(node, (Overview.NodeType)nodeType);
              break;
              }
            }
              }
        }
        private void RefreshGroupTabs(NodeIdWrapper node)
        {
            if (panelsByNode.ContainsKey(node.toString()))
              {
            CollapsingPanel panel = panelsByNode[node.toString()];

            panel.SuspendLayout();

            panel.Controls.Clear();
            PopulateSections(panel, currentOverviewDisplayMode, false);

            Refresh();

            panel.ResumeLayout();
              }
        }