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 / DefaultPackageInfoPanel.java @ 38788
History | View | Annotate | Download (22.2 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 |
import java.net.MalformedURLException; |
34 |
import java.net.URL; |
35 |
|
36 |
import javax.swing.JCheckBox; |
37 |
import javax.swing.JComboBox; |
38 |
import javax.swing.JLabel; |
39 |
import javax.swing.JOptionPane; |
40 |
import javax.swing.JScrollPane; |
41 |
import javax.swing.JTextArea; |
42 |
import javax.swing.JTextField; |
43 |
|
44 |
import org.gvsig.installer.lib.api.PackageInfo; |
45 |
import org.gvsig.installer.lib.api.InstallerManager.ARCH; |
46 |
import org.gvsig.installer.lib.api.InstallerManager.JVM; |
47 |
import org.gvsig.installer.lib.api.InstallerManager.OS; |
48 |
import org.gvsig.installer.lib.api.InstallerManager.STATE; |
49 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
50 |
import org.gvsig.installer.swing.api.creation.JPackageInfoPanel; |
51 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
52 |
|
53 |
/**
|
54 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a>
|
55 |
*/
|
56 |
public class DefaultPackageInfoPanel extends JPackageInfoPanel { |
57 |
|
58 |
private static final long serialVersionUID = 3220127550495628087L; |
59 |
|
60 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
61 |
private JLabel buildLabel; |
62 |
private JTextField buildText; |
63 |
private JLabel codeLabel; |
64 |
private JTextField codeText; |
65 |
private JTextArea descriptionArea; |
66 |
private JLabel descriptionLabel; |
67 |
private JScrollPane descriptionScrollPane; |
68 |
private JTextField nameText; |
69 |
private JLabel nameLabel; |
70 |
private JLabel officialLabel; |
71 |
private JCheckBox officialCheckBox; |
72 |
private JComboBox statusCombo; |
73 |
private JLabel statusLabel; |
74 |
private JLabel versionLabel; |
75 |
private JTextField versionText; |
76 |
private JLabel operatingSystemLabel; |
77 |
private JComboBox operatingSystemCombo; |
78 |
private JLabel architectureLabel; |
79 |
private JComboBox architectureCombo; |
80 |
private JLabel javaVMLabel; |
81 |
private JComboBox javaVMCombo; |
82 |
private JLabel applicationVersionLabel; |
83 |
private JTextField applicationVersionText; |
84 |
private JLabel sourcesLabel; |
85 |
private JTextField sourcesText; |
86 |
private JLabel ownerLabel; |
87 |
private JTextField ownerText; |
88 |
private JLabel dependenciesLabel; |
89 |
private JTextField dependenciesText; |
90 |
private JLabel ownerURLLabel; |
91 |
private JTextField ownerURLText; |
92 |
|
93 |
public DefaultPackageInfoPanel() {
|
94 |
super();
|
95 |
swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator |
96 |
.getSwingInstallerManager(); |
97 |
initComponents(); |
98 |
initCombos(); |
99 |
} |
100 |
|
101 |
private void initCombos() { |
102 |
statusCombo.addItem(STATE.DEVEL); |
103 |
statusCombo.addItem(STATE.TESTING); |
104 |
statusCombo.addItem(STATE.PILOT); |
105 |
statusCombo.addItem(STATE.PROTOTYPE); |
106 |
statusCombo.addItem(STATE.ALPHA.concat("1"));
|
107 |
statusCombo.addItem(STATE.ALPHA.concat("2"));
|
108 |
statusCombo.addItem(STATE.ALPHA.concat("3"));
|
109 |
statusCombo.addItem(STATE.BETA.concat("1"));
|
110 |
statusCombo.addItem(STATE.BETA.concat("2"));
|
111 |
statusCombo.addItem(STATE.BETA.concat("3"));
|
112 |
statusCombo.addItem(STATE.RC.concat("1"));
|
113 |
statusCombo.addItem(STATE.RC.concat("2"));
|
114 |
statusCombo.addItem(STATE.RC.concat("3"));
|
115 |
statusCombo.addItem(STATE.FINAL); |
116 |
|
117 |
operatingSystemCombo.addItem(OS.ALL); |
118 |
operatingSystemCombo.addItem(OS.LINUX); |
119 |
operatingSystemCombo.addItem(OS.WINDOWS); |
120 |
operatingSystemCombo.addItem(OS.OSX_10_4); |
121 |
operatingSystemCombo.addItem(OS.OSX_10_5); |
122 |
operatingSystemCombo.addItem(OS.OSX_10_6); |
123 |
|
124 |
architectureCombo.addItem(ARCH.ALL); |
125 |
architectureCombo.addItem(ARCH.X86); |
126 |
architectureCombo.addItem(ARCH.X86_64); |
127 |
|
128 |
javaVMCombo.addItem(JVM.J1_5); |
129 |
javaVMCombo.addItem(JVM.J1_6); |
130 |
} |
131 |
|
132 |
private void initComponents() { |
133 |
java.awt.GridBagConstraints gridBagConstraints; |
134 |
|
135 |
nameLabel = new JLabel(); |
136 |
nameText = new JTextField(); |
137 |
descriptionScrollPane = new JScrollPane(); |
138 |
descriptionArea = new JTextArea(); |
139 |
descriptionLabel = new JLabel(); |
140 |
versionLabel = new JLabel(); |
141 |
versionText = new JTextField(); |
142 |
buildLabel = new JLabel(); |
143 |
buildText = new JTextField(); |
144 |
statusLabel = new JLabel(); |
145 |
statusCombo = new JComboBox(); |
146 |
officialLabel = new javax.swing.JLabel();
|
147 |
officialCheckBox = new JCheckBox(); |
148 |
codeLabel = new JLabel(); |
149 |
codeText = new JTextField(); |
150 |
|
151 |
operatingSystemLabel = new JLabel(); |
152 |
operatingSystemCombo = new JComboBox(); |
153 |
architectureLabel = new JLabel(); |
154 |
architectureCombo = new JComboBox(); |
155 |
javaVMLabel = new JLabel(); |
156 |
javaVMCombo = new JComboBox(); |
157 |
applicationVersionLabel = new JLabel(); |
158 |
applicationVersionText = new JTextField(); |
159 |
|
160 |
sourcesLabel = new JLabel(); |
161 |
sourcesText = new JTextField(); |
162 |
ownerLabel = new JLabel(); |
163 |
ownerText = new JTextField(); |
164 |
ownerURLLabel = new JLabel(); |
165 |
ownerURLText = new JTextField(); |
166 |
|
167 |
dependenciesLabel = new JLabel(); |
168 |
dependenciesText = new JTextField(); |
169 |
|
170 |
setLayout(new java.awt.GridBagLayout());
|
171 |
|
172 |
nameLabel.setText(swingInstallerManager.getText("_name"));
|
173 |
gridBagConstraints = new GridBagConstraints(); |
174 |
gridBagConstraints.gridx = 0;
|
175 |
gridBagConstraints.gridy = 1;
|
176 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
177 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
178 |
add(nameLabel, gridBagConstraints); |
179 |
|
180 |
gridBagConstraints = new GridBagConstraints(); |
181 |
gridBagConstraints.gridx = 1;
|
182 |
gridBagConstraints.gridy = 1;
|
183 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
184 |
gridBagConstraints.weightx = 1.0;
|
185 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
186 |
add(nameText, gridBagConstraints); |
187 |
|
188 |
descriptionLabel.setText(swingInstallerManager.getText("_description"));
|
189 |
gridBagConstraints = new GridBagConstraints(); |
190 |
gridBagConstraints.gridx = 0;
|
191 |
gridBagConstraints.gridy = 2;
|
192 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
193 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
194 |
add(descriptionLabel, gridBagConstraints); |
195 |
|
196 |
descriptionArea.setColumns(20);
|
197 |
descriptionArea.setRows(5);
|
198 |
descriptionScrollPane.setViewportView(descriptionArea); |
199 |
gridBagConstraints = new GridBagConstraints(); |
200 |
gridBagConstraints.gridx = 1;
|
201 |
gridBagConstraints.gridy = 2;
|
202 |
gridBagConstraints.fill = GridBagConstraints.BOTH;
|
203 |
gridBagConstraints.weightx = 1.0;
|
204 |
gridBagConstraints.weighty = 1.0;
|
205 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
206 |
add(descriptionScrollPane, gridBagConstraints); |
207 |
|
208 |
versionLabel.setText(swingInstallerManager.getText("_version"));
|
209 |
gridBagConstraints = new GridBagConstraints(); |
210 |
gridBagConstraints.gridx = 0;
|
211 |
gridBagConstraints.gridy = 3;
|
212 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
213 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
214 |
add(versionLabel, gridBagConstraints); |
215 |
|
216 |
versionText.setPreferredSize(new Dimension(100, 27)); |
217 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
218 |
gridBagConstraints.gridx = 1;
|
219 |
gridBagConstraints.gridy = 3;
|
220 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
221 |
gridBagConstraints.weightx = 1.0;
|
222 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
223 |
add(versionText, gridBagConstraints); |
224 |
|
225 |
buildLabel.setText(swingInstallerManager.getText("_build"));
|
226 |
gridBagConstraints = new GridBagConstraints(); |
227 |
gridBagConstraints.gridx = 0;
|
228 |
gridBagConstraints.gridy = 4;
|
229 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
230 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
231 |
add(buildLabel, gridBagConstraints); |
232 |
|
233 |
buildText.setPreferredSize(new java.awt.Dimension(100, 27)); |
234 |
gridBagConstraints = new GridBagConstraints(); |
235 |
gridBagConstraints.gridx = 1;
|
236 |
gridBagConstraints.gridy = 4;
|
237 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
238 |
gridBagConstraints.weightx = 1.0;
|
239 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
240 |
add(buildText, gridBagConstraints); |
241 |
|
242 |
officialLabel.setText(swingInstallerManager.getText("_is_official"));
|
243 |
gridBagConstraints = new GridBagConstraints(); |
244 |
gridBagConstraints.gridx = 0;
|
245 |
gridBagConstraints.gridy = 6;
|
246 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
247 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
248 |
add(officialLabel, gridBagConstraints); |
249 |
|
250 |
gridBagConstraints = new GridBagConstraints(); |
251 |
gridBagConstraints.gridx = 1;
|
252 |
gridBagConstraints.gridy = 6;
|
253 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
254 |
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); |
255 |
add(officialCheckBox, gridBagConstraints); |
256 |
|
257 |
statusLabel.setText(swingInstallerManager.getText("_status"));
|
258 |
gridBagConstraints = new GridBagConstraints(); |
259 |
gridBagConstraints.gridx = 0;
|
260 |
gridBagConstraints.gridy = 5;
|
261 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
262 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
263 |
add(statusLabel, gridBagConstraints); |
264 |
|
265 |
statusCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
266 |
gridBagConstraints = new GridBagConstraints(); |
267 |
gridBagConstraints.gridx = 1;
|
268 |
gridBagConstraints.gridy = 5;
|
269 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
270 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
271 |
add(statusCombo, gridBagConstraints); |
272 |
|
273 |
codeLabel.setText(swingInstallerManager.getText("_code"));
|
274 |
gridBagConstraints = new GridBagConstraints(); |
275 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
276 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
277 |
add(codeLabel, gridBagConstraints); |
278 |
|
279 |
gridBagConstraints = new GridBagConstraints(); |
280 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
281 |
gridBagConstraints.weightx = 1.0;
|
282 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
283 |
add(codeText, gridBagConstraints); |
284 |
|
285 |
operatingSystemLabel.setText(swingInstallerManager |
286 |
.getText("_operating_system"));
|
287 |
gridBagConstraints = new GridBagConstraints(); |
288 |
gridBagConstraints.gridx = 0;
|
289 |
gridBagConstraints.gridy = 7;
|
290 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
291 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
292 |
add(operatingSystemLabel, gridBagConstraints); |
293 |
|
294 |
operatingSystemCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
295 |
gridBagConstraints = new GridBagConstraints(); |
296 |
gridBagConstraints.gridx = 1;
|
297 |
gridBagConstraints.gridy = 7;
|
298 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
299 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
300 |
add(operatingSystemCombo, gridBagConstraints); |
301 |
|
302 |
architectureLabel.setText(swingInstallerManager |
303 |
.getText("_architecture"));
|
304 |
gridBagConstraints = new GridBagConstraints(); |
305 |
gridBagConstraints.gridx = 0;
|
306 |
gridBagConstraints.gridy = 8;
|
307 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
308 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
309 |
add(architectureLabel, gridBagConstraints); |
310 |
|
311 |
architectureCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
312 |
gridBagConstraints = new GridBagConstraints(); |
313 |
gridBagConstraints.gridx = 1;
|
314 |
gridBagConstraints.gridy = 8;
|
315 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
316 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
317 |
add(architectureCombo, gridBagConstraints); |
318 |
|
319 |
javaVMLabel.setText(swingInstallerManager.getText("_java_version"));
|
320 |
gridBagConstraints = new GridBagConstraints(); |
321 |
gridBagConstraints.gridx = 0;
|
322 |
gridBagConstraints.gridy = 9;
|
323 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
324 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
325 |
add(javaVMLabel, gridBagConstraints); |
326 |
|
327 |
javaVMCombo.setPreferredSize(new java.awt.Dimension(100, 27)); |
328 |
gridBagConstraints = new GridBagConstraints(); |
329 |
gridBagConstraints.gridx = 1;
|
330 |
gridBagConstraints.gridy = 9;
|
331 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
332 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
333 |
add(javaVMCombo, gridBagConstraints); |
334 |
|
335 |
applicationVersionLabel.setText(swingInstallerManager |
336 |
.getText("_gvSIG_desktop_version"));
|
337 |
gridBagConstraints = new GridBagConstraints(); |
338 |
gridBagConstraints.gridx = 0;
|
339 |
gridBagConstraints.gridy = 10;
|
340 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
341 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
342 |
add(applicationVersionLabel, gridBagConstraints); |
343 |
|
344 |
applicationVersionText.setText(findCurrentGvSIGVersion()); |
345 |
gridBagConstraints = new GridBagConstraints(); |
346 |
gridBagConstraints.gridx = 1;
|
347 |
gridBagConstraints.gridy = 10;
|
348 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
349 |
gridBagConstraints.weightx = 1.0;
|
350 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
351 |
add(applicationVersionText, gridBagConstraints); |
352 |
|
353 |
ownerLabel.setText(swingInstallerManager.getText("_package_owner"));
|
354 |
gridBagConstraints = new GridBagConstraints(); |
355 |
gridBagConstraints.gridx = 0;
|
356 |
gridBagConstraints.gridy = 11;
|
357 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
358 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
359 |
add(ownerLabel, gridBagConstraints); |
360 |
|
361 |
ownerText.setPreferredSize(new Dimension(100, 27)); |
362 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
363 |
gridBagConstraints.gridx = 1;
|
364 |
gridBagConstraints.gridy = 11;
|
365 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
366 |
gridBagConstraints.weightx = 1.0;
|
367 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
368 |
add(ownerText, gridBagConstraints); |
369 |
|
370 |
ownerURLLabel.setText(swingInstallerManager |
371 |
.getText("_package_URL_owner"));
|
372 |
gridBagConstraints = new GridBagConstraints(); |
373 |
gridBagConstraints.gridx = 0;
|
374 |
gridBagConstraints.gridy = 12;
|
375 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
376 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
377 |
add(ownerURLLabel, gridBagConstraints); |
378 |
|
379 |
ownerURLText.setPreferredSize(new Dimension(100, 27)); |
380 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
381 |
gridBagConstraints.gridx = 1;
|
382 |
gridBagConstraints.gridy = 12;
|
383 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
384 |
gridBagConstraints.weightx = 1.0;
|
385 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
386 |
add(ownerURLText, gridBagConstraints); |
387 |
|
388 |
sourcesLabel.setText(swingInstallerManager.getText("_sources_url"));
|
389 |
gridBagConstraints = new GridBagConstraints(); |
390 |
gridBagConstraints.gridx = 0;
|
391 |
gridBagConstraints.gridy = 13;
|
392 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
393 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
394 |
add(sourcesLabel, gridBagConstraints); |
395 |
|
396 |
sourcesText.setPreferredSize(new Dimension(100, 27)); |
397 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
398 |
gridBagConstraints.gridx = 1;
|
399 |
gridBagConstraints.gridy = 13;
|
400 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
401 |
gridBagConstraints.weightx = 1.0;
|
402 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
403 |
add(sourcesText, gridBagConstraints); |
404 |
|
405 |
dependenciesLabel.setText(swingInstallerManager |
406 |
.getText("_dependencies"));
|
407 |
gridBagConstraints = new GridBagConstraints(); |
408 |
gridBagConstraints.gridx = 0;
|
409 |
gridBagConstraints.gridy = 14;
|
410 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
411 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
412 |
add(dependenciesLabel, gridBagConstraints); |
413 |
|
414 |
dependenciesText.setPreferredSize(new Dimension(100, 27)); |
415 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
416 |
gridBagConstraints.gridx = 1;
|
417 |
gridBagConstraints.gridy = 14;
|
418 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
419 |
gridBagConstraints.weightx = 1.0;
|
420 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
421 |
add(dependenciesText, gridBagConstraints); |
422 |
} |
423 |
|
424 |
protected String findCurrentGvSIGVersion() { |
425 |
return SwingInstallerLocator.getSwingInstallerManager()
|
426 |
.getApplicationVersion(); |
427 |
} |
428 |
|
429 |
/**
|
430 |
* @return the build
|
431 |
*/
|
432 |
private Integer getBuild() { |
433 |
try {
|
434 |
return Integer.parseInt(buildText.getText()); |
435 |
} catch (Exception e) { |
436 |
return 0; |
437 |
} |
438 |
} |
439 |
|
440 |
/**
|
441 |
* @param build
|
442 |
* the build to set
|
443 |
*/
|
444 |
private void setBuildText(Integer build) { |
445 |
this.buildText.setText(build.toString());
|
446 |
} |
447 |
|
448 |
/**
|
449 |
* @return the code
|
450 |
*/
|
451 |
private String getCode() { |
452 |
return codeText.getText();
|
453 |
} |
454 |
|
455 |
/**
|
456 |
* @param code
|
457 |
* the codeText to set
|
458 |
*/
|
459 |
private void setCode(String code) { |
460 |
this.codeText.setText(code);
|
461 |
} |
462 |
|
463 |
/**
|
464 |
* @return the naem
|
465 |
*/
|
466 |
@Override
|
467 |
public String getName() { |
468 |
return nameText.getText();
|
469 |
} |
470 |
|
471 |
/**
|
472 |
* @param naem
|
473 |
* the naem to set
|
474 |
*/
|
475 |
@Override
|
476 |
public void setName(String name) { |
477 |
this.nameText.setText(name);
|
478 |
} |
479 |
|
480 |
/**
|
481 |
* @return the offcicial
|
482 |
*/
|
483 |
private boolean isOfficial() { |
484 |
return officialCheckBox.isSelected();
|
485 |
} |
486 |
|
487 |
/**
|
488 |
* @param offcicial
|
489 |
* the offcicial to set
|
490 |
*/
|
491 |
private void setOfficial(boolean isOfficial) { |
492 |
this.officialCheckBox.setSelected(isOfficial);
|
493 |
} |
494 |
|
495 |
/**
|
496 |
* @return the status
|
497 |
*/
|
498 |
private String getState() { |
499 |
return (String) statusCombo.getSelectedItem(); |
500 |
} |
501 |
|
502 |
/**
|
503 |
* @param status
|
504 |
* the status to set
|
505 |
*/
|
506 |
private void setState(String state) { |
507 |
this.statusCombo.setSelectedItem(state);
|
508 |
} |
509 |
|
510 |
/**
|
511 |
* @return the version
|
512 |
*/
|
513 |
private String getVersion() { |
514 |
return versionText.getText();
|
515 |
} |
516 |
|
517 |
/**
|
518 |
* @param version
|
519 |
* the version to set
|
520 |
*/
|
521 |
private void setVersion(String version) { |
522 |
this.versionText.setText(version);
|
523 |
} |
524 |
|
525 |
/**
|
526 |
* @return the descriptionArea
|
527 |
*/
|
528 |
private String getDescription() { |
529 |
return descriptionArea.getText();
|
530 |
} |
531 |
|
532 |
/**
|
533 |
* @param descriptionArea
|
534 |
* the descriptionArea to set
|
535 |
*/
|
536 |
private void setDescription(String description) { |
537 |
this.descriptionArea.setText(description);
|
538 |
} |
539 |
|
540 |
private String getOperatingSystem() { |
541 |
return (String) this.operatingSystemCombo.getSelectedItem(); |
542 |
} |
543 |
|
544 |
private void setOperatingSystem(String operatingSystem) { |
545 |
this.operatingSystemCombo.setSelectedItem(operatingSystem);
|
546 |
} |
547 |
|
548 |
private String getArchitecture() { |
549 |
return (String) this.architectureCombo.getSelectedItem(); |
550 |
} |
551 |
|
552 |
private void setArchitecture(String architecture) { |
553 |
this.architectureCombo.setSelectedItem(architecture);
|
554 |
} |
555 |
|
556 |
private String getJavaVM() { |
557 |
return (String) this.javaVMCombo.getSelectedItem(); |
558 |
} |
559 |
|
560 |
private void setJavaVM(String javaVM) { |
561 |
this.javaVMCombo.setSelectedItem(javaVM);
|
562 |
} |
563 |
|
564 |
private String getGvSIGVersion() { |
565 |
return this.applicationVersionText.getText(); |
566 |
} |
567 |
|
568 |
private void setGvSIGVersion(String gvSIGVersion) { |
569 |
this.applicationVersionText.setText(gvSIGVersion);
|
570 |
} |
571 |
|
572 |
private void setOwner(String owner) { |
573 |
this.ownerText.setText(owner);
|
574 |
} |
575 |
|
576 |
private String getOwner() { |
577 |
return this.ownerText.getText(); |
578 |
} |
579 |
|
580 |
private void setSources(String sources) { |
581 |
this.sourcesText.setText(sources);
|
582 |
} |
583 |
|
584 |
private URL getSources() throws MalformedURLException { |
585 |
String str = this.sourcesText.getText(); |
586 |
str = str.trim(); |
587 |
if (str.equals("")) { |
588 |
return null; |
589 |
} |
590 |
return new URL(str); |
591 |
} |
592 |
|
593 |
private void setOwnerURL(String sources) { |
594 |
this.ownerURLText.setText(sources);
|
595 |
} |
596 |
|
597 |
private URL getOwnerURL() throws MalformedURLException { |
598 |
String str = this.ownerURLText.getText(); |
599 |
str = str.trim(); |
600 |
if (str.equals("")) { |
601 |
return null; |
602 |
} |
603 |
return new URL(str); |
604 |
} |
605 |
|
606 |
private void setDependencies(String dependencies) { |
607 |
this.dependenciesText.setText(dependencies);
|
608 |
} |
609 |
|
610 |
private String getDependencies() { |
611 |
return this.dependenciesText.getText(); |
612 |
} |
613 |
|
614 |
@Override
|
615 |
public boolean validatePanel() { |
616 |
try {
|
617 |
getSources(); |
618 |
} catch (MalformedURLException e) { |
619 |
JOptionPane
|
620 |
.showMessageDialog( |
621 |
null,
|
622 |
swingInstallerManager |
623 |
.getText("_the_package_source_files_url_is_malformed._Please_review_it"),
|
624 |
"_malformed_url", JOptionPane.OK_OPTION |
625 |
+ JOptionPane.WARNING_MESSAGE);
|
626 |
return false; |
627 |
} |
628 |
|
629 |
try {
|
630 |
getOwnerURL(); |
631 |
} catch (MalformedURLException e) { |
632 |
JOptionPane.showMessageDialog(null, swingInstallerManager |
633 |
.getText("_the_owners_url_is_malformed._Please_review_it"),
|
634 |
"_malformed_url", JOptionPane.OK_OPTION |
635 |
+ JOptionPane.WARNING_MESSAGE);
|
636 |
return false; |
637 |
} |
638 |
|
639 |
return true; |
640 |
} |
641 |
|
642 |
@Override
|
643 |
public void panelToPackageInfo(PackageInfo packageInfo) { |
644 |
packageInfo.setCode(getCode()); |
645 |
packageInfo.setName(getName()); |
646 |
packageInfo.setDescription(getDescription()); |
647 |
packageInfo.setVersion(getVersion()); |
648 |
packageInfo.setBuild(getBuild()); |
649 |
packageInfo.setState(getState()); |
650 |
packageInfo.setOfficial(isOfficial()); |
651 |
packageInfo.setOperatingSystem(getOperatingSystem()); |
652 |
packageInfo.setArchitecture(getArchitecture()); |
653 |
packageInfo.setJavaVM(getJavaVM()); |
654 |
packageInfo.setGvSIGVersion(getGvSIGVersion()); |
655 |
try {
|
656 |
packageInfo.setSourcesURL(getSources()); |
657 |
} catch (MalformedURLException e) { |
658 |
throw new RuntimeException(e); |
659 |
} |
660 |
try {
|
661 |
packageInfo.setOwnerURL(getOwnerURL()); |
662 |
} catch (MalformedURLException e) { |
663 |
throw new RuntimeException(e); |
664 |
} |
665 |
packageInfo.setOwner(getOwner()); |
666 |
packageInfo.setDependencies(getDependencies()); |
667 |
} |
668 |
|
669 |
private boolean isEmptyString(String s) { |
670 |
if( s==null) { |
671 |
return true; |
672 |
} |
673 |
return s.length() == 0; |
674 |
} |
675 |
|
676 |
@Override
|
677 |
public void packageInfoToPanel(PackageInfo packageInfo) { |
678 |
setCode(packageInfo.getCode()); |
679 |
if ( !isEmptyString(packageInfo.getCode()) ){
|
680 |
this.codeText.setEditable(false); |
681 |
} |
682 |
setName(packageInfo.getName()); |
683 |
setVersion(packageInfo.getVersion().toString()); |
684 |
setBuildText(packageInfo.getBuild()); |
685 |
setOfficial(packageInfo.isOfficial()); |
686 |
setState(packageInfo.getState()); |
687 |
setDescription(packageInfo.getDescription()); |
688 |
setOperatingSystem(packageInfo.getOperatingSystem()); |
689 |
setArchitecture(packageInfo.getArchitecture()); |
690 |
setJavaVM(packageInfo.getJavaVM()); |
691 |
String version = packageInfo.getGvSIGVersion();
|
692 |
if ((version == null) || version.equals("")) { |
693 |
setGvSIGVersion(findCurrentGvSIGVersion()); |
694 |
} else {
|
695 |
setGvSIGVersion(packageInfo.getGvSIGVersion()); |
696 |
} |
697 |
if (packageInfo.getSourcesURL() == null) { |
698 |
setSources("");
|
699 |
} else {
|
700 |
setSources(packageInfo.getSourcesURL().toString()); |
701 |
} |
702 |
if (packageInfo.getOwner() == null) { |
703 |
setOwner("");
|
704 |
} else {
|
705 |
setOwner(packageInfo.getOwner()); |
706 |
} |
707 |
if (packageInfo.getOwnerURL() == null) { |
708 |
setOwnerURL("");
|
709 |
} else {
|
710 |
setOwnerURL(packageInfo.getOwnerURL().toString()); |
711 |
} |
712 |
if (packageInfo.getDependencies() == null) { |
713 |
setDependencies("");
|
714 |
} else {
|
715 |
setDependencies(packageInfo.getDependencies().toString()); |
716 |
} |
717 |
|
718 |
} |
719 |
} |