File Source: CommunicationStep.java
/*
P/P * Method: com.dmdirc.addons.ui_swing.wizard.firstrun.CommunicationStep__static_init
*/
1 /*
2 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.dmdirc.addons.ui_swing.wizard.firstrun;
24
25 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
26 import com.dmdirc.addons.ui_swing.wizard.Step;
27
28 import javax.swing.JCheckBox;
29
30 import net.miginfocom.swing.MigLayout;
31
32 /**
33 * Sets communication options.
34 */
35 public final class CommunicationStep extends Step {
36
37 /**
38 * A version number for this class. It should be changed whenever the class
39 * structure is changed (or anything else that would prevent serialized
40 * objects being unserialized with the new class).
41 */
42 private static final long serialVersionUID = 1;
43 /** Update info. */
44 private TextLabel updatesInfo;
45 /** Update checker. */
46 private JCheckBox updates;
47 /** Error reports info. */
48 private TextLabel errorsInfo;
49 /** Error reports. */
50 private JCheckBox errors;
51
52 /**
53 * Creates a new instance of SetupStep.
54 */
55 public CommunicationStep() {
/*
P/P * Method: void com.dmdirc.addons.ui_swing.wizard.firstrun.CommunicationStep()
*
* Postconditions:
* this.errors == &new JCheckBox(initComponents#4)
* this.errorsInfo == &new TextLabel(initComponents#3)
* this.updates == &new JCheckBox(initComponents#2)
* this.updatesInfo == &new TextLabel(initComponents#1)
* new JCheckBox(initComponents#2) num objects == 1
* new JCheckBox(initComponents#4) num objects == 1
* new TextLabel(initComponents#1) num objects == 1
* new TextLabel(initComponents#3) num objects == 1
*/
56 super();
57
58 initComponents();
59 layoutComponents();
60 }
61
62 /**
63 * Initialises the components.
64 */
65 protected void initComponents() {
/*
P/P * Method: void initComponents()
*
* Postconditions:
* this.errors == &new JCheckBox(initComponents#4)
* this.errorsInfo == &new TextLabel(initComponents#3)
* this.updates == &new JCheckBox(initComponents#2)
* this.updatesInfo == &new TextLabel(initComponents#1)
* new JCheckBox(initComponents#2) num objects == 1
* new JCheckBox(initComponents#4) num objects == 1
* new TextLabel(initComponents#1) num objects == 1
* new TextLabel(initComponents#3) num objects == 1
*/
66 updatesInfo =
67 new TextLabel("DMDirc can automatically check for " +
68 "updates for various parts of the client, you can globally " +
69 "disable that behaviour here, you can also fine tune the " +
70 "behaviour in the preferences dialog once the client is running.");
71 updates = new JCheckBox("Enable update checks?", true);
72 errorsInfo = new TextLabel("DMDirc will automatically report application " +
73 "errors to the developers, whilst this is of great help to the developers " +
74 "you may disable this behaviour here.");
75 errors = new JCheckBox("Enable error reporting?", true);
76 }
77
78 /**
79 * Lays out the components.
80 */
81 private void layoutComponents() {
/*
P/P * Method: void layoutComponents()
*
* Preconditions:
* init'ed(this.errors)
* init'ed(this.errorsInfo)
* init'ed(this.updates)
* init'ed(this.updatesInfo)
*/
82 setLayout(new MigLayout("fillx, wrap 1"));
83
84 add(updatesInfo, "growx, pushx");
85 add(updates, "");
86 add(errorsInfo, "growx, pushx");
87 add(errors, "");
88 }
89
90 /**
91 * Checks if updates are enabled.
92 *
93 * @return true iif updates are enabled
94 */
95 public boolean checkUpdates() {
/*
P/P * Method: bool checkUpdates()
*
* Preconditions:
* this.updates != null
*
* Postconditions:
* init'ed(return_value)
*/
96 return updates.isSelected();
97 }
98
99 /**
100 * Checks if error reports are enabled.
101 *
102 * @return true iif error reports are enabled
103 */
104 public boolean checkErrors() {
/*
P/P * Method: bool checkErrors()
*
* Preconditions:
* this.updates != null
*
* Postconditions:
* init'ed(return_value)
*/
105 return updates.isSelected();
106 }
107
108 /** {@inheritDoc} */
109 @Override
110 public String getTitle() {
/*
P/P * Method: String getTitle()
*
* Postconditions:
* return_value == &"Communication settings"
*/
111 return "Communication settings";
112 }
113 }
SofCheck Inspector Build Version : 2.17854
| CommunicationStep.java |
2009-Jun-25 01:54:24 |
| CommunicationStep.class |
2009-Sep-02 17:04:16 |