< prev index next >

src/com/sun/javatest/agent/AgentMonitorTool.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 175             fc.anchor = GridBagConstraints.WEST;
 176             fc.gridwidth = GridBagConstraints.REMAINDER;
 177             fc.weightx = 1;
 178             add(timeoutField, fc);
 179             timeoutLabel.setLabelFor(timeoutField);
 180 
 181             listData = new DefaultListModel<>();
 182             list = uif.createList("tool.pool", listData);
 183             list.setPrototypeCellValue("abcdefghiklmnopqrstuvwxyz");
 184             list.setVisibleRowCount(3);
 185             GridBagConstraints c = new GridBagConstraints();
 186             c.fill = GridBagConstraints.BOTH;
 187             c.gridwidth = GridBagConstraints.REMAINDER;
 188             c.weightx = 1;
 189             c.weighty = 1;
 190             add(uif.createScrollPane(list), c);
 191 
 192             // Ensure any existing entries in the pool are displayed
 193             // Note there is a slight synchronization window between the call of
 194             // elements and that of addObserver.
 195             for (Enumeration e = activeAgentPool.elements(); e.hasMoreElements(); ) {
 196                 Connection conn = (Connection)(e.nextElement());
 197                 listData.addElement(conn.getName());
 198             }
 199 
 200             activeAgentPool.addObserver(this);
 201             enableFields();
 202         }
 203 
 204         public void itemStateChanged(ItemEvent e) {
 205             if (e.getItemSelectable() == listeningCheck) {
 206                 try {
 207                     if (e.getStateChange() == ItemEvent.SELECTED) {
 208                         try {
 209                             int timeout = Integer.parseInt(timeoutField.getText());
 210 
 211                             if (timeout <= 0) {
 212                                 throw new NumberFormatException();
 213                             }
 214 
 215                             // field is in seconds; agentMgr API is in msec
 216                             activeAgentPool.setTimeout(timeout*1000);


 340         private JLabel timeoutLabel;
 341         private JTextField timeoutField;
 342         private JList<String> list;
 343         private DefaultListModel<String> listData;
 344     }
 345 
 346     private class CurrentAgentsSubpanel extends JPanel
 347         implements ListSelectionListener, AgentManager.Observer
 348     {
 349         CurrentAgentsSubpanel() {
 350             setName("tool.curr");
 351             setBorder(uif.createTitledBorder("tool.curr"));
 352             setLayout(new GridBagLayout());
 353             uif.setToolTip(this, "tool.curr");
 354 
 355             listData = new DefaultListModel<>();
 356             list = uif.createList("tool.list.curr", listData);
 357             list.setVisibleRowCount(5);
 358 
 359             list.setCellRenderer(new DefaultListCellRenderer() {
 360                 public Component getListCellRendererComponent(JList list, Object o, int index, boolean isSelected, boolean cellHasFocus) {
 361                     String name = o.toString();
 362                     return super.getListCellRendererComponent(list, name, index, isSelected, cellHasFocus);
 363                 }
 364             });
 365 
 366             list.addListSelectionListener(this);
 367 
 368             GridBagConstraints c = new GridBagConstraints();
 369             c.fill = GridBagConstraints.BOTH;
 370             c.gridwidth = GridBagConstraints.REMAINDER;
 371             c.insets.bottom = 5;
 372             c.weightx = 1;
 373             c.weighty = 1;
 374             add(uif.createScrollPane(list), c);
 375 
 376             GridBagConstraints lc = new GridBagConstraints();
 377             lc.gridwidth = 1;
 378             lc.weightx = 0;
 379             lc.anchor = GridBagConstraints.EAST;
 380             lc.insets.right = 5;




 175             fc.anchor = GridBagConstraints.WEST;
 176             fc.gridwidth = GridBagConstraints.REMAINDER;
 177             fc.weightx = 1;
 178             add(timeoutField, fc);
 179             timeoutLabel.setLabelFor(timeoutField);
 180 
 181             listData = new DefaultListModel<>();
 182             list = uif.createList("tool.pool", listData);
 183             list.setPrototypeCellValue("abcdefghiklmnopqrstuvwxyz");
 184             list.setVisibleRowCount(3);
 185             GridBagConstraints c = new GridBagConstraints();
 186             c.fill = GridBagConstraints.BOTH;
 187             c.gridwidth = GridBagConstraints.REMAINDER;
 188             c.weightx = 1;
 189             c.weighty = 1;
 190             add(uif.createScrollPane(list), c);
 191 
 192             // Ensure any existing entries in the pool are displayed
 193             // Note there is a slight synchronization window between the call of
 194             // elements and that of addObserver.
 195             for (Enumeration<Connection> e = activeAgentPool.elements(); e.hasMoreElements(); ) {
 196                 Connection conn = e.nextElement();
 197                 listData.addElement(conn.getName());
 198             }
 199 
 200             activeAgentPool.addObserver(this);
 201             enableFields();
 202         }
 203 
 204         public void itemStateChanged(ItemEvent e) {
 205             if (e.getItemSelectable() == listeningCheck) {
 206                 try {
 207                     if (e.getStateChange() == ItemEvent.SELECTED) {
 208                         try {
 209                             int timeout = Integer.parseInt(timeoutField.getText());
 210 
 211                             if (timeout <= 0) {
 212                                 throw new NumberFormatException();
 213                             }
 214 
 215                             // field is in seconds; agentMgr API is in msec
 216                             activeAgentPool.setTimeout(timeout*1000);


 340         private JLabel timeoutLabel;
 341         private JTextField timeoutField;
 342         private JList<String> list;
 343         private DefaultListModel<String> listData;
 344     }
 345 
 346     private class CurrentAgentsSubpanel extends JPanel
 347         implements ListSelectionListener, AgentManager.Observer
 348     {
 349         CurrentAgentsSubpanel() {
 350             setName("tool.curr");
 351             setBorder(uif.createTitledBorder("tool.curr"));
 352             setLayout(new GridBagLayout());
 353             uif.setToolTip(this, "tool.curr");
 354 
 355             listData = new DefaultListModel<>();
 356             list = uif.createList("tool.list.curr", listData);
 357             list.setVisibleRowCount(5);
 358 
 359             list.setCellRenderer(new DefaultListCellRenderer() {
 360                 public Component getListCellRendererComponent(JList<?> list, Object o, int index, boolean isSelected, boolean cellHasFocus) {
 361                     String name = o.toString();
 362                     return super.getListCellRendererComponent(list, name, index, isSelected, cellHasFocus);
 363                 }
 364             });
 365 
 366             list.addListSelectionListener(this);
 367 
 368             GridBagConstraints c = new GridBagConstraints();
 369             c.fill = GridBagConstraints.BOTH;
 370             c.gridwidth = GridBagConstraints.REMAINDER;
 371             c.insets.bottom = 5;
 372             c.weightx = 1;
 373             c.weighty = 1;
 374             add(uif.createScrollPane(list), c);
 375 
 376             GridBagConstraints lc = new GridBagConstraints();
 377             lc.gridwidth = 1;
 378             lc.weightx = 0;
 379             lc.anchor = GridBagConstraints.EAST;
 380             lc.insets.right = 5;


< prev index next >