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.10 by ajm, Thu Mar 22 01:19:04 2001 UTC

# Line 13 | Line 13 | import java.util.StringTokenizer;
13   * This provides a modal dialog from which the user
14   * can reconfigure the conient client.
15   *
16 < * It then writes back the configuration to the file.
16 > * Look at the comments for the attributes of this class to see
17 > * what configuration options this class deals with.
18   *
19 < * Server configured options are displayed, but are
20 < * for information purposes only, and cannot be changed.
19 > * It then writes back the configuration to the loaded configuration.
20 > * The user can then opt to save it.
21   *
22 + *
23   * @author  $Author$
24   * @version $Id$
25   */
# Line 93 | Line 95 | public class ConfigurationDialog extends JDialog {
95  
96   //---PRIVATE METHODS---
97    
98 +    /**
99 +     * creates a JPanel for the client options
100 +     *
101 +     * @return the build panel with the options
102 +     */
103      private JPanel createClientOptions() {
104          GridBagLayout gridbag = new GridBagLayout();
105          GridBagLayout gridbag2 = new GridBagLayout();
# Line 218 | Line 225 | public class ConfigurationDialog extends JDialog {
225          clientPanel.add(lists);
226          return clientPanel;
227      }
228 <
228 >    
229 >    /**
230 >     * creates a JPanel for the server options
231 >     *
232 >     * @return the build panel with the options
233 >     */
234      private JPanel createServerOptions() {
235          GridBagLayout gridbag = new GridBagLayout();
236          GridBagConstraints c = new GridBagConstraints();
237          c.fill = GridBagConstraints.HORIZONTAL;
238          JPanel serverPanel = new JPanel();
239          serverPanel.setLayout(gridbag);
240 +        connectControl = new JCheckBox("Automatically connect the control channel");
241 +        c.gridy = 0;
242 +        gridbag.setConstraints(connectControl, c);
243 +        serverPanel.add(connectControl);
244 +        connectData = new JCheckBox("Automatically connect the data channel");
245 +        c.gridy = 1;
246 +        gridbag.setConstraints(connectData, c);
247 +        serverPanel.add(connectData);
248          JLabel serverLabel = new JLabel("i-scream Server:");
249          serverLabel.setHorizontalAlignment(JLabel.RIGHT);
250          server = new JTextField(20);
# Line 232 | Line 252 | public class ConfigurationDialog extends JDialog {
252          serverBox.setLayout(new GridLayout(1,2));
253          serverBox.add(serverLabel);
254          serverBox.add(server);
255 <        c.gridy = 0;
255 >        c.gridy = 2;
256          gridbag.setConstraints(serverBox, c);
257          serverPanel.add(serverBox);
258          JLabel portLabel = new JLabel("Client interface port:");
# Line 242 | Line 262 | public class ConfigurationDialog extends JDialog {
262          portBox.setLayout(new GridLayout(1,2));
263          portBox.add(portLabel);
264          portBox.add(port);
265 <        c.gridy = 1;
265 >        c.gridy = 3;
266          gridbag.setConstraints(portBox, c);
267          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);
268          return serverPanel;
269      }
270  
271 +    /**
272 +     * creates a JPanel for the firewall options
273 +     *
274 +     * @return the build panel with the options
275 +     */
276      private JPanel createFirewallOptions() {
277          GridBagLayout gridbag = new GridBagLayout();
278          GridBagConstraints c = new GridBagConstraints();
# Line 272 | Line 289 | public class ConfigurationDialog extends JDialog {
289          JLabel commandLabel = new JLabel("Firewall command:");
290          commandLabel.setHorizontalAlignment(JLabel.RIGHT);
291          firewallCommand = new JTextField(20);
275        firewallCommand.setSize(new Dimension(1,10));
292          JPanel commandBox = new JPanel();
293          commandBox.setLayout(new GridLayout(1,2));
294          commandBox.add(commandLabel);
# Line 309 | Line 325 | public class ConfigurationDialog extends JDialog {
325          return firewallPanel;
326      }
327  
328 +    /**
329 +     * creates a JPanel for the data options
330 +     *
331 +     * @return the build panel with the options
332 +     */
333      private JPanel createDataOptions() {
334          GridBagLayout gridbag = new GridBagLayout();
335          GridBagConstraints c = new GridBagConstraints();
# Line 327 | Line 348 | public class ConfigurationDialog extends JDialog {
348          c.gridy = 2;
349          gridbag.setConstraints(packetDump, c);
350          dataPanel.add(packetDump);
351 +        
352 +        JLabel queueLimitLabel = new JLabel("Maximum data queue size:");
353 +        queueLimitLabel.setHorizontalAlignment(JLabel.RIGHT);
354 +        queueLimit = new JTextField(4);
355 +        JPanel queueBox = new JPanel();
356 +        queueBox.setLayout(new GridLayout(1,2));
357 +        queueBox.add(queueLimitLabel);
358 +        queueBox.add(queueLimit);
359 +        c.gridy = 3;
360 +        gridbag.setConstraints(queueBox, c);
361 +        dataPanel.add(queueBox);
362          return dataPanel;
363      }
364      
365 +    /**
366 +     * Reads in the current settings from the loaded configuration
367 +     */
368      private void getCurrentSettings() {
369          name.setText(config.getProperty("clientname"));
370          server.setText(config.getProperty("control.server"));
# Line 346 | Line 381 | public class ConfigurationDialog extends JDialog {
381          useFirewall.setSelected(config.getProperty("useFirewall").equals("1"));
382          hostDiscoveryMode.setSelected(config.getProperty("hostDiscoveryMode").equals("1"));
383          useHostList.setSelected(config.getProperty("useHostList").equals("1"));
384 +        queueLimit.setText(config.getProperty("dataQueueSize"));
385          prepareLists();                
386      }
387      
388 <    
388 >    /**
389 >     * Displays the host lists in the host windows
390 >     */
391      private void prepareLists() {
392          knownHostsModel = new DefaultListModel();
393          hostListModel = new DefaultListModel();
# Line 370 | Line 408 | public class ConfigurationDialog extends JDialog {
408          hostList.setModel(hostListModel);
409      }
410      
411 +    /**
412 +     * Writes the changes back to the loaded configuration
413 +     * Then closes the windows
414 +     */
415      private void setNewSettingsAndClose() {
416          
417          config.setProperty("clientname", name.getText().trim());
# Line 378 | Line 420 | public class ConfigurationDialog extends JDialog {
420          config.setProperty("firewall.command", firewallCommand.getText().trim());
421          config.setProperty("firewall.commandwait", firewallWait.getText().trim());
422          config.setProperty("firewall.server", firewallServer.getText().trim());
423 +        config.setProperty("dataQueueSize", queueLimit.getText().trim());
424          if (useFirewall.isSelected()) {
425              config.setProperty("useFirewall", "1");
426          } else {
# Line 443 | Line 486 | public class ConfigurationDialog extends JDialog {
486  
487   //---ATTRIBUTES---
488  
489 +    /**
490 +     * A reference to the configuration in use
491 +     */
492      Configuration config = Configuration.getInstance();
493 <
493 >    
494 >    /**
495 >     * Used to add a new host to the known host list
496 >     */
497      private JTextField newHost;
498      
499 +    /**
500 +     * Lists the known hosts (less the ones we're monitoring)
501 +     */
502      private JList knownHosts;
503 +    
504 +    /**
505 +     * The list of hosts we're monitoring
506 +     */
507      private JList hostList;
508 +    
509 +    /**
510 +     * If we are making a note of the hosts the server
511 +     * sends us.
512 +     */
513      private JCheckBox hostDiscoveryMode;
514 +    
515 +    /**
516 +     * If we are using the host list setting to only view data
517 +     * from certain hosts
518 +     */
519      private JCheckBox useHostList;
520 +    
521 +    /**
522 +     * The name to identify this client to the server
523 +     */
524      private JTextField name;
525 +    
526 +    /**
527 +     * The port the i-scream server is running on
528 +     */
529      private JTextField port;
530 +    
531 +    /**
532 +     * The hostname of the i-scream server
533 +     */
534      private JTextField server;
535 +    
536 +    /**
537 +     * If we want to start the control channel on startup
538 +     */
539      private JCheckBox connectControl;
540 +    
541 +    /**
542 +     * If we want to start the data channel on startup
543 +     */
544      private JCheckBox connectData;
545 +    
546 +    /**
547 +     * If we want to use the firewall command to connect
548 +     */
549      private JCheckBox useFirewall;
550 +    
551 +    /**
552 +     * The command to run to open a pipe to the iscream server
553 +     */
554      private JTextField firewallCommand;
555 +    
556 +    /**
557 +     * How long to wait for the firewall command to execute
558 +     */
559      private JTextField firewallWait;
560 +    
561 +    /**
562 +     * The name of the machine to locally connect through to
563 +     * reach the i-scream server
564 +     */
565      private JTextField firewallServer;
566 +    
567 +    /**
568 +     * Whether to display server queue debugging information
569 +     */
570      private JCheckBox displayQueue;
571 +    
572 +    /**
573 +     * Whether to display extra data contained in packets
574 +     */
575      private JCheckBox displayExtra;
576 +    
577 +    /**
578 +     * Whether to dump raw packet data to the console
579 +     */
580      private JCheckBox packetDump;
581 <
581 >    
582 >    /**
583 >     * The limit on the data queue size
584 >     */
585 >    private JTextField queueLimit;
586 >    
587 >    /**
588 >     * holds the known hosts
589 >     */
590      private DefaultListModel knownHostsModel;
591 +    
592 +    /**
593 +     * holds the monitored hosts
594 +     */
595      private DefaultListModel hostListModel;
596  
597   //---STATIC ATTRIBUTES---

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines