/// <summary> /// Display all the information in the data set. This can be called, for example, /// after a data set has been read. /// </summary> public virtual void displayDataSet() { string routine = "StateMod_DataSet_JTree.displayDataSet"; System.Collections.IList v = __dataset.getComponentGroups(); int size = 0; if (v != null) { size = v.Count; } SimpleJTree_Node node = null, node2 = null; DataSetComponent comp = null; bool hadData = false; bool isGroup = false; int type; // Add each component group... setFastAdd(true); Icon folder_Icon = getClosedIcon(); for (int i = 0; i < size; i++) { hadData = false; isGroup = false; comp = (DataSetComponent)v[i]; if ((comp == null) || !comp.isVisible()) { continue; } type = comp.getComponentType(); if (type == StateMod_DataSet.COMP_GEOVIEW_GROUP) { // Don't want to list the groups because there is no // way to display edit (or they are displayed elsewhere)... continue; } node = new SimpleJTree_Node(comp.getComponentName()); node.setData(comp); if (comp.isGroup()) { isGroup = true; } // To force groups to be folders, even if no data underneath... node.setIcon(folder_Icon); try { addNode(node); } catch (Exception e) { Message.printWarning(2, routine, "Error adding component group " + comp.getComponentName()); Message.printWarning(2, routine, e); continue; } if (__display_data_objects) { // Display the primary object in each group hadData = displayDataSetComponent(comp, node); } else { // Add the components in the group... System.Collections.IList v2 = (System.Collections.IList)comp.getData(); int size2 = 0; if (v2 != null) { size2 = v2.Count; } for (int j = 0; j < size2; j++) { comp = (DataSetComponent)v2[j]; if ((comp == null) || !comp.isVisible()) { continue; } node2 = new SimpleJTree_Node(comp.getComponentName()); node2.setData(comp); try { addNode(node2, node); } catch (Exception e) { Message.printWarning(2, routine, "Error adding component " + comp.getComponentName()); Message.printWarning(2, routine, e); continue; } } if (size2 > 0) { hadData = true; } } if (isGroup && !hadData) { node.setIcon(__folderIcon); } } setFastAdd(false); }
/// <summary> /// Display all the information in the data set. This can be called, for example, /// after a data set has been read. /// </summary> public virtual void displayDataSet() { string routine = "StateCU_DataSet_JTree.displayDataSet"; System.Collections.IList v = __dataset.getComponentGroups(); int size = 0; if (v != null) { size = v.Count; } SimpleJTree_Node node = null, node2 = null; DataSetComponent comp = null; string name = ""; bool isGroup = false; bool hasData = false; int type; // Add each component group... setFastAdd(true); for (int i = 0; i < size; i++) { isGroup = false; hasData = false; comp = (DataSetComponent)v[i]; if ((comp == null) || !comp.isVisible()) { continue; } if (comp.isGroup()) { isGroup = true; } type = comp.getComponentType(); // Show the control data at the high level. if (type == StateCU_DataSet.COMP_GIS_GROUP) { // Don't want to list the GIS data... continue; } if ((type == StateCU_DataSet.COMP_GIS_GROUP) && __display_data_objects) { // Currently don't want to list GIS data in // results... continue; } node = new SimpleJTree_Node(comp.getComponentName()); node.setData(comp); try { addNode(node); } catch (Exception e) { Message.printWarning(2, routine, "Error adding component group " + comp.getComponentName()); Message.printWarning(2, routine, e); continue; } if (__display_data_objects) { // Display the primary object in each group int primary_type = __dataset.lookupPrimaryComponentTypeForComponentGroup(comp.getComponentType()); if (primary_type >= 0) { comp = __dataset.getComponentForComponentType(primary_type); } if ((comp == null) || !comp.isVisible()) { continue; } object data_Object = comp.getData(); if (data_Object == null) { continue; } System.Collections.IList data = null; if (data_Object is System.Collections.IList) { data = (System.Collections.IList)comp.getData(); } else { // Continue (REVISIT - what components would // this happen for?)... Message.printWarning(2, routine, "Unexpected non-Vector for " + comp.getComponentName()); } StateCU_Data cudata; StateMod_Data smdata; int dsize = 0; if (data != null) { dsize = data.Count; } for (int idata = 0; idata < dsize; idata++) { if (comp.getComponentType() == StateCU_DataSet.COMP_DELAY_TABLES_MONTHLY) { // StateMod data object so have to // handle separately because StateCU // uses the StateMod group... smdata = (StateMod_Data)data[idata]; name = smdata.getName(); node2 = new SimpleJTree_Node(name); node2.setData(smdata); } else { // StateCU data object... cudata = (StateCU_Data)data[idata]; name = cudata.getName(); node2 = new SimpleJTree_Node(name); node2.setData(cudata); } try { addNode(node2, node); } catch (Exception e) { Message.printWarning(2, routine, "Error adding data " + name); Message.printWarning(2, routine, e); continue; } } if (dsize > 0) { hasData = true; } // Collapse the node because the lists are // usually pretty long... try { collapseNode(node); } catch (Exception) { // Ignore. } } else { // Add the components in the group... Message.printStatus(1, "", "Not displaying data objects"); System.Collections.IList v2 = (System.Collections.IList)comp.getData(); int size2 = 0; if (v2 != null) { size2 = v2.Count; } Message.printStatus(1, "", "group has " + size2 + " subcomponents"); for (int j = 0; j < size2; j++) { comp = (DataSetComponent)v2[j]; if (!comp.isVisible()) { continue; } node2 = new SimpleJTree_Node(comp.getComponentName()); node2.setData(comp); try { addNode(node2, node); } catch (Exception e) { Message.printWarning(2, routine, "Error adding component " + comp.getComponentName()); Message.printWarning(2, routine, e); continue; } } if (size2 > 0) { hasData = true; } } if (isGroup && !hasData) { node.setIcon(__folderIcon); } } setFastAdd(false); }