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