/** Reaction to checkbox changes. */ public void stateChanged(ChangeEvent e) { if (myMonitor.getMyNetwork().getContainer().getMyStatus().isStopped()) { enabled = cbEnabled.isSelected(); myMonitor.setEnabled(enabled); } else cbEnabled.setSelected(enabled); return; }
/** Generates Configuration tab. */ private void fillConfigurationPanel() { JPanel desc = new JPanel(new GridLayout(2, 0)); desc.setBorder(BorderFactory.createTitledBorder("Description")); desc.add( new JLabel("<html><font color=\"blue\">" + myMonitor.getDescription() + "</font></html>")); desc.add(cbEnabled); cbEnabled.setSelected(enabled); cbEnabled.addChangeListener(this); confPanel.add(desc); JPanel mlpanel = new JPanel(new GridLayout(1, 0)); mlpanel.setBorder(BorderFactory.createTitledBorder("Monitored Network Elements")); montable = new JTable(montablemodel); montable.setPreferredScrollableViewportSize(new Dimension(200, 100)); montable.getColumnModel().getColumn(0).setPreferredWidth(140); montable.getColumnModel().getColumn(1).setPreferredWidth(60); montable.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int row = montable.rowAtPoint(new Point(e.getX(), e.getY())); AbstractNetworkElement ne = null; if ((row >= 0) && (row < myMonitor.getPredecessors().size())) ne = myMonitor.getPredecessors().get(row); else return; treePane.actionSelected(ne, true); } return; } }); mlpanel.add(new JScrollPane(montable)); confPanel.add(mlpanel); JPanel cpanel = new JPanel(new GridLayout(1, 0)); cpanel.setBorder(BorderFactory.createTitledBorder("Controlleded Network Elements")); ctrltable = new JTable(ctrltablemodel); ctrltable.setPreferredScrollableViewportSize(new Dimension(200, 100)); ctrltable.getColumnModel().getColumn(0).setPreferredWidth(140); ctrltable.getColumnModel().getColumn(1).setPreferredWidth(60); ctrltable.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int row = ctrltable.rowAtPoint(new Point(e.getX(), e.getY())); AbstractNetworkElement ne = null; if ((row >= 0) && (row < myMonitor.getSuccessors().size())) ne = myMonitor.getSuccessors().get(row); else return; treePane.actionSelected(ne, true); } return; } }); cpanel.add(new JScrollPane(ctrltable)); confPanel.add(cpanel); JPanel pcl = new JPanel(new FlowLayout()); // controller list buttonProp.setEnabled(false); buttonProp.setActionCommand(cmdCtrlProp); buttonProp.addActionListener(this); pcl.setBorder(BorderFactory.createTitledBorder("Complex Controller")); buttonProp.setEnabled(false); listCControllers = new JComboBox(); listCControllers.addItem("None"); String[] ctrlClasses = myMonitor.getComplexControllerClasses(); for (int i = 0; i < ctrlClasses.length; i++) { if ((myController != null) && (myController.getClass().getName().compareTo(ctrlClasses[i]) == 0)) { listCControllers.addItem(myController); listCControllers.setSelectedIndex(i + 1); buttonProp.setEnabled(true); } else { try { Class cl = Class.forName(ctrlClasses[i]); AbstractControllerComplex cc = (AbstractControllerComplex) cl.newInstance(); cc.setMyMonitor(myMonitor); cc.initialize(); listCControllers.addItem(cc); } catch (Exception e) { } } } listCControllers.setActionCommand(cmdCtrlList); listCControllers.addActionListener(this); pcl.add(listCControllers); pcl.add(buttonProp); confPanel.add(pcl); return; }