1 |
//---PACKAGE DECLARATION--- |
2 |
package uk.ac.ukc.iscream.conient; |
3 |
|
4 |
//---IMPORTS--- |
5 |
import java.awt.Frame; |
6 |
import java.awt.Color; |
7 |
import java.awt.GridLayout; |
8 |
import java.awt.event.*; |
9 |
import javax.swing.*; |
10 |
import javax.swing.border.*; |
11 |
import java.util.Properties; |
12 |
|
13 |
/** |
14 |
* This provides a modal dialog from which the user |
15 |
* can reconfigure the conient client. |
16 |
* |
17 |
* It then writes back the configuration to the file. |
18 |
* |
19 |
* Server configured options are displayed, but are |
20 |
* for information purposes only, and cannot be changed. |
21 |
* |
22 |
* @author $Author: ajm4 $ |
23 |
* @version $Id: ConfigurationDialog.java,v 1.2 2001/02/21 23:37:38 ajm4 Exp $ |
24 |
*/ |
25 |
public class ConfigurationDialog extends JDialog { |
26 |
|
27 |
//---FINAL ATTRIBUTES--- |
28 |
|
29 |
/** |
30 |
* The current CVS revision of this class |
31 |
*/ |
32 |
public static final String REVISION = "$Revision: 1.2 $"; |
33 |
|
34 |
//---STATIC METHODS--- |
35 |
|
36 |
//---CONSTRUCTORS--- |
37 |
|
38 |
/** |
39 |
* Constructs and shows the dialog for the user |
40 |
*/ |
41 |
public ConfigurationDialog() { |
42 |
super(Conient.getFrame(), "Configuration Options", true); |
43 |
|
44 |
// setup the buttoms |
45 |
JPanel buttonPanel = new JPanel(); |
46 |
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); |
47 |
JButton ok = new JButton("OK"); |
48 |
JButton cancel = new JButton("Cancel12312123"); |
49 |
cancel.addActionListener(new ActionListener() { |
50 |
public void actionPerformed(ActionEvent e) { |
51 |
dispose(); |
52 |
} |
53 |
}); |
54 |
buttonPanel.add(Box.createHorizontalGlue()); |
55 |
buttonPanel.add(ok); |
56 |
buttonPanel.add(cancel); |
57 |
|
58 |
|
59 |
// setup the options panes |
60 |
JPanel center = new JPanel(); |
61 |
center.setLayout(new GridLayout(4,1)); |
62 |
|
63 |
// client options |
64 |
JPanel clientBorder = new JPanel(); |
65 |
clientBorder.setLayout(new BoxLayout(clientBorder, BoxLayout.Y_AXIS)); |
66 |
clientBorder.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), "Client ptions")); |
67 |
|
68 |
JLabel nameLabel = new JLabel("Client name:"); |
69 |
JTextField name = new JTextField(20); |
70 |
JPanel nameBox = new JPanel(); |
71 |
//nameBox.setLayout(new BoxLayout(nameBox, BoxLayout.X_AXIS)); |
72 |
//nameBox.add(Box.createGlue()); |
73 |
//nameBox.add(nameLabel); |
74 |
//nameBox.add(name); |
75 |
//nameBox.add(Box.createGlue()); |
76 |
|
77 |
clientBorder.add(name); |
78 |
clientBorder.add(Box.createGlue()); |
79 |
center.add(clientBorder); |
80 |
|
81 |
// server options |
82 |
JPanel serverPanel = new JPanel(); |
83 |
serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.Y_AXIS)); |
84 |
serverPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), "i-scream Server Options")); |
85 |
|
86 |
JLabel serverLabel = new JLabel("i-scream Server:"); |
87 |
JTextField server = new JTextField(20); |
88 |
Box serverBox = Box.createHorizontalBox(); |
89 |
serverBox.add(Box.createHorizontalGlue()); |
90 |
serverBox.add(serverLabel); |
91 |
serverBox.add(server); |
92 |
serverBox.add(Box.createHorizontalGlue()); |
93 |
serverPanel.add(serverBox); |
94 |
|
95 |
JLabel portLabel = new JLabel("Client interface port:"); |
96 |
JTextField port = new JTextField(4); |
97 |
Box portBox = Box.createHorizontalBox(); |
98 |
portBox.add(Box.createHorizontalGlue()); |
99 |
portBox.add(portLabel); |
100 |
portBox.add(port); |
101 |
portBox.add(Box.createHorizontalGlue()); |
102 |
serverPanel.add(portBox); |
103 |
|
104 |
JCheckBox connectControl = new JCheckBox("Automatically connect the control channel"); |
105 |
serverPanel.add(connectControl); |
106 |
JCheckBox connectData = new JCheckBox("Automatically connect the data channel"); |
107 |
serverPanel.add(connectData); |
108 |
|
109 |
serverPanel.add(Box.createVerticalGlue()); |
110 |
center.add(serverPanel); |
111 |
|
112 |
// firewall options |
113 |
JPanel firewallPanel = new JPanel(); |
114 |
firewallPanel.setLayout(new BoxLayout(firewallPanel, BoxLayout.Y_AXIS)); |
115 |
firewallPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), "Firewall Options")); |
116 |
|
117 |
JLabel commandLabel = new JLabel("Firewall command:"); |
118 |
JTextField command = new JTextField(20); |
119 |
Box commandBox = Box.createHorizontalBox(); |
120 |
commandBox.add(Box.createHorizontalGlue()); |
121 |
commandBox.add(commandLabel); |
122 |
commandBox.add(command); |
123 |
commandBox.add(Box.createHorizontalGlue()); |
124 |
firewallPanel.add(commandBox); |
125 |
|
126 |
JLabel waitLabel = new JLabel("Firewall wait time:"); |
127 |
JTextField wait = new JTextField(2); |
128 |
Box waitBox = Box.createHorizontalBox(); |
129 |
waitBox.add(Box.createHorizontalGlue()); |
130 |
waitBox.add(waitLabel); |
131 |
waitBox.add(wait); |
132 |
waitBox.add(Box.createHorizontalGlue()); |
133 |
firewallPanel.add(waitBox); |
134 |
|
135 |
JLabel fserverLabel = new JLabel("Firewall server:"); |
136 |
JTextField fserver = new JTextField(20); |
137 |
Box fserverBox = Box.createHorizontalBox(); |
138 |
fserverBox.add(Box.createHorizontalGlue()); |
139 |
fserverBox.add(fserverLabel); |
140 |
fserverBox.add(fserver); |
141 |
fserverBox.add(Box.createHorizontalGlue()); |
142 |
firewallPanel.add(fserverBox); |
143 |
|
144 |
firewallPanel.add(Box.createVerticalGlue()); |
145 |
center.add(firewallPanel); |
146 |
|
147 |
// data options |
148 |
JPanel dataPanel = new JPanel(); |
149 |
dataPanel.setLayout(new BoxLayout(dataPanel, BoxLayout.Y_AXIS)); |
150 |
dataPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), "Data Options")); |
151 |
JCheckBox displayQueue = new JCheckBox("Display server queue information"); |
152 |
dataPanel.add(displayQueue); |
153 |
JCheckBox displayExtra = new JCheckBox("Display extra data found in packets"); |
154 |
dataPanel.add(displayExtra); |
155 |
JCheckBox packetDump = new JCheckBox("Dump raw packet data to the console"); |
156 |
dataPanel.add(packetDump); |
157 |
|
158 |
dataPanel.add(Box.createVerticalGlue()); |
159 |
center.add(dataPanel); |
160 |
|
161 |
// set the window up |
162 |
this.getContentPane().add(buttonPanel, "South"); |
163 |
this.getContentPane().add(center, "Center"); |
164 |
pack(); |
165 |
setLocationRelativeTo(Conient.getFrame()); |
166 |
setVisible(true); |
167 |
} |
168 |
|
169 |
//---PUBLIC METHODS--- |
170 |
|
171 |
//---PRIVATE METHODS--- |
172 |
|
173 |
//---ACCESSOR/MUTATOR METHODS--- |
174 |
|
175 |
//---ATTRIBUTES--- |
176 |
|
177 |
//---STATIC ATTRIBUTES--- |
178 |
|
179 |
} |