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); } }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); submitJButton = new javax.swing.JButton(); enterpriseNameJTextField = new javax.swing.JTextField(); backJButton = new javax.swing.JButton(); networkJComboBox = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); enterpriseTypeJComboBox = new javax.swing.JComboBox(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); networkJTree = new javax.swing.JTree(); jLabel5 = new javax.swing.JLabel(); stateJComboBox = new javax.swing.JComboBox(); jLabel6 = new javax.swing.JLabel(); cityJComboBox = new javax.swing.JComboBox(); jScrollPane2 = new javax.swing.JScrollPane(); InfoJTable = new javax.swing.JTable(); refreshJButton = new javax.swing.JButton(); setMinimumSize(new java.awt.Dimension(700, 700)); jLabel1.setText("Select Network"); submitJButton.setText("Submit"); submitJButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { submitJButtonActionPerformed(evt); } }); backJButton.setText("<< Back"); backJButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backJButtonActionPerformed(evt); } }); networkJComboBox.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Item 1", "Item 2", "Item 3", "Item 4"})); networkJComboBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { networkJComboBoxActionPerformed(evt); } }); jLabel2.setText("Enter Enterprise Name"); enterpriseTypeJComboBox.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Item 1", "Item 2", "Item 3", "Item 4"})); enterpriseTypeJComboBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { enterpriseTypeJComboBoxActionPerformed(evt); } }); jLabel3.setText("Select Enterprise"); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N jLabel4.setText("MANAGE ENTERPRISE"); javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("System"); networkJTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1)); networkJTree.addTreeSelectionListener( new javax.swing.event.TreeSelectionListener() { public void valueChanged(javax.swing.event.TreeSelectionEvent evt) { networkJTreeValueChanged(evt); } }); jScrollPane1.setViewportView(networkJTree); jLabel5.setText("State"); stateJComboBox.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Item 1", "Item 2", "Item 3", "Item 4"})); stateJComboBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stateJComboBoxActionPerformed(evt); } }); jLabel6.setText("City"); cityJComboBox.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Item 1", "Item 2", "Item 3", "Item 4"})); cityJComboBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cityJComboBoxActionPerformed(evt); } }); InfoJTable.setModel( new javax.swing.table.DefaultTableModel( new Object[][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String[] {"Enterprise Name", "Network", "Enterprise Type"})); jScrollPane2.setViewportView(InfoJTable); refreshJButton.setText("refresh"); refreshJButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { refreshJButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(46, 46, 46) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(refreshJButton) .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 379, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( layout .createSequentialGroup() .addComponent(jLabel4) .addGap(139, 139, 139)))) .addGroup( layout .createSequentialGroup() .addGap(87, 87, 87) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent(jLabel3) .addComponent(jLabel2) .addComponent(backJButton)) .addGap(32, 32, 32) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent( enterpriseTypeJComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, 116, javax.swing.GroupLayout .PREFERRED_SIZE) .addComponent( enterpriseNameJTextField, javax.swing.GroupLayout .PREFERRED_SIZE, 116, javax.swing.GroupLayout .PREFERRED_SIZE) .addComponent(submitJButton))) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent(jLabel1) .addComponent(jLabel5) .addComponent(jLabel6)) .addGap(68, 68, 68) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING, false) .addComponent( networkJComboBox, 0, javax.swing.GroupLayout .DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( stateJComboBox, 0, javax.swing.GroupLayout .DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( cityJComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, 116, javax.swing.GroupLayout .PREFERRED_SIZE)))))) .addContainerGap(131, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(45, 45, 45) .addComponent(refreshJButton) .addGap(18, 18, 18) .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(52, 52, 52) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addGroup( layout .createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel1)) .addComponent( networkJComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .PREFERRED_SIZE)) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addGroup( layout .createSequentialGroup() .addGap(28, 28, 28) .addComponent(jLabel5)) .addGroup( layout .createSequentialGroup() .addGap(18, 18, 18) .addComponent( stateJComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .PREFERRED_SIZE))) .addGap(30, 30, 30) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .BASELINE) .addComponent(jLabel6) .addComponent( cityJComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .PREFERRED_SIZE)) .addGap(37, 37, 37) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .BASELINE) .addComponent(jLabel3) .addComponent( enterpriseTypeJComboBox, javax.swing.GroupLayout .PREFERRED_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .PREFERRED_SIZE)) .addGap(27, 27, 27) .addComponent(jLabel2)) .addComponent( enterpriseNameJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(submitJButton)) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent(jLabel4) .addGap(5, 5, 5) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 469, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(backJButton) .addContainerGap(161, Short.MAX_VALUE))); } // </editor-fold>//GEN-END:initComponents