root / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / creation / panel / PluginDescriptionPanel.java @ 33743
History | View | Annotate | Download (16.5 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2010 {Prodevelop} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.installer.swing.impl.creation.panel; |
29 |
|
30 |
import java.awt.Dimension; |
31 |
import java.awt.GridBagConstraints; |
32 |
import java.awt.Insets; |
33 |
|
34 |
import javax.swing.JCheckBox; |
35 |
import javax.swing.JComboBox; |
36 |
import javax.swing.JLabel; |
37 |
import javax.swing.JPanel; |
38 |
import javax.swing.JScrollPane; |
39 |
import javax.swing.JTextArea; |
40 |
import javax.swing.JTextField; |
41 |
|
42 |
import org.gvsig.installer.lib.api.InstallerManager.ARCH; |
43 |
import org.gvsig.installer.lib.api.InstallerManager.JVM; |
44 |
import org.gvsig.installer.lib.api.InstallerManager.OS; |
45 |
import org.gvsig.installer.lib.api.InstallerManager.STATE; |
46 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
47 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
48 |
|
49 |
/**
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
51 |
*/
|
52 |
public abstract class PluginDescriptionPanel extends JPanel { |
53 |
|
54 |
private static final long serialVersionUID = 3220127550495628087L; |
55 |
|
56 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
57 |
private JLabel buildLabel; |
58 |
private JTextField buildText; |
59 |
private JLabel codeLabel; |
60 |
private JTextField codeText; |
61 |
private JTextArea descriptionArea; |
62 |
private JLabel descriptionLabel; |
63 |
private JScrollPane descriptionScrollPane; |
64 |
private JTextField nameText; |
65 |
private JLabel nameLabel; |
66 |
private JLabel officialLabel; |
67 |
private JCheckBox officialCheckBox; |
68 |
private JComboBox statusCombo; |
69 |
private JLabel statusLabel; |
70 |
private JLabel versionLabel; |
71 |
private JTextField versionText; |
72 |
private JLabel operatingSystemLabel; |
73 |
private JComboBox operatingSystemCombo; |
74 |
private JLabel architectureLabel; |
75 |
private JComboBox architectureCombo; |
76 |
private JLabel javaVMLabel; |
77 |
private JComboBox javaVMCombo; |
78 |
private JLabel applicationVersionLabel; |
79 |
private JTextField applicationVersionText; |
80 |
|
81 |
public PluginDescriptionPanel() {
|
82 |
super();
|
83 |
swingInstallerManager = |
84 |
(DefaultSwingInstallerManager) SwingInstallerLocator |
85 |
.getSwingInstallerManager(); |
86 |
initComponents(); |
87 |
initCombos(); |
88 |
} |
89 |
|
90 |
private void initCombos() { |
91 |
statusCombo.addItem(STATE.DEVEL); |
92 |
statusCombo.addItem(STATE.TESTING); |
93 |
statusCombo.addItem(STATE.PILOT); |
94 |
statusCombo.addItem(STATE.PROTOTYPE); |
95 |
statusCombo.addItem(STATE.ALPHA.concat("1"));
|
96 |
statusCombo.addItem(STATE.ALPHA.concat("2"));
|
97 |
statusCombo.addItem(STATE.ALPHA.concat("3"));
|
98 |
statusCombo.addItem(STATE.BETA.concat("1"));
|
99 |
statusCombo.addItem(STATE.BETA.concat("2"));
|
100 |
statusCombo.addItem(STATE.BETA.concat("3"));
|
101 |
statusCombo.addItem(STATE.RC.concat("1"));
|
102 |
statusCombo.addItem(STATE.RC.concat("2"));
|
103 |
statusCombo.addItem(STATE.RC.concat("3"));
|
104 |
statusCombo.addItem(STATE.FINAL); |
105 |
|
106 |
operatingSystemCombo.addItem(OS.ALL); |
107 |
operatingSystemCombo.addItem(OS.LINUX); |
108 |
operatingSystemCombo.addItem(OS.WINDOWS); |
109 |
operatingSystemCombo.addItem(OS.OSX_10_4); |
110 |
operatingSystemCombo.addItem(OS.OSX_10_5); |
111 |
operatingSystemCombo.addItem(OS.OSX_10_6); |
112 |
|
113 |
architectureCombo.addItem(ARCH.ALL); |
114 |
architectureCombo.addItem(ARCH.X86); |
115 |
architectureCombo.addItem(ARCH.X86_64); |
116 |
|
117 |
javaVMCombo.addItem(JVM.J1_5); |
118 |
javaVMCombo.addItem(JVM.J1_6); |
119 |
} |
120 |
|
121 |
private void initComponents() { |
122 |
java.awt.GridBagConstraints gridBagConstraints; |
123 |
|
124 |
nameLabel = new JLabel(); |
125 |
nameText = new JTextField(); |
126 |
descriptionScrollPane = new JScrollPane(); |
127 |
descriptionArea = new JTextArea(); |
128 |
descriptionLabel = new JLabel(); |
129 |
versionLabel = new JLabel(); |
130 |
versionText = new JTextField(); |
131 |
buildLabel = new JLabel(); |
132 |
buildText = new JTextField(); |
133 |
statusLabel = new JLabel(); |
134 |
statusCombo = new JComboBox(); |
135 |
officialLabel = new javax.swing.JLabel();
|
136 |
officialCheckBox = new JCheckBox(); |
137 |
codeLabel = new JLabel(); |
138 |
codeText = new JTextField(); |
139 |
|
140 |
operatingSystemLabel = new JLabel(); |
141 |
operatingSystemCombo = new JComboBox(); |
142 |
architectureLabel = new JLabel(); |
143 |
architectureCombo = new JComboBox(); |
144 |
javaVMLabel = new JLabel(); |
145 |
javaVMCombo = new JComboBox(); |
146 |
applicationVersionLabel = new JLabel(); |
147 |
applicationVersionText = new JTextField(); |
148 |
|
149 |
setLayout(new java.awt.GridBagLayout());
|
150 |
|
151 |
nameLabel.setText(swingInstallerManager.getText("name"));
|
152 |
gridBagConstraints = new GridBagConstraints(); |
153 |
gridBagConstraints.gridx = 0;
|
154 |
gridBagConstraints.gridy = 1;
|
155 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
156 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
157 |
add(nameLabel, gridBagConstraints); |
158 |
gridBagConstraints = new GridBagConstraints(); |
159 |
gridBagConstraints.gridx = 1;
|
160 |
gridBagConstraints.gridy = 1;
|
161 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
162 |
gridBagConstraints.weightx = 1.0;
|
163 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
164 |
add(nameText, gridBagConstraints); |
165 |
|
166 |
descriptionArea.setColumns(20);
|
167 |
descriptionArea.setRows(5);
|
168 |
descriptionScrollPane.setViewportView(descriptionArea); |
169 |
|
170 |
gridBagConstraints = new GridBagConstraints(); |
171 |
gridBagConstraints.gridx = 1;
|
172 |
gridBagConstraints.gridy = 2;
|
173 |
gridBagConstraints.fill = GridBagConstraints.BOTH;
|
174 |
gridBagConstraints.weightx = 1.0;
|
175 |
gridBagConstraints.weighty = 1.0;
|
176 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
177 |
add(descriptionScrollPane, gridBagConstraints); |
178 |
|
179 |
descriptionLabel.setText(swingInstallerManager.getText("description"));
|
180 |
gridBagConstraints = new GridBagConstraints(); |
181 |
gridBagConstraints.gridx = 0;
|
182 |
gridBagConstraints.gridy = 2;
|
183 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
184 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
185 |
add(descriptionLabel, gridBagConstraints); |
186 |
|
187 |
versionLabel.setText(swingInstallerManager.getText("version"));
|
188 |
gridBagConstraints = new GridBagConstraints(); |
189 |
gridBagConstraints.gridx = 0;
|
190 |
gridBagConstraints.gridy = 3;
|
191 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
192 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
193 |
add(versionLabel, gridBagConstraints); |
194 |
|
195 |
versionText.setPreferredSize(new Dimension(100, 27)); |
196 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
197 |
gridBagConstraints.gridx = 1;
|
198 |
gridBagConstraints.gridy = 3;
|
199 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
200 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
201 |
add(versionText, gridBagConstraints); |
202 |
|
203 |
buildLabel.setText(swingInstallerManager.getText("build"));
|
204 |
gridBagConstraints = new GridBagConstraints(); |
205 |
gridBagConstraints.gridx = 0;
|
206 |
gridBagConstraints.gridy = 4;
|
207 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
208 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
209 |
add(buildLabel, gridBagConstraints); |
210 |
|
211 |
buildText.setPreferredSize(new java.awt.Dimension(100, 27)); |
212 |
gridBagConstraints = new GridBagConstraints(); |
213 |
gridBagConstraints.gridx = 1;
|
214 |
gridBagConstraints.gridy = 4;
|
215 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
216 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
217 |
add(buildText, gridBagConstraints); |
218 |
|
219 |
officialLabel.setText(swingInstallerManager.getText("is_official"));
|
220 |
gridBagConstraints = new GridBagConstraints(); |
221 |
gridBagConstraints.gridx = 0;
|
222 |
gridBagConstraints.gridy = 6;
|
223 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
224 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
225 |
add(officialLabel, gridBagConstraints); |
226 |
|
227 |
statusLabel.setText(swingInstallerManager.getText("status"));
|
228 |
gridBagConstraints = new GridBagConstraints(); |
229 |
gridBagConstraints.gridx = 0;
|
230 |
gridBagConstraints.gridy = 5;
|
231 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
232 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
233 |
add(statusLabel, gridBagConstraints); |
234 |
|
235 |
statusCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
236 |
gridBagConstraints = new GridBagConstraints(); |
237 |
gridBagConstraints.gridx = 1;
|
238 |
gridBagConstraints.gridy = 5;
|
239 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
240 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
241 |
add(statusCombo, gridBagConstraints); |
242 |
|
243 |
gridBagConstraints = new GridBagConstraints(); |
244 |
gridBagConstraints.gridx = 1;
|
245 |
gridBagConstraints.gridy = 6;
|
246 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
247 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
248 |
add(officialCheckBox, gridBagConstraints); |
249 |
|
250 |
codeLabel.setText(swingInstallerManager.getText("code"));
|
251 |
gridBagConstraints = new GridBagConstraints(); |
252 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
253 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
254 |
add(codeLabel, gridBagConstraints); |
255 |
gridBagConstraints = new GridBagConstraints(); |
256 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
257 |
gridBagConstraints.weightx = 1.0;
|
258 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
259 |
add(codeText, gridBagConstraints); |
260 |
|
261 |
operatingSystemLabel.setText(swingInstallerManager |
262 |
.getText("operating_system"));
|
263 |
gridBagConstraints = new GridBagConstraints(); |
264 |
gridBagConstraints.gridx = 0;
|
265 |
gridBagConstraints.gridy = 7;
|
266 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
267 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
268 |
add(operatingSystemLabel, gridBagConstraints); |
269 |
|
270 |
operatingSystemCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
271 |
gridBagConstraints = new GridBagConstraints(); |
272 |
gridBagConstraints.gridx = 1;
|
273 |
gridBagConstraints.gridy = 7;
|
274 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
275 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
276 |
add(operatingSystemCombo, gridBagConstraints); |
277 |
|
278 |
architectureLabel |
279 |
.setText(swingInstallerManager.getText("architecture"));
|
280 |
gridBagConstraints = new GridBagConstraints(); |
281 |
gridBagConstraints.gridx = 0;
|
282 |
gridBagConstraints.gridy = 8;
|
283 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
284 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
285 |
add(architectureLabel, gridBagConstraints); |
286 |
|
287 |
architectureCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
288 |
gridBagConstraints = new GridBagConstraints(); |
289 |
gridBagConstraints.gridx = 1;
|
290 |
gridBagConstraints.gridy = 8;
|
291 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
292 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
293 |
add(architectureCombo, gridBagConstraints); |
294 |
|
295 |
javaVMLabel.setText(swingInstallerManager.getText("java_version"));
|
296 |
gridBagConstraints = new GridBagConstraints(); |
297 |
gridBagConstraints.gridx = 0;
|
298 |
gridBagConstraints.gridy = 9;
|
299 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
300 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
301 |
add(javaVMLabel, gridBagConstraints); |
302 |
|
303 |
javaVMCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
304 |
gridBagConstraints = new GridBagConstraints(); |
305 |
gridBagConstraints.gridx = 1;
|
306 |
gridBagConstraints.gridy = 9;
|
307 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
308 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
309 |
add(javaVMCombo, gridBagConstraints); |
310 |
|
311 |
applicationVersionLabel.setText(swingInstallerManager |
312 |
.getText("gvSIG_desktop_version"));
|
313 |
gridBagConstraints = new GridBagConstraints(); |
314 |
gridBagConstraints.gridx = 0;
|
315 |
gridBagConstraints.gridy = 10;
|
316 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
317 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
318 |
add(applicationVersionLabel, gridBagConstraints); |
319 |
|
320 |
applicationVersionText.setText(findCurrentGvSIGVersion()); |
321 |
gridBagConstraints = new GridBagConstraints(); |
322 |
gridBagConstraints.gridx = 1;
|
323 |
gridBagConstraints.gridy = 10;
|
324 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
325 |
gridBagConstraints.weightx = 1.0;
|
326 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
327 |
add(applicationVersionText, gridBagConstraints); |
328 |
} |
329 |
|
330 |
protected abstract String findCurrentGvSIGVersion(); |
331 |
|
332 |
/**
|
333 |
* @return the build
|
334 |
*/
|
335 |
public Integer getBuild() { |
336 |
try {
|
337 |
return Integer.parseInt(buildText.getText()); |
338 |
} catch (Exception e) { |
339 |
return 0; |
340 |
} |
341 |
} |
342 |
|
343 |
/**
|
344 |
* @param build
|
345 |
* the build to set
|
346 |
*/
|
347 |
public void setBuildText(Integer build) { |
348 |
this.buildText.setText(build.toString());
|
349 |
} |
350 |
|
351 |
/**
|
352 |
* @return the code
|
353 |
*/
|
354 |
public String getCode() { |
355 |
return codeText.getText();
|
356 |
} |
357 |
|
358 |
/**
|
359 |
* @param code
|
360 |
* the codeText to set
|
361 |
*/
|
362 |
public void setCode(String code) { |
363 |
this.codeText.setText(code);
|
364 |
} |
365 |
|
366 |
/**
|
367 |
* @return the naem
|
368 |
*/
|
369 |
@Override
|
370 |
public String getName() { |
371 |
return nameText.getText();
|
372 |
} |
373 |
|
374 |
/**
|
375 |
* @param naem
|
376 |
* the naem to set
|
377 |
*/
|
378 |
@Override
|
379 |
public void setName(String name) { |
380 |
this.nameText.setText(name);
|
381 |
} |
382 |
|
383 |
/**
|
384 |
* @return the offcicial
|
385 |
*/
|
386 |
public boolean isOfficial() { |
387 |
return officialCheckBox.isSelected();
|
388 |
} |
389 |
|
390 |
/**
|
391 |
* @param offcicial
|
392 |
* the offcicial to set
|
393 |
*/
|
394 |
public void setOfficial(boolean isOfficial) { |
395 |
this.officialCheckBox.setSelected(isOfficial);
|
396 |
} |
397 |
|
398 |
/**
|
399 |
* @return the status
|
400 |
*/
|
401 |
public String getState() { |
402 |
return (String) statusCombo.getSelectedItem(); |
403 |
} |
404 |
|
405 |
/**
|
406 |
* @param status
|
407 |
* the status to set
|
408 |
*/
|
409 |
public void setState(String state) { |
410 |
this.statusCombo.setSelectedItem(state);
|
411 |
} |
412 |
|
413 |
/**
|
414 |
* @return the version
|
415 |
*/
|
416 |
public String getVersion() { |
417 |
return versionText.getText();
|
418 |
} |
419 |
|
420 |
/**
|
421 |
* @param version
|
422 |
* the version to set
|
423 |
*/
|
424 |
public void setVersion(String version) { |
425 |
this.versionText.setText(version);
|
426 |
} |
427 |
|
428 |
/**
|
429 |
* @return the descriptionArea
|
430 |
*/
|
431 |
public String getDescription() { |
432 |
return descriptionArea.getText();
|
433 |
} |
434 |
|
435 |
/**
|
436 |
* @param descriptionArea
|
437 |
* the descriptionArea to set
|
438 |
*/
|
439 |
public void setDescription(String description) { |
440 |
this.descriptionArea.setText(description);
|
441 |
} |
442 |
|
443 |
public String getOperatingSystem() { |
444 |
return (String) this.operatingSystemCombo.getSelectedItem(); |
445 |
} |
446 |
|
447 |
public void setOperatingSystem(String operatingSystem) { |
448 |
this.operatingSystemCombo.setSelectedItem(operatingSystem);
|
449 |
} |
450 |
|
451 |
public String getArchitecture() { |
452 |
return (String) this.architectureCombo.getSelectedItem(); |
453 |
} |
454 |
|
455 |
public void setArchitecture(String architecture) { |
456 |
this.architectureCombo.setSelectedItem(architecture);
|
457 |
} |
458 |
|
459 |
public String getJavaVM() { |
460 |
return (String) this.javaVMCombo.getSelectedItem(); |
461 |
} |
462 |
|
463 |
public void setJavaVM(String javaVM) { |
464 |
this.javaVMCombo.setSelectedItem(javaVM);
|
465 |
} |
466 |
|
467 |
public String getGvSIGVersion() { |
468 |
return this.applicationVersionText.getText(); |
469 |
} |
470 |
|
471 |
public void setGvSIGVersion(String gvSIGVersion) { |
472 |
this.applicationVersionText.setText(gvSIGVersion);
|
473 |
} |
474 |
|
475 |
} |