svn-gvsig-desktop / tags / v2_0_0_Build_2021 / 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 @ 34107
History | View | Annotate | Download (16.6 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 |
|
159 |
gridBagConstraints = new GridBagConstraints(); |
160 |
gridBagConstraints.gridx = 1;
|
161 |
gridBagConstraints.gridy = 1;
|
162 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
163 |
gridBagConstraints.weightx = 1.0;
|
164 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
165 |
add(nameText, gridBagConstraints); |
166 |
|
167 |
descriptionLabel.setText(swingInstallerManager.getText("description"));
|
168 |
gridBagConstraints = new GridBagConstraints(); |
169 |
gridBagConstraints.gridx = 0;
|
170 |
gridBagConstraints.gridy = 2;
|
171 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
172 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
173 |
add(descriptionLabel, gridBagConstraints); |
174 |
|
175 |
descriptionArea.setColumns(20);
|
176 |
descriptionArea.setRows(5);
|
177 |
descriptionScrollPane.setViewportView(descriptionArea); |
178 |
gridBagConstraints = new GridBagConstraints(); |
179 |
gridBagConstraints.gridx = 1;
|
180 |
gridBagConstraints.gridy = 2;
|
181 |
gridBagConstraints.fill = GridBagConstraints.BOTH;
|
182 |
gridBagConstraints.weightx = 1.0;
|
183 |
gridBagConstraints.weighty = 1.0;
|
184 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
185 |
add(descriptionScrollPane, 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.fill = GridBagConstraints.HORIZONTAL;
|
200 |
gridBagConstraints.weightx = 1.0;
|
201 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
202 |
add(versionText, gridBagConstraints); |
203 |
|
204 |
buildLabel.setText(swingInstallerManager.getText("build"));
|
205 |
gridBagConstraints = new GridBagConstraints(); |
206 |
gridBagConstraints.gridx = 0;
|
207 |
gridBagConstraints.gridy = 4;
|
208 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
209 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
210 |
add(buildLabel, gridBagConstraints); |
211 |
|
212 |
buildText.setPreferredSize(new java.awt.Dimension(100, 27)); |
213 |
gridBagConstraints = new GridBagConstraints(); |
214 |
gridBagConstraints.gridx = 1;
|
215 |
gridBagConstraints.gridy = 4;
|
216 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
217 |
gridBagConstraints.weightx = 1.0;
|
218 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
219 |
add(buildText, gridBagConstraints); |
220 |
|
221 |
officialLabel.setText(swingInstallerManager.getText("is_official"));
|
222 |
gridBagConstraints = new GridBagConstraints(); |
223 |
gridBagConstraints.gridx = 0;
|
224 |
gridBagConstraints.gridy = 6;
|
225 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
226 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
227 |
add(officialLabel, gridBagConstraints); |
228 |
|
229 |
gridBagConstraints = new GridBagConstraints(); |
230 |
gridBagConstraints.gridx = 1;
|
231 |
gridBagConstraints.gridy = 6;
|
232 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
233 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
234 |
add(officialCheckBox, gridBagConstraints); |
235 |
|
236 |
statusLabel.setText(swingInstallerManager.getText("status"));
|
237 |
gridBagConstraints = new GridBagConstraints(); |
238 |
gridBagConstraints.gridx = 0;
|
239 |
gridBagConstraints.gridy = 5;
|
240 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
241 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
242 |
add(statusLabel, gridBagConstraints); |
243 |
|
244 |
statusCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
245 |
gridBagConstraints = new GridBagConstraints(); |
246 |
gridBagConstraints.gridx = 1;
|
247 |
gridBagConstraints.gridy = 5;
|
248 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
249 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
250 |
add(statusCombo, gridBagConstraints); |
251 |
|
252 |
codeLabel.setText(swingInstallerManager.getText("code"));
|
253 |
gridBagConstraints = new GridBagConstraints(); |
254 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
255 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
256 |
add(codeLabel, gridBagConstraints); |
257 |
|
258 |
gridBagConstraints = new GridBagConstraints(); |
259 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
260 |
gridBagConstraints.weightx = 1.0;
|
261 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
262 |
add(codeText, gridBagConstraints); |
263 |
|
264 |
operatingSystemLabel.setText(swingInstallerManager |
265 |
.getText("operating_system"));
|
266 |
gridBagConstraints = new GridBagConstraints(); |
267 |
gridBagConstraints.gridx = 0;
|
268 |
gridBagConstraints.gridy = 7;
|
269 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
270 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
271 |
add(operatingSystemLabel, gridBagConstraints); |
272 |
|
273 |
operatingSystemCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
274 |
gridBagConstraints = new GridBagConstraints(); |
275 |
gridBagConstraints.gridx = 1;
|
276 |
gridBagConstraints.gridy = 7;
|
277 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
278 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
279 |
add(operatingSystemCombo, gridBagConstraints); |
280 |
|
281 |
architectureLabel |
282 |
.setText(swingInstallerManager.getText("architecture"));
|
283 |
gridBagConstraints = new GridBagConstraints(); |
284 |
gridBagConstraints.gridx = 0;
|
285 |
gridBagConstraints.gridy = 8;
|
286 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
287 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
288 |
add(architectureLabel, gridBagConstraints); |
289 |
|
290 |
architectureCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
291 |
gridBagConstraints = new GridBagConstraints(); |
292 |
gridBagConstraints.gridx = 1;
|
293 |
gridBagConstraints.gridy = 8;
|
294 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
295 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
296 |
add(architectureCombo, gridBagConstraints); |
297 |
|
298 |
javaVMLabel.setText(swingInstallerManager.getText("java_version"));
|
299 |
gridBagConstraints = new GridBagConstraints(); |
300 |
gridBagConstraints.gridx = 0;
|
301 |
gridBagConstraints.gridy = 9;
|
302 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
303 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
304 |
add(javaVMLabel, gridBagConstraints); |
305 |
|
306 |
javaVMCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
307 |
gridBagConstraints = new GridBagConstraints(); |
308 |
gridBagConstraints.gridx = 1;
|
309 |
gridBagConstraints.gridy = 9;
|
310 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
311 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
312 |
add(javaVMCombo, gridBagConstraints); |
313 |
|
314 |
applicationVersionLabel.setText(swingInstallerManager |
315 |
.getText("gvSIG_desktop_version"));
|
316 |
gridBagConstraints = new GridBagConstraints(); |
317 |
gridBagConstraints.gridx = 0;
|
318 |
gridBagConstraints.gridy = 10;
|
319 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
320 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
321 |
add(applicationVersionLabel, gridBagConstraints); |
322 |
|
323 |
applicationVersionText.setText(findCurrentGvSIGVersion()); |
324 |
gridBagConstraints = new GridBagConstraints(); |
325 |
gridBagConstraints.gridx = 1;
|
326 |
gridBagConstraints.gridy = 10;
|
327 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
328 |
gridBagConstraints.weightx = 1.0;
|
329 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
330 |
add(applicationVersionText, gridBagConstraints); |
331 |
} |
332 |
|
333 |
protected abstract String findCurrentGvSIGVersion(); |
334 |
|
335 |
/**
|
336 |
* @return the build
|
337 |
*/
|
338 |
public Integer getBuild() { |
339 |
try {
|
340 |
return Integer.parseInt(buildText.getText()); |
341 |
} catch (Exception e) { |
342 |
return 0; |
343 |
} |
344 |
} |
345 |
|
346 |
/**
|
347 |
* @param build
|
348 |
* the build to set
|
349 |
*/
|
350 |
public void setBuildText(Integer build) { |
351 |
this.buildText.setText(build.toString());
|
352 |
} |
353 |
|
354 |
/**
|
355 |
* @return the code
|
356 |
*/
|
357 |
public String getCode() { |
358 |
return codeText.getText();
|
359 |
} |
360 |
|
361 |
/**
|
362 |
* @param code
|
363 |
* the codeText to set
|
364 |
*/
|
365 |
public void setCode(String code) { |
366 |
this.codeText.setText(code);
|
367 |
} |
368 |
|
369 |
/**
|
370 |
* @return the naem
|
371 |
*/
|
372 |
@Override
|
373 |
public String getName() { |
374 |
return nameText.getText();
|
375 |
} |
376 |
|
377 |
/**
|
378 |
* @param naem
|
379 |
* the naem to set
|
380 |
*/
|
381 |
@Override
|
382 |
public void setName(String name) { |
383 |
this.nameText.setText(name);
|
384 |
} |
385 |
|
386 |
/**
|
387 |
* @return the offcicial
|
388 |
*/
|
389 |
public boolean isOfficial() { |
390 |
return officialCheckBox.isSelected();
|
391 |
} |
392 |
|
393 |
/**
|
394 |
* @param offcicial
|
395 |
* the offcicial to set
|
396 |
*/
|
397 |
public void setOfficial(boolean isOfficial) { |
398 |
this.officialCheckBox.setSelected(isOfficial);
|
399 |
} |
400 |
|
401 |
/**
|
402 |
* @return the status
|
403 |
*/
|
404 |
public String getState() { |
405 |
return (String) statusCombo.getSelectedItem(); |
406 |
} |
407 |
|
408 |
/**
|
409 |
* @param status
|
410 |
* the status to set
|
411 |
*/
|
412 |
public void setState(String state) { |
413 |
this.statusCombo.setSelectedItem(state);
|
414 |
} |
415 |
|
416 |
/**
|
417 |
* @return the version
|
418 |
*/
|
419 |
public String getVersion() { |
420 |
return versionText.getText();
|
421 |
} |
422 |
|
423 |
/**
|
424 |
* @param version
|
425 |
* the version to set
|
426 |
*/
|
427 |
public void setVersion(String version) { |
428 |
this.versionText.setText(version);
|
429 |
} |
430 |
|
431 |
/**
|
432 |
* @return the descriptionArea
|
433 |
*/
|
434 |
public String getDescription() { |
435 |
return descriptionArea.getText();
|
436 |
} |
437 |
|
438 |
/**
|
439 |
* @param descriptionArea
|
440 |
* the descriptionArea to set
|
441 |
*/
|
442 |
public void setDescription(String description) { |
443 |
this.descriptionArea.setText(description);
|
444 |
} |
445 |
|
446 |
public String getOperatingSystem() { |
447 |
return (String) this.operatingSystemCombo.getSelectedItem(); |
448 |
} |
449 |
|
450 |
public void setOperatingSystem(String operatingSystem) { |
451 |
this.operatingSystemCombo.setSelectedItem(operatingSystem);
|
452 |
} |
453 |
|
454 |
public String getArchitecture() { |
455 |
return (String) this.architectureCombo.getSelectedItem(); |
456 |
} |
457 |
|
458 |
public void setArchitecture(String architecture) { |
459 |
this.architectureCombo.setSelectedItem(architecture);
|
460 |
} |
461 |
|
462 |
public String getJavaVM() { |
463 |
return (String) this.javaVMCombo.getSelectedItem(); |
464 |
} |
465 |
|
466 |
public void setJavaVM(String javaVM) { |
467 |
this.javaVMCombo.setSelectedItem(javaVM);
|
468 |
} |
469 |
|
470 |
public String getGvSIGVersion() { |
471 |
return this.applicationVersionText.getText(); |
472 |
} |
473 |
|
474 |
public void setGvSIGVersion(String gvSIGVersion) { |
475 |
this.applicationVersionText.setText(gvSIGVersion);
|
476 |
} |
477 |
|
478 |
} |