ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/conient/uk/org/iscream/cms/conient/ConfigurationDialog.java
(Generate patch)

Comparing projects/cms/source/conient/uk/org/iscream/cms/conient/ConfigurationDialog.java (file contents):
Revision 1.8 by ajm, Fri Mar 16 19:47:53 2001 UTC vs.
Revision 1.13 by ajm, Fri Mar 23 03:58:26 2001 UTC

# Line 8 | Line 8 | import javax.swing.*;
8   import javax.swing.border.*;
9   import java.util.Properties;
10   import java.util.StringTokenizer;
11 + import java.util.Collections;
12 + import java.util.ArrayList;
13 + import java.util.Iterator;
14  
15   /**
16   * This provides a modal dialog from which the user
17   * can reconfigure the conient client.
18   *
19 < * It then writes back the configuration to the file.
19 > * Look at the comments for the attributes of this class to see
20 > * what configuration options this class deals with.
21   *
22 < * Server configured options are displayed, but are
23 < * for information purposes only, and cannot be changed.
22 > * It then writes back the configuration to the loaded configuration.
23 > * The user can then opt to save it.
24   *
25 + *
26   * @author  $Author$
27   * @version $Id$
28   */
# Line 68 | Line 73 | public class ConfigurationDialog extends JDialog {
73          // client options
74          center.addTab("Client Options", createClientOptions());
75          
76 <        // server options
76 >        // _server options
77          center.addTab("Server Options", createServerOptions());
78  
79          // firewall options
# Line 93 | Line 98 | public class ConfigurationDialog extends JDialog {
98  
99   //---PRIVATE METHODS---
100    
101 +    /**
102 +     * creates a JPanel for the client options
103 +     *
104 +     * @return the build panel with the options
105 +     */
106      private JPanel createClientOptions() {
107          GridBagLayout gridbag = new GridBagLayout();
108          GridBagLayout gridbag2 = new GridBagLayout();
# Line 103 | Line 113 | public class ConfigurationDialog extends JDialog {
113          clientPanel.setLayout(gridbag);
114          JLabel nameLabel = new JLabel("Client name:");
115          nameLabel.setHorizontalAlignment(JLabel.RIGHT);
116 <        name = new JTextField(20);
116 >        _name = new JTextField(20);
117          JPanel nameBox = new JPanel();
118          nameBox.setLayout(new GridLayout(1,2));
119          nameBox.add(nameLabel);
120 <        nameBox.add(name);
120 >        nameBox.add(_name);
121          
122          c.gridy = 0;
123          gridbag.setConstraints(nameBox, c);
# Line 118 | Line 128 | public class ConfigurationDialog extends JDialog {
128          
129          JPanel knownHostsPanel = new JPanel();
130          knownHostsPanel.setLayout(new BoxLayout(knownHostsPanel, BoxLayout.Y_AXIS));
131 <        hostDiscoveryMode = new JCheckBox("Discover new hosts from the server");
132 <        knownHostsPanel.add(hostDiscoveryMode);
131 >        _hostDiscoveryMode = new JCheckBox("Discover new hosts from the server");
132 >        knownHostsPanel.add(_hostDiscoveryMode);
133          knownHostsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), " Known Hosts "));
134 <        knownHosts = new JList();
135 <        knownHosts.setVisibleRowCount(10);
136 <        JScrollPane knownHostsScrollPane = new JScrollPane(knownHosts);
134 >        _knownHosts = new JList();
135 >        _knownHosts.setVisibleRowCount(10);
136 >        JScrollPane knownHostsScrollPane = new JScrollPane(_knownHosts);
137          knownHostsPanel.add(knownHostsScrollPane);
138          JLabel newHostLabel = new JLabel("New host:");
139          newHostLabel.setHorizontalAlignment(JLabel.RIGHT);
140 <        newHost = new JTextField(20);
140 >        _newHost = new JTextField(20);
141  
142          JButton newHostButton = new JButton("Add Host");
143          newHostButton.addActionListener(new ActionListener() {
144              public void actionPerformed(ActionEvent e) {
145 <                knownHostsModel.addElement(newHost.getText());
146 <                newHost.setText("");
145 >                _knownHostsData.add(_newHost.getText());
146 >                _newHost.setText("");
147 >                setListDisplay();
148              }
149          });
150          JButton removeHostButton = new JButton("Remove Host(s)");
151          removeHostButton.addActionListener(new ActionListener() {
152              public void actionPerformed(ActionEvent e) {
153 <                Object[] selected = knownHosts.getSelectedValues();
153 >                Object[] selected = _knownHosts.getSelectedValues();
154                  for(int x = 0; x < selected.length; x++) {
155 <                    knownHostsModel.removeElement(selected[x]);
155 >                    _knownHostsData.remove(_knownHostsData.indexOf(selected[x]));
156 >                    setListDisplay();
157                  }
158              }
159          });
160          JPanel newHostBox = new JPanel();
161          newHostBox.setLayout(new GridLayout(1,3));
162          newHostBox.add(newHostLabel);
163 <        newHostBox.add(newHost);
163 >        newHostBox.add(_newHost);
164  
165          JPanel buttonPanel = new JPanel();
166          buttonPanel.add(newHostButton);
# Line 169 | Line 181 | public class ConfigurationDialog extends JDialog {
181          JButton add = new JButton(">>>");
182          add.addActionListener(new ActionListener() {
183              public void actionPerformed(ActionEvent e) {
184 <                Object[] selected = knownHosts.getSelectedValues();
184 >                Object[] selected = _knownHosts.getSelectedValues();
185                  for(int x = 0; x < selected.length; x++) {
186 <                    knownHostsModel.removeElement(selected[x]);
187 <                    hostListModel.addElement(selected[x]);
186 >                    _knownHostsData.remove(_knownHostsData.indexOf(selected[x]));
187 >                    _hostListData.add(selected[x]);
188 >                    setListDisplay();
189                  }
190              }
191          });
# Line 182 | Line 195 | public class ConfigurationDialog extends JDialog {
195          JButton remove = new JButton("<<<");
196          remove.addActionListener(new ActionListener() {
197              public void actionPerformed(ActionEvent e) {
198 <                Object[] selected = hostList.getSelectedValues();
198 >                Object[] selected = _hostList.getSelectedValues();
199                  for(int x = 0; x < selected.length; x++) {
200 <                    hostListModel.removeElement(selected[x]);
201 <                    knownHostsModel.addElement(selected[x]);
200 >                    _hostListData.remove(_hostListData.indexOf(selected[x]));
201 >                    _knownHostsData.add(selected[x]);
202 >                    setListDisplay();
203                  }
204              }
205          });
# Line 199 | Line 213 | public class ConfigurationDialog extends JDialog {
213  
214          JPanel hostListPanel = new JPanel();
215          hostListPanel.setLayout(new BoxLayout(hostListPanel, BoxLayout.Y_AXIS));
216 <        useHostList = new JCheckBox("Only monitor hosts in this list");
217 <        hostListPanel.add(useHostList);
216 >        _useHostList = new JCheckBox("Only monitor hosts in this list");
217 >        hostListPanel.add(_useHostList);
218          hostListPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), " Hosts To Monitor "));
219 <        hostList = new JList();
220 <        hostList.setVisibleRowCount(10);
221 <        JScrollPane hostListScrollPane = new JScrollPane(hostList);
219 >        _hostList = new JList();
220 >        _hostList.setVisibleRowCount(10);
221 >        JScrollPane hostListScrollPane = new JScrollPane(_hostList);
222          hostListPanel.add(hostListScrollPane);
223          
224          c.gridy = 0;
# Line 218 | Line 232 | public class ConfigurationDialog extends JDialog {
232          clientPanel.add(lists);
233          return clientPanel;
234      }
235 <
235 >    
236 >    /**
237 >     * creates a JPanel for the server options
238 >     *
239 >     * @return the build panel with the options
240 >     */
241      private JPanel createServerOptions() {
242          GridBagLayout gridbag = new GridBagLayout();
243          GridBagConstraints c = new GridBagConstraints();
244          c.fill = GridBagConstraints.HORIZONTAL;
245          JPanel serverPanel = new JPanel();
246          serverPanel.setLayout(gridbag);
247 <        JLabel serverLabel = new JLabel("i-scream Server:");
247 >        _connectControl = new JCheckBox("Automatically connect the control channel");
248 >        c.gridy = 0;
249 >        gridbag.setConstraints(_connectControl, c);
250 >        serverPanel.add(_connectControl);
251 >        _connectData = new JCheckBox("Automatically connect the data channel");
252 >        c.gridy = 1;
253 >        gridbag.setConstraints(_connectData, c);
254 >        serverPanel.add(_connectData);
255 >        JLabel serverLabel = new JLabel("i-scream server:");
256          serverLabel.setHorizontalAlignment(JLabel.RIGHT);
257 <        server = new JTextField(20);
257 >        _server = new JTextField(20);
258          JPanel serverBox = new JPanel();
259          serverBox.setLayout(new GridLayout(1,2));
260          serverBox.add(serverLabel);
261 <        serverBox.add(server);
262 <        c.gridy = 0;
261 >        serverBox.add(_server);
262 >        c.gridy = 2;
263          gridbag.setConstraints(serverBox, c);
264          serverPanel.add(serverBox);
265          JLabel portLabel = new JLabel("Client interface port:");
266          portLabel.setHorizontalAlignment(JLabel.RIGHT);
267 <        port = new JTextField(4);
267 >        _port = new JTextField(4);
268          JPanel portBox = new JPanel();
269          portBox.setLayout(new GridLayout(1,2));
270          portBox.add(portLabel);
271 <        portBox.add(port);
272 <        c.gridy = 1;
271 >        portBox.add(_port);
272 >        c.gridy = 3;
273          gridbag.setConstraints(portBox, c);
274          serverPanel.add(portBox);
248        connectControl = new JCheckBox("Automatically connect the control channel");
249        c.gridy = 2;
250        gridbag.setConstraints(connectControl, c);
251        serverPanel.add(connectControl);
252        connectData = new JCheckBox("Automatically connect the data channel");
253        c.gridy = 3;
254        gridbag.setConstraints(connectData, c);
255        serverPanel.add(connectData);
275          return serverPanel;
276      }
277  
278 +    /**
279 +     * creates a JPanel for the firewall options
280 +     *
281 +     * @return the build panel with the options
282 +     */
283      private JPanel createFirewallOptions() {
284          GridBagLayout gridbag = new GridBagLayout();
285          GridBagConstraints c = new GridBagConstraints();
286          c.fill = GridBagConstraints.HORIZONTAL;
287          JPanel firewallPanel = new JPanel();
288          firewallPanel.setLayout(gridbag);
265                
289          
290 <        useFirewall = new JCheckBox("Use firewall command to connect through to server");
290 >        _useFirewall = new JCheckBox("Use firewall command to connect through to server");
291          c.gridy = 0;
292 <        gridbag.setConstraints(useFirewall, c);
293 <        firewallPanel.add(useFirewall);
292 >        gridbag.setConstraints(_useFirewall, c);
293 >        firewallPanel.add(_useFirewall);
294  
295          JLabel commandLabel = new JLabel("Firewall command:");
296          commandLabel.setHorizontalAlignment(JLabel.RIGHT);
297 <        firewallCommand = new JTextField(20);
275 <        firewallCommand.setSize(new Dimension(1,10));
297 >        _firewallCommand = new JTextField(20);
298          JPanel commandBox = new JPanel();
299          commandBox.setLayout(new GridLayout(1,2));
300          commandBox.add(commandLabel);
301 <        commandBox.add(firewallCommand);
301 >        commandBox.add(_firewallCommand);
302          
303          c.gridy = 1;
304          gridbag.setConstraints(commandBox, c);
# Line 284 | Line 306 | public class ConfigurationDialog extends JDialog {
306          
307          JLabel waitLabel = new JLabel("Firewall wait time:");
308          waitLabel.setHorizontalAlignment(JLabel.RIGHT);
309 <        firewallWait = new JTextField(2);
309 >        _firewallWait = new JTextField(2);
310          JPanel waitBox = new JPanel();
311          waitBox.setLayout(new GridLayout(1,2));
312          waitBox.add(waitLabel);
313 <        waitBox.add(firewallWait);
313 >        waitBox.add(_firewallWait);
314  
315          c.gridy = 2;        
316          gridbag.setConstraints(waitBox, c);
317          firewallPanel.add(waitBox);
318          
319 <        JLabel fserverLabel = new JLabel("Firewall server:");
320 <        fserverLabel.setHorizontalAlignment(JLabel.RIGHT);
321 <        firewallServer = new JTextField(20);
322 <        JPanel fserverBox = new JPanel();
323 <        fserverBox.setLayout(new GridLayout(1,2));
324 <        fserverBox.add(fserverLabel);
325 <        fserverBox.add(firewallServer);
319 >        JLabel fServerLabel = new JLabel("Firewall server:");
320 >        fServerLabel.setHorizontalAlignment(JLabel.RIGHT);
321 >        _firewallServer = new JTextField(20);
322 >        JPanel fServerBox = new JPanel();
323 >        fServerBox.setLayout(new GridLayout(1,2));
324 >        fServerBox.add(fServerLabel);
325 >        fServerBox.add(_firewallServer);
326          
327          c.gridy = 3;
328 <        gridbag.setConstraints(fserverBox, c);
329 <        firewallPanel.add(fserverBox);
328 >        gridbag.setConstraints(fServerBox, c);
329 >        firewallPanel.add(fServerBox);
330          
331          return firewallPanel;
332      }
333  
334 +    /**
335 +     * creates a JPanel for the data options
336 +     *
337 +     * @return the build panel with the options
338 +     */
339      private JPanel createDataOptions() {
340          GridBagLayout gridbag = new GridBagLayout();
341          GridBagConstraints c = new GridBagConstraints();
342          c.fill = GridBagConstraints.HORIZONTAL;
343          JPanel dataPanel = new JPanel();
344          dataPanel.setLayout(gridbag);
345 <        displayQueue = new JCheckBox("Display server queue information");
345 >        _displayQueue = new JCheckBox("Display server queue information");
346          c.gridy = 0;
347 <        gridbag.setConstraints(displayQueue, c);
348 <        dataPanel.add(displayQueue);
349 <        displayExtra = new JCheckBox("Display extra data found in packets");
347 >        gridbag.setConstraints(_displayQueue, c);
348 >        dataPanel.add(_displayQueue);
349 >        _displayExtra = new JCheckBox("Display extra data found in packets");
350          c.gridy = 1;
351 <        gridbag.setConstraints(displayExtra, c);
352 <        dataPanel.add(displayExtra);
353 <        packetDump = new JCheckBox("Dump raw packet data to the console");
351 >        gridbag.setConstraints(_displayExtra, c);
352 >        dataPanel.add(_displayExtra);
353 >        _packetDump = new JCheckBox("Dump raw packet data to the console");
354          c.gridy = 2;
355 <        gridbag.setConstraints(packetDump, c);
356 <        dataPanel.add(packetDump);
355 >        gridbag.setConstraints(_packetDump, c);
356 >        dataPanel.add(_packetDump);
357 >        
358 >        JLabel queueLimitLabel = new JLabel("Maximum data queue size:");
359 >        queueLimitLabel.setHorizontalAlignment(JLabel.RIGHT);
360 >        _queueLimit = new JTextField(4);
361 >        JPanel queueBox = new JPanel();
362 >        queueBox.setLayout(new GridLayout(1,2));
363 >        queueBox.add(queueLimitLabel);
364 >        queueBox.add(_queueLimit);
365 >        c.gridy = 3;
366 >        gridbag.setConstraints(queueBox, c);
367 >        dataPanel.add(queueBox);
368          return dataPanel;
369      }
370      
371 +    /**
372 +     * Reads in the current settings from the loaded configuration
373 +     */
374      private void getCurrentSettings() {
375 <        name.setText(config.getProperty("clientname"));
376 <        server.setText(config.getProperty("control.server"));
377 <        port.setText(config.getProperty("control.port"));
378 <        connectControl.setSelected(config.getProperty("control.onstartconnect").equals("1"));
379 <        connectData.setSelected(config.getProperty("data.onstartconnect").equals("1"));
380 <        firewallCommand.setText(config.getProperty("firewall.command"));
381 <        firewallCommand.moveCaretPosition(0);
382 <        firewallWait.setText(config.getProperty("firewall.commandwait"));
383 <        firewallServer.setText(config.getProperty("firewall.server"));
384 <        displayQueue.setSelected(config.getProperty("displayQueueInformation").equals("1"));
385 <        displayExtra.setSelected(config.getProperty("displayExtraData").equals("1"));
386 <        packetDump.setSelected(config.getProperty("packetDump").equals("1"));
387 <        useFirewall.setSelected(config.getProperty("useFirewall").equals("1"));
388 <        hostDiscoveryMode.setSelected(config.getProperty("hostDiscoveryMode").equals("1"));
389 <        useHostList.setSelected(config.getProperty("useHostList").equals("1"));
375 >        _name.setText(_config.getProperty("clientname"));
376 >        _server.setText(_config.getProperty("control.server"));
377 >        _port.setText(_config.getProperty("control.port"));
378 >        _connectControl.setSelected(_config.getProperty("control.onstartconnect").equals("1"));
379 >        _connectData.setSelected(_config.getProperty("data.onstartconnect").equals("1"));
380 >        _firewallCommand.setText(_config.getProperty("firewall.command"));
381 >        _firewallCommand.moveCaretPosition(0);
382 >        _firewallWait.setText(_config.getProperty("firewall.commandwait"));
383 >        _firewallServer.setText(_config.getProperty("firewall.server"));
384 >        _displayQueue.setSelected(_config.getProperty("displayQueueInformation").equals("1"));
385 >        _displayExtra.setSelected(_config.getProperty("displayExtraData").equals("1"));
386 >        _packetDump.setSelected(_config.getProperty("packetDump").equals("1"));
387 >        _useFirewall.setSelected(_config.getProperty("useFirewall").equals("1"));
388 >        _hostDiscoveryMode.setSelected(_config.getProperty("hostDiscoveryMode").equals("1"));
389 >        _useHostList.setSelected(_config.getProperty("useHostList").equals("1"));
390 >        _queueLimit.setText(_config.getProperty("dataQueueSize"));
391          prepareLists();                
392      }
393      
394 <    
394 >    /**
395 >     * Displays the host lists in the host windows
396 >     * in alphabetical order
397 >     */
398      private void prepareLists() {
399 <        knownHostsModel = new DefaultListModel();
400 <        hostListModel = new DefaultListModel();
401 <        String configKnownHostsList = config.getProperty("knownHostsList");
402 <        String configHostList = config.getProperty("hostList");
399 >        _knownHostsData = new ArrayList();
400 >        _hostListData = new ArrayList();
401 >        String _configKnownHostsList = _config.getProperty("knownHostsList");
402 >        String _configHostList = _config.getProperty("hostList");
403          StringTokenizer st;
404 <        st = new StringTokenizer(configKnownHostsList, ";");
404 >        st = new StringTokenizer(_configKnownHostsList, ";");
405          while(st.hasMoreTokens()) {
406              // check its not in the other list...as we only want one entry in the two
407              String knownHost = st.nextToken();
408 <            if(configHostList.indexOf(knownHost) == -1) knownHostsModel.addElement(knownHost);
408 >            if(_configHostList.indexOf(knownHost) == -1) _knownHostsData.add(knownHost);
409          }
410 <        st = new StringTokenizer(configHostList, ";");
410 >        st = new StringTokenizer(_configHostList, ";");
411          while(st.hasMoreTokens()) {
412 <            hostListModel.addElement(st.nextToken());
412 >            _hostListData.add(st.nextToken());
413          }
414 <        knownHosts.setModel(knownHostsModel);
370 <        hostList.setModel(hostListModel);
414 >        setListDisplay();
415      }
416      
417 +    /**
418 +     * Because of the limitation of the existing
419 +     * data model for lists, ArrayLists are used.
420 +     * Whenever the data in these lists is changed,
421 +     * this method is called to re-sort the lists
422 +     * and reset the display.
423 +     */
424 +    private void setListDisplay() {
425 +        // ensure the order
426 +        Collections.sort(_hostListData);
427 +        Collections.sort(_knownHostsData);
428 +        
429 +        _knownHosts.setListData(_knownHostsData.toArray());
430 +        _hostList.setListData(_hostListData.toArray());
431 +    }
432 +    
433 +    /**
434 +     * Writes the changes back to the loaded configuration
435 +     * Then closes the windows
436 +     */
437      private void setNewSettingsAndClose() {
438          
439 <        config.setProperty("clientname", name.getText().trim());
440 <        config.setProperty("control.server", server.getText().trim());
441 <        config.setProperty("control.port", port.getText().trim());
442 <        config.setProperty("firewall.command", firewallCommand.getText().trim());
443 <        config.setProperty("firewall.commandwait", firewallWait.getText().trim());
444 <        config.setProperty("firewall.server", firewallServer.getText().trim());
445 <        if (useFirewall.isSelected()) {
446 <            config.setProperty("useFirewall", "1");
439 >        _config.setProperty("clientname", _name.getText().trim());
440 >        _config.setProperty("control.server", _server.getText().trim());
441 >        _config.setProperty("control.port", _port.getText().trim());
442 >        _config.setProperty("firewall.command", _firewallCommand.getText().trim());
443 >        _config.setProperty("firewall.commandwait", _firewallWait.getText().trim());
444 >        _config.setProperty("firewall.server", _firewallServer.getText().trim());
445 >        _config.setProperty("dataQueueSize", _queueLimit.getText().trim());
446 >        if (_useFirewall.isSelected()) {
447 >            _config.setProperty("useFirewall", "1");
448          } else {
449 <            config.setProperty("useFirewall", "0");
449 >            _config.setProperty("useFirewall", "0");
450          }
451 <        if (connectControl.isSelected()) {
452 <            config.setProperty("control.onstartconnect", "1");
451 >        if (_connectControl.isSelected()) {
452 >            _config.setProperty("control.onstartconnect", "1");
453          } else {
454 <            config.setProperty("control.onstartconnect", "0");
454 >            _config.setProperty("control.onstartconnect", "0");
455          }
456 <        if (connectData.isSelected()) {
457 <            config.setProperty("data.onstartconnect", "1");
456 >        if (_connectData.isSelected()) {
457 >            _config.setProperty("data.onstartconnect", "1");
458          } else {
459 <            config.setProperty("data.onstartconnect", "0");
459 >            _config.setProperty("data.onstartconnect", "0");
460          }
461 <        if (packetDump.isSelected()) {
462 <            config.setProperty("packetDump", "1");
461 >        if (_packetDump.isSelected()) {
462 >            _config.setProperty("packetDump", "1");
463          } else {
464 <            config.setProperty("packetDump", "0");
464 >            _config.setProperty("packetDump", "0");
465          }
466 <        if (displayExtra.isSelected()) {
467 <            config.setProperty("displayExtraData", "1");
466 >        if (_displayExtra.isSelected()) {
467 >            _config.setProperty("displayExtraData", "1");
468          } else {
469 <            config.setProperty("displayExtraData", "0");
469 >            _config.setProperty("displayExtraData", "0");
470          }
471 <        if (displayQueue.isSelected()) {
472 <            config.setProperty("displayQueueInformation", "1");
471 >        if (_displayQueue.isSelected()) {
472 >            _config.setProperty("displayQueueInformation", "1");
473          } else {
474 <            config.setProperty("displayQueueInformation", "0");
474 >            _config.setProperty("displayQueueInformation", "0");
475          }
476 <        if (useHostList.isSelected()) {
477 <            config.setProperty("useHostList", "1");
476 >        if (_useHostList.isSelected()) {
477 >            _config.setProperty("useHostList", "1");
478          } else {
479 <            config.setProperty("useHostList", "0");
479 >            _config.setProperty("useHostList", "0");
480          }
481 <        if (hostDiscoveryMode.isSelected()) {
482 <            config.setProperty("hostDiscoveryMode", "1");
481 >        if (_hostDiscoveryMode.isSelected()) {
482 >            _config.setProperty("hostDiscoveryMode", "1");
483          } else {
484 <            config.setProperty("hostDiscoveryMode", "0");
484 >            _config.setProperty("hostDiscoveryMode", "0");
485          }
486          
487          // sort out the hosts lists
488          
489          // known hosts are both the known hosts list AND the host list
490 <        // first the hostlist...
491 <        Object[] hostListSaveArray =  hostListModel.toArray();
492 <        String hostListSave = "";
493 <        for(int x = 0; x < hostListSaveArray.length; x++) {
494 <            hostListSave += (String) hostListSaveArray[x] + ";";
490 >        // first the hostList...
491 >        Iterator i;
492 >        i = _hostListData.iterator();
493 >        String _hostListSave = "";
494 >        while(i.hasNext()) {
495 >            _hostListSave += (String) i.next() + ";";
496          }
497 <        Object[] knownHostsListSaveArray = knownHostsModel.toArray();
498 <        String knownHostsListSave = "";
499 <        for(int x = 0; x < knownHostsListSaveArray.length; x++) {
500 <            knownHostsListSave += (String) knownHostsListSaveArray[x] + ";";
497 >        
498 >        i = _knownHostsData.iterator();
499 >        String _knownHostsListSave = "";
500 >        while(i.hasNext()) {
501 >            _knownHostsListSave += (String) i.next() + ";";
502          }
503 <        knownHostsListSave += hostListSave;
504 <        config.setProperty("hostList", hostListSave);
505 <        config.setProperty("knownHostsList", knownHostsListSave);
503 >        
504 >        _knownHostsListSave += _hostListSave;
505 >        _config.setProperty("hostList", _hostListSave);
506 >        _config.setProperty("knownHostsList", _knownHostsListSave);
507          dispose();
508      }
509  
# Line 443 | Line 511 | public class ConfigurationDialog extends JDialog {
511  
512   //---ATTRIBUTES---
513  
514 <    Configuration config = Configuration.getInstance();
515 <
516 <    private JTextField newHost;
514 >    /**
515 >     * A reference to the configuration in use
516 >     */
517 >    Configuration _config = Configuration.getInstance();
518      
519 <    private JList knownHosts;
520 <    private JList hostList;
521 <    private JCheckBox hostDiscoveryMode;
522 <    private JCheckBox useHostList;
523 <    private JTextField name;
524 <    private JTextField port;
525 <    private JTextField server;
526 <    private JCheckBox connectControl;
527 <    private JCheckBox connectData;
528 <    private JCheckBox useFirewall;
529 <    private JTextField firewallCommand;
530 <    private JTextField firewallWait;
531 <    private JTextField firewallServer;
532 <    private JCheckBox displayQueue;
533 <    private JCheckBox displayExtra;
534 <    private JCheckBox packetDump;
535 <
536 <    private DefaultListModel knownHostsModel;
537 <    private DefaultListModel hostListModel;
519 >    /**
520 >     * Used to add a new host to the known host list
521 >     */
522 >    private JTextField _newHost;
523 >    
524 >    /**
525 >     * Lists the known hosts (less the ones we're monitoring)
526 >     */
527 >    private JList _knownHosts;
528 >    
529 >    /**
530 >     * The list of hosts we're monitoring
531 >     */
532 >    private JList _hostList;
533 >    
534 >    /**
535 >     * If we are making a note of the hosts the server
536 >     * sends us.
537 >     */
538 >    private JCheckBox _hostDiscoveryMode;
539 >    
540 >    /**
541 >     * If we are using the host list setting to only view data
542 >     * from certain hosts
543 >     */
544 >    private JCheckBox _useHostList;
545 >    
546 >    /**
547 >     * The name to identify this client to the server
548 >     */
549 >    private JTextField _name;
550 >    
551 >    /**
552 >     * The _port the i-scream _server is running on
553 >     */
554 >    private JTextField _port;
555 >    
556 >    /**
557 >     * The host_name of the i-scream server
558 >     */
559 >    private JTextField _server;
560 >    
561 >    /**
562 >     * If we want to start the control channel on startup
563 >     */
564 >    private JCheckBox _connectControl;
565 >    
566 >    /**
567 >     * If we want to start the data channel on startup
568 >     */
569 >    private JCheckBox _connectData;
570 >    
571 >    /**
572 >     * If we want to use the firewall command to connect
573 >     */
574 >    private JCheckBox _useFirewall;
575 >    
576 >    /**
577 >     * The command to run to open a pipe to the iscream server
578 >     */
579 >    private JTextField _firewallCommand;
580 >    
581 >    /**
582 >     * How long to wait for the firewall command to execute
583 >     */
584 >    private JTextField _firewallWait;
585 >    
586 >    /**
587 >     * The name of the machine to locally connect through to
588 >     * reach the i-scream server
589 >     */
590 >    private JTextField _firewallServer;
591 >    
592 >    /**
593 >     * Whether to display server queue debugging information
594 >     */
595 >    private JCheckBox _displayQueue;
596 >    
597 >    /**
598 >     * Whether to display extra data contained in packets
599 >     */
600 >    private JCheckBox _displayExtra;
601 >    
602 >    /**
603 >     * Whether to dump raw packet data to the console
604 >     */
605 >    private JCheckBox _packetDump;
606 >    
607 >    /**
608 >     * The limit on the data queue size
609 >     */
610 >    private JTextField _queueLimit;
611 >    
612 >    /**
613 >     * holds the known hosts
614 >     */
615 >    private ArrayList _knownHostsData;
616 >    
617 >    /**
618 >     * holds the monitored hosts
619 >     */
620 >    private ArrayList _hostListData;
621  
622   //---STATIC ATTRIBUTES---
623  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines