private void populateEnterpriseNetworkTable(Network n) { // for (Network country : system.getNetworkList()) // for (Network state : country.getSubnetworklist()) // for (Network city : state.getSubnetworklist()) DefaultTableModel model = (DefaultTableModel) InfoJTable.getModel(); model.setRowCount(0); for (Enterprise ent : n.getEnterpriseDirectory().getEnterpriseList()) { Object row[] = new Object[3]; row[0] = ent.getName(); row[1] = n.getNetworkname() + " , " + n.getNetworkname() + " , " + n.getNetworkname(); row[2] = ent.getEnterpriseType(); model.addRow(row); } }
public void populateTree() { DefaultTreeModel model = (DefaultTreeModel) JTree.getModel(); ArrayList<Network> networkList = system.getNetworkList(); ArrayList<Enterprise> enterpriseList; ArrayList<Organization> organizationList; Network network; Enterprise enterprise; Organization organization; DefaultMutableTreeNode networks = new DefaultMutableTreeNode("Networks"); DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); root.removeAllChildren(); root.insert(networks, 0); DefaultMutableTreeNode networkNode; DefaultMutableTreeNode enterpriseNode; DefaultMutableTreeNode organizationNode; for (int i = 0; i < networkList.size(); i++) { network = networkList.get(i); networkNode = new DefaultMutableTreeNode(network.getName()); networks.insert(networkNode, i); enterpriseList = network.getEnterpriseDirectory().getEnterpriseList(); for (int j = 0; j < enterpriseList.size(); j++) { enterprise = enterpriseList.get(j); enterpriseNode = new DefaultMutableTreeNode(enterprise.getName()); networkNode.insert(enterpriseNode, j); organizationList = enterprise.getOrganizationDirectory().getOrganizationList(); for (int k = 0; k < organizationList.size(); k++) { organization = organizationList.get(k); organizationNode = new DefaultMutableTreeNode(organization.getName()); enterpriseNode.insert(organizationNode, k); } } } model.reload(); }