1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 package com.buckosoft.fibs.BuckoFIBS.gui;
50
51 import java.awt.Color;
52 import java.awt.Dimension;
53 import java.awt.Font;
54 import java.awt.GridBagConstraints;
55 import java.awt.GridBagLayout;
56 import java.awt.Insets;
57
58 import javax.swing.BorderFactory;
59 import javax.swing.JButton;
60 import javax.swing.JCheckBox;
61 import javax.swing.JDialog;
62 import javax.swing.JFrame;
63 import javax.swing.JLabel;
64 import javax.swing.JPanel;
65 import javax.swing.border.BevelBorder;
66 import javax.swing.border.EtchedBorder;
67
68 import com.buckosoft.fibs.BuckoFIBS.BFProperties;
69 import com.buckosoft.fibs.BuckoFIBS.CommandDispatcher;
70
71
72
73
74
75
76
77 public class PreferencesForMessagesDialog extends JDialog {
78 private static final long serialVersionUID = 1L;
79 private CommandDispatcher commandDispatcher;
80 private BFProperties properties;
81
82 private JPanel jContentPane = null;
83 private JPanel jPanelPrefs = null;
84 private JLabel jLabel = null;
85 private JLabel jLabel1 = null;
86 private JCheckBox jCheckBoxIgnoreShouts = null;
87 private JLabel jLabel2 = null;
88 private JCheckBox jCheckBoxShowGameMoves = null;
89 private JLabel jLabel3 = null;
90 private JCheckBox jCheckBoxOtherMatchesInfo = null;
91 private JLabel jLabel4 = null;
92 private JCheckBox jCheckBoxLoginsAndOuts = null;
93 private JPanel jPanelOkCancel = null;
94 private JButton jButtonOK = null;
95 private JButton jButtonCancel = null;
96 private JPanel jPanelPrefsDebug = null;
97 private JLabel jLabelShowAllReceivedMessages = null;
98 private JCheckBox jCheckBoxShowAllReceivedMessages = null;
99 private JLabel jLabelDebugLabel = null;
100 private JLabel jLabelShowAllTransmittedMessages = null;
101 private JCheckBox jCheckBoxShowAllTransmittedMessages = null;
102 private JLabel jLabelShowUnhandledCookies = null;
103 private JCheckBox jCheckBoxShowUnhandledCookies = null;
104 private JLabel jLabel5 = null;
105 private JCheckBox jCheckBoxStdoutNetMessages = null;
106 private JLabel jLabelShowAnimatePath = null;
107 private JCheckBox jCheckBoxShowAnimatePath = null;
108
109
110
111
112
113 public PreferencesForMessagesDialog() {
114 super();
115 initialize();
116 }
117
118
119
120
121
122
123 public PreferencesForMessagesDialog(JFrame owner, CommandDispatcher commandDispatcher) {
124 super(owner, true);
125 this.commandDispatcher = commandDispatcher;
126 this.properties = commandDispatcher.getProperties();
127 initialize();
128 this.setLocationRelativeTo(owner);
129
130 BFProperties props = this.commandDispatcher.getProperties();
131 this.jCheckBoxIgnoreShouts.getModel().setSelected(props.isMsgIgnoreShouts());
132 this.jCheckBoxShowGameMoves.getModel().setSelected(props.isMsgShowGameMoves());
133 this.jCheckBoxOtherMatchesInfo.getModel().setSelected(props.isMsgOtherMatchInfo());
134 this.jCheckBoxLoginsAndOuts.getModel().setSelected(props.isMsgLoginsAndOuts());
135
136 this.jCheckBoxShowAllReceivedMessages.getModel().setSelected(props.isDisplayRecv());
137 this.jCheckBoxShowAllTransmittedMessages.getModel().setSelected(props.isDisplayXmit());
138 this.jCheckBoxShowUnhandledCookies.getModel().setSelected(props.isDEBUG_ShowUnhandledCookies());
139 this.jCheckBoxStdoutNetMessages.getModel().setSelected(props.isStdoutNetworkMessages());
140 this.jCheckBoxShowAnimatePath.getModel().setSelected(props.isDEBUG_ShowAnimatePath());
141 }
142
143 private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
144 setVisible(false);
145 this.properties.setMsgIgnoreShouts(this.jCheckBoxIgnoreShouts.getModel().isSelected());
146 this.properties.setMsgShowGameMoves(this.jCheckBoxShowGameMoves.getModel().isSelected());
147 this.properties.setMsgOtherMatchInfo(this.jCheckBoxOtherMatchesInfo.getModel().isSelected());
148 this.properties.setMsgLoginsAndOuts(this.jCheckBoxLoginsAndOuts.getModel().isSelected());
149
150 this.properties.setDisplayRecv(this.jCheckBoxShowAllReceivedMessages.getModel().isSelected());
151 this.properties.setDisplayXmit(this.jCheckBoxShowAllTransmittedMessages.getModel().isSelected());
152 this.properties.setDEBUG_ShowUnhandledCookies(this.jCheckBoxShowUnhandledCookies.getModel().isSelected());
153 this.properties.setStdoutNetworkMessages(this.jCheckBoxStdoutNetMessages.getModel().isSelected());
154 this.properties.setDEBUG_ShowAnimatePath(this.jCheckBoxShowAnimatePath.getModel().isSelected());
155 dispose();
156 }
157
158 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
159 setVisible(false);
160 dispose();
161 }
162
163
164
165
166
167 private void initialize() {
168 this.setSize(new Dimension(339, 330));
169 this.setTitle("Message Preferences");
170 this.setContentPane(getJContentPane());
171
172 }
173
174
175
176
177
178
179 private JPanel getJContentPane() {
180 if (jContentPane == null) {
181 GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
182 gridBagConstraints13.gridx = 1;
183 gridBagConstraints13.gridy = 1;
184 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
185 gridBagConstraints12.gridx = 1;
186 gridBagConstraints12.anchor = GridBagConstraints.SOUTH;
187 gridBagConstraints12.weighty = 0.2;
188 gridBagConstraints12.gridy = 2;
189 jLabel1 = new JLabel();
190 jLabel1.setText("Ignore Shouts");
191 jLabel = new JLabel();
192 jLabel.setText("Settings:");
193 jLabel.setForeground(new Color(102, 102, 0));
194 jLabel.setFont(new Font("Dialog", Font.BOLD, 14));
195 GridBagConstraints gridBagConstraints = new GridBagConstraints();
196 gridBagConstraints.gridx = 1;
197 gridBagConstraints.weighty = 0.2;
198 gridBagConstraints.gridy = 0;
199 jContentPane = new JPanel();
200 jContentPane.setLayout(new GridBagLayout());
201 jContentPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
202 jContentPane.add(getJPanelPrefs(), gridBagConstraints);
203 jContentPane.add(getJPanelOkCancel(), gridBagConstraints12);
204 jContentPane.add(getJPanelPrefsDebug(), gridBagConstraints13);
205 }
206 return jContentPane;
207 }
208
209
210
211
212
213
214 private JPanel getJPanelPrefs() {
215 if (jPanelPrefs == null) {
216 GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
217 gridBagConstraints9.gridx = 1;
218 gridBagConstraints9.gridy = 4;
219 GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
220 gridBagConstraints8.gridx = 0;
221 gridBagConstraints8.anchor = GridBagConstraints.WEST;
222 gridBagConstraints8.gridy = 4;
223 jLabel4 = new JLabel();
224 jLabel4.setText("Who is logging in and out");
225 GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
226 gridBagConstraints7.gridx = 1;
227 gridBagConstraints7.gridy = 3;
228 GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
229 gridBagConstraints6.gridx = 0;
230 gridBagConstraints6.anchor = GridBagConstraints.WEST;
231 gridBagConstraints6.gridy = 3;
232 jLabel3 = new JLabel();
233 jLabel3.setText("Info for Other Matches");
234 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
235 gridBagConstraints5.gridx = 1;
236 gridBagConstraints5.gridy = 2;
237 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
238 gridBagConstraints4.gridx = 0;
239 gridBagConstraints4.anchor = GridBagConstraints.WEST;
240 gridBagConstraints4.gridy = 2;
241 jLabel2 = new JLabel();
242 jLabel2.setText("Show Game moves (dice rolls)");
243 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
244 gridBagConstraints3.gridx = 1;
245 gridBagConstraints3.gridy = 1;
246 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
247 gridBagConstraints2.gridx = 0;
248 gridBagConstraints2.anchor = GridBagConstraints.WEST;
249 gridBagConstraints2.gridy = 1;
250 GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
251 gridBagConstraints1.gridx = -1;
252 gridBagConstraints1.anchor = GridBagConstraints.WEST;
253 gridBagConstraints1.gridy = -1;
254 jPanelPrefs = new JPanel();
255 jPanelPrefs.setLayout(new GridBagLayout());
256 jPanelPrefs.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
257 jPanelPrefs.add(jLabel, gridBagConstraints1);
258 jPanelPrefs.add(jLabel1, gridBagConstraints2);
259 jPanelPrefs.add(getJCheckBoxIgnoreShouts(), gridBagConstraints3);
260 jPanelPrefs.add(jLabel2, gridBagConstraints4);
261 jPanelPrefs.add(getJCheckBoxShowGameMoves(), gridBagConstraints5);
262 jPanelPrefs.add(jLabel3, gridBagConstraints6);
263 jPanelPrefs.add(getJCheckBoxOtherMatchesInfo(), gridBagConstraints7);
264 jPanelPrefs.add(jLabel4, gridBagConstraints8);
265 jPanelPrefs.add(getJCheckBoxLoginsAndOuts(), gridBagConstraints9);
266 }
267 return jPanelPrefs;
268 }
269
270
271
272
273
274
275 private JCheckBox getJCheckBoxIgnoreShouts() {
276 if (jCheckBoxIgnoreShouts == null) {
277 jCheckBoxIgnoreShouts = new JCheckBox();
278 }
279 return jCheckBoxIgnoreShouts;
280 }
281
282
283
284
285
286
287 private JCheckBox getJCheckBoxShowGameMoves() {
288 if (jCheckBoxShowGameMoves == null) {
289 jCheckBoxShowGameMoves = new JCheckBox();
290 }
291 return jCheckBoxShowGameMoves;
292 }
293
294
295
296
297
298
299 private JCheckBox getJCheckBoxOtherMatchesInfo() {
300 if (jCheckBoxOtherMatchesInfo == null) {
301 jCheckBoxOtherMatchesInfo = new JCheckBox();
302 }
303 return jCheckBoxOtherMatchesInfo;
304 }
305
306
307
308
309
310
311 private JCheckBox getJCheckBoxLoginsAndOuts() {
312 if (jCheckBoxLoginsAndOuts == null) {
313 jCheckBoxLoginsAndOuts = new JCheckBox();
314 }
315 return jCheckBoxLoginsAndOuts;
316 }
317
318
319
320
321
322
323 private JPanel getJPanelOkCancel() {
324 if (jPanelOkCancel == null) {
325 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
326 gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
327 gridBagConstraints11.gridx = -1;
328 gridBagConstraints11.gridy = -1;
329 gridBagConstraints11.insets = new Insets(0, 15, 0, 0);
330 GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
331 gridBagConstraints10.anchor = GridBagConstraints.EAST;
332 gridBagConstraints10.insets = new Insets(0, 0, 0, 15);
333 gridBagConstraints10.gridx = -1;
334 gridBagConstraints10.gridy = -1;
335 gridBagConstraints10.weightx = 0.1;
336 gridBagConstraints10.fill = GridBagConstraints.HORIZONTAL;
337 jPanelOkCancel = new JPanel();
338 jPanelOkCancel.setLayout(new GridBagLayout());
339 jPanelOkCancel.add(getJButtonOK(), gridBagConstraints10);
340 jPanelOkCancel.add(getJButtonCancel(), gridBagConstraints11);
341 }
342 return jPanelOkCancel;
343 }
344
345
346
347
348
349
350 private JButton getJButtonOK() {
351 if (jButtonOK == null) {
352 jButtonOK = new JButton();
353 jButtonOK.setText("OK");
354 jButtonOK.addActionListener(new java.awt.event.ActionListener() {
355 public void actionPerformed(java.awt.event.ActionEvent e) {
356 okButtonActionPerformed(e);
357 }
358 });
359 }
360 return jButtonOK;
361 }
362
363
364
365
366
367
368 private JButton getJButtonCancel() {
369 if (jButtonCancel == null) {
370 jButtonCancel = new JButton();
371 jButtonCancel.setText("Cancel");
372 jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
373 public void actionPerformed(java.awt.event.ActionEvent e) {
374 cancelButtonActionPerformed(e);
375 }
376 });
377 }
378 return jButtonCancel;
379 }
380
381
382
383
384
385
386 private JPanel getJPanelPrefsDebug() {
387 if (jPanelPrefsDebug == null) {
388 GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
389 gridBagConstraints17.gridx = 1;
390 gridBagConstraints17.gridy = 6;
391 GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
392 gridBagConstraints14.gridx = 0;
393 gridBagConstraints14.anchor = GridBagConstraints.WEST;
394 gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
395 gridBagConstraints14.gridy = 6;
396 jLabelShowAnimatePath = new JLabel();
397 jLabelShowAnimatePath.setText("Show Animate Path");
398 GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
399 gridBagConstraints20.gridx = 1;
400 gridBagConstraints20.gridy = 5;
401 GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
402 gridBagConstraints19.anchor = GridBagConstraints.WEST;
403 gridBagConstraints19.gridy = 5;
404 gridBagConstraints19.gridx = 0;
405 jLabel5 = new JLabel();
406 jLabel5.setText("stdout Network Messages:");
407 GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
408 gridBagConstraints16.gridx = 1;
409 gridBagConstraints16.gridy = 3;
410 GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
411 gridBagConstraints15.anchor = GridBagConstraints.WEST;
412 gridBagConstraints15.gridy = 3;
413 gridBagConstraints15.gridx = 0;
414 jLabelShowUnhandledCookies = new JLabel();
415 jLabelShowUnhandledCookies.setText("Show unhandled FIBS cookies:");
416 GridBagConstraints gridBagConstraints91 = new GridBagConstraints();
417 gridBagConstraints91.gridx = 1;
418 gridBagConstraints91.gridy = 1;
419 GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
420 gridBagConstraints81.insets = new Insets(0, 0, 0, 10);
421 gridBagConstraints81.gridy = 1;
422 gridBagConstraints81.gridx = 0;
423 jLabelShowAllTransmittedMessages = new JLabel();
424 jLabelShowAllTransmittedMessages.setText("Show all Transmitted network messages:");
425 GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
426 gridBagConstraints71.anchor = GridBagConstraints.WEST;
427 gridBagConstraints71.gridy = 0;
428 gridBagConstraints71.gridx = 0;
429 jLabelDebugLabel = new JLabel();
430 jLabelDebugLabel.setFont(new Font("Dialog", Font.BOLD, 14));
431 jLabelDebugLabel.setText("Debug Settings:");
432 jLabelDebugLabel.setForeground(new Color(102, 102, 0));
433 GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
434 gridBagConstraints51.gridx = -1;
435 gridBagConstraints51.gridy = 2;
436 GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
437 gridBagConstraints41.anchor = GridBagConstraints.WEST;
438 gridBagConstraints41.gridy = 2;
439 gridBagConstraints41.gridx = -1;
440 jLabelShowAllReceivedMessages = new JLabel();
441 jLabelShowAllReceivedMessages.setText("Show all received Network Messages:");
442 jPanelPrefsDebug = new JPanel();
443 jPanelPrefsDebug.setLayout(new GridBagLayout());
444 jPanelPrefsDebug.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
445 jPanelPrefsDebug.add(jLabelShowAllReceivedMessages, gridBagConstraints41);
446 jPanelPrefsDebug.add(getJCheckBoxShowAllReceivedMessages(), gridBagConstraints51);
447 jPanelPrefsDebug.add(jLabelDebugLabel, gridBagConstraints71);
448 jPanelPrefsDebug.add(jLabelShowAllTransmittedMessages, gridBagConstraints81);
449 jPanelPrefsDebug.add(getJCheckBoxShowAllTransmittedMessages(), gridBagConstraints91);
450 jPanelPrefsDebug.add(jLabelShowUnhandledCookies, gridBagConstraints15);
451 jPanelPrefsDebug.add(getJCheckBoxShowUnhandledCookies(), gridBagConstraints16);
452 jPanelPrefsDebug.add(jLabel5, gridBagConstraints19);
453 jPanelPrefsDebug.add(getJCheckBoxStdoutNetMessages(), gridBagConstraints20);
454 jPanelPrefsDebug.add(jLabelShowAnimatePath, gridBagConstraints14);
455 jPanelPrefsDebug.add(getJCheckBoxShowAnimatePath(), gridBagConstraints17);
456 }
457 return jPanelPrefsDebug;
458 }
459
460
461
462
463
464
465 private JCheckBox getJCheckBoxShowAllReceivedMessages() {
466 if (jCheckBoxShowAllReceivedMessages == null) {
467 jCheckBoxShowAllReceivedMessages = new JCheckBox();
468 }
469 return jCheckBoxShowAllReceivedMessages;
470 }
471
472
473
474
475
476
477 private JCheckBox getJCheckBoxShowAllTransmittedMessages() {
478 if (jCheckBoxShowAllTransmittedMessages == null) {
479 jCheckBoxShowAllTransmittedMessages = new JCheckBox();
480 }
481 return jCheckBoxShowAllTransmittedMessages;
482 }
483
484
485
486
487
488
489 private JCheckBox getJCheckBoxShowUnhandledCookies() {
490 if (jCheckBoxShowUnhandledCookies == null) {
491 jCheckBoxShowUnhandledCookies = new JCheckBox();
492 }
493 return jCheckBoxShowUnhandledCookies;
494 }
495
496
497
498
499
500
501 private JCheckBox getJCheckBoxStdoutNetMessages() {
502 if (jCheckBoxStdoutNetMessages == null) {
503 jCheckBoxStdoutNetMessages = new JCheckBox();
504 }
505 return jCheckBoxStdoutNetMessages;
506 }
507
508
509
510
511
512
513 private JCheckBox getJCheckBoxShowAnimatePath() {
514 if (jCheckBoxShowAnimatePath == null) {
515 jCheckBoxShowAnimatePath = new JCheckBox();
516 }
517 return jCheckBoxShowAnimatePath;
518 }
519
520 }