Line | Hits | Source |
---|---|---|
1 | /******************************************************************************* | |
2 | *InternetCafe is a software solution that helps the management of Cybercafes | |
3 | * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005. | |
4 | * Copyright (C) 2006 Guido Angelo Ingenito | |
5 | ||
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | ||
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | *******************************************************************************/ | |
20 | ||
21 | package base.jdbs.ui.panel; | |
22 | ||
23 | import java.awt.BorderLayout; | |
24 | import java.awt.GridLayout; | |
25 | import java.awt.event.ActionEvent; | |
26 | import java.awt.event.ActionListener; | |
27 | ||
28 | import javax.swing.JComboBox; | |
29 | import javax.swing.JPanel; | |
30 | import javax.swing.border.TitledBorder; | |
31 | ||
32 | import org.apache.log4j.Logger; | |
33 | ||
34 | import base.jdbs.ConfigurationManager; | |
35 | import base.jdbs.NetworkConnectionType; | |
36 | ||
37 | /** | |
38 | * @author skunk | |
39 | * | |
40 | */ | |
41 | 0 | @SuppressWarnings("serial") |
42 | 0 | public class NetworkConfigurationPanel extends JPanel { |
43 | 0 | |
44 | 0 | private static final transient Logger logger = Logger |
45 | .getLogger(NetworkConfigurationPanel.class.getName()); | |
46 | ||
47 | /** | |
48 | * This is the panel where will be shown the default replication level for | |
49 | * each created backup artifact.* | |
50 | */ | |
51 | private JPanel replicationLevelPanel; | |
52 | ||
53 | private JComboBox replicationLevelComboBox; | |
54 | ||
55 | /** | |
56 | * This is the defalut number of upload slots to be grant to other jdbs | |
57 | * users.* | |
58 | */ | |
59 | 0 | private JPanel uploadSlotPanel; |
60 | ||
61 | private JComboBox uploadSlotComboBox; | |
62 | 0 | |
63 | 0 | /** This is the default number of download slots to be grant to the peer.* */ |
64 | 0 | private JPanel downloadSlotPanel; |
65 | ||
66 | private JComboBox downloadSlotComboBox; | |
67 | 0 | |
68 | 0 | /** This is the peer connection type, one between LAN T1, T2, 56Kb etc...* */ |
69 | 0 | private JPanel connectionTypePanel; |
70 | 0 | |
71 | 0 | private JComboBox connectionTypeComboBox; |
72 | 0 | |
73 | 0 | public NetworkConfigurationPanel() { |
74 | 0 | initialize(); |
75 | 0 | } |
76 | ||
77 | protected void initialize() { | |
78 | 0 | this.setBorder(new TitledBorder("Network Configuration Paramenters")); |
79 | 0 | this.setLayout(new GridLayout(4, 1)); |
80 | 0 | this.add(this.getReplicationLevelPanel()); |
81 | 0 | this.add(this.getUploadSlotPanel()); |
82 | 0 | this.add(this.getDownloadSlotPanel()); |
83 | 0 | this.add(this.getConnectionTypePanel()); |
84 | 0 | } |
85 | ||
86 | /** | |
87 | * @return the downloadSlotComboBox | |
88 | */ | |
89 | protected JComboBox getDownloadSlotComboBox() { | |
90 | 0 | if (this.downloadSlotComboBox == null) { |
91 | 0 | this.downloadSlotComboBox = new JComboBox(); |
92 | 0 | for (int i = 0; i < 10; i++) |
93 | 0 | this.downloadSlotComboBox.addItem(i); |
94 | 0 | } |
95 | 0 | return downloadSlotComboBox; |
96 | } | |
97 | 0 | |
98 | /** | |
99 | * @return the downloadSlotPanel | |
100 | */ | |
101 | protected JPanel getDownloadSlotPanel() { | |
102 | 0 | if (this.downloadSlotPanel == null) { |
103 | 0 | this.downloadSlotPanel = new JPanel(); |
104 | 0 | this.downloadSlotPanel.setBorder(new TitledBorder( |
105 | 0 | "Download Slots (0 = infinite)")); |
106 | 0 | this.downloadSlotPanel.setLayout(new BorderLayout()); |
107 | 0 | this.downloadSlotPanel.add(this.getDownloadSlotComboBox()); |
108 | 0 | } |
109 | 0 | return downloadSlotPanel; |
110 | 0 | } |
111 | ||
112 | /** | |
113 | * @return the replicationLevelComboBox | |
114 | */ | |
115 | protected JComboBox getReplicationLevelComboBox() { | |
116 | 0 | if (this.replicationLevelComboBox == null) { |
117 | 0 | this.replicationLevelComboBox = new JComboBox(); |
118 | 0 | for (int i = 0; i < 10; i++) |
119 | 0 | this.replicationLevelComboBox.addItem(i); |
120 | 0 | this.replicationLevelComboBox.setSelectedItem(5); |
121 | 0 | } |
122 | 0 | return replicationLevelComboBox; |
123 | 0 | } |
124 | ||
125 | /** | |
126 | * @return the replicationLevelPanel | |
127 | */ | |
128 | protected JPanel getReplicationLevelPanel() { | |
129 | 0 | if (this.replicationLevelPanel == null) { |
130 | 0 | this.replicationLevelPanel = new JPanel(); |
131 | 0 | this.replicationLevelPanel.setBorder(new TitledBorder( |
132 | 0 | "Replication Level")); |
133 | 0 | this.replicationLevelPanel.setLayout(new BorderLayout()); |
134 | 0 | this.replicationLevelPanel.add(this.getReplicationLevelComboBox()); |
135 | 0 | } |
136 | 0 | return replicationLevelPanel; |
137 | } | |
138 | ||
139 | /** | |
140 | * @return the uploadSlotComboBox | |
141 | */ | |
142 | 0 | protected JComboBox getUploadSlotComboBox() { |
143 | 0 | if (this.uploadSlotComboBox == null) { |
144 | 0 | this.uploadSlotComboBox = new JComboBox(); |
145 | 0 | for (int i = 0; i < 10; i++) |
146 | 0 | this.uploadSlotComboBox.addItem(i); |
147 | } | |
148 | 0 | return uploadSlotComboBox; |
149 | } | |
150 | ||
151 | /** | |
152 | * @return the uploadSlotPanel | |
153 | */ | |
154 | protected JPanel getUploadSlotPanel() { | |
155 | 0 | if (this.uploadSlotPanel == null) { |
156 | 0 | this.uploadSlotPanel = new JPanel(); |
157 | 0 | this.uploadSlotPanel.setBorder(new TitledBorder( |
158 | 0 | "Upload Slots (0 = infinite)")); |
159 | 0 | this.uploadSlotPanel.setLayout(new BorderLayout()); |
160 | 0 | this.uploadSlotPanel.add(this.getUploadSlotComboBox()); |
161 | 0 | } |
162 | 0 | return uploadSlotPanel; |
163 | } | |
164 | ||
165 | /** | |
166 | * @return Returns the connectionTypeComboBox. | |
167 | 0 | */ |
168 | protected JComboBox getConnectionTypeComboBox() { | |
169 | 0 | if (this.connectionTypeComboBox == null) { |
170 | 0 | this.connectionTypeComboBox = new JComboBox(); |
171 | 0 | for (int i = 0; i < NetworkConnectionType.type.length; i++) { |
172 | 0 | this.connectionTypeComboBox |
173 | .addItem(NetworkConnectionType.type[i]); | |
174 | 0 | } |
175 | 0 | this.connectionTypeComboBox.setSelectedItem(NetworkConnectionType |
176 | 0 | .fromConnectionTypeToString(ConfigurationManager |
177 | 0 | .getInstance().getNetworkConnectionType())); |
178 | 0 | this.connectionTypeComboBox.addActionListener(new ActionListener() { |
179 | ||
180 | 0 | public void actionPerformed(ActionEvent arg0) { |
181 | ConfigurationManager | |
182 | .getInstance() | |
183 | .setNetworkConnectionType( | |
184 | NetworkConnectionType | |
185 | .fromStringToConnectionType(connectionTypeComboBox | |
186 | .getSelectedItem() | |
187 | .toString())); | |
188 | } | |
189 | }); | |
190 | } | |
191 | 0 | return connectionTypeComboBox; |
192 | } | |
193 | ||
194 | /** | |
195 | * @return Returns the connectionTypePanel. | |
196 | */ | |
197 | protected JPanel getConnectionTypePanel() { | |
198 | 0 | if (this.connectionTypePanel == null) { |
199 | 0 | this.connectionTypePanel = new JPanel(); |
200 | 0 | this.connectionTypePanel.setBorder(new TitledBorder( |
201 | "Connection Type")); | |
202 | 0 | this.connectionTypePanel.setLayout(new BorderLayout()); |
203 | 0 | this.connectionTypePanel.add(this.getConnectionTypeComboBox(), |
204 | BorderLayout.CENTER); | |
205 | } | |
206 | 0 | return connectionTypePanel; |
207 | } | |
208 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |