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