Statistics
| Revision:

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 @ 37601

History | View | Annotate | Download (33.8 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.JPanel;
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&aacute;</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
        // private JScrollPane scrollPane;
95
        private JPanel newPanel;
96

    
97
        public DefaultPackageInfoPanel() {
98
                super();
99
                swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator
100
                                .getSwingInstallerManager();
101
                initComponents();
102
                // initComponents2();
103
                initCombos();
104
        }
105

    
106
        private void initCombos() {
107
                statusCombo.addItem(STATE.DEVEL);
108
                statusCombo.addItem(STATE.TESTING);
109
                statusCombo.addItem(STATE.PILOT);
110
                statusCombo.addItem(STATE.PROTOTYPE);
111
                statusCombo.addItem(STATE.ALPHA.concat("1"));
112
                statusCombo.addItem(STATE.ALPHA.concat("2"));
113
                statusCombo.addItem(STATE.ALPHA.concat("3"));
114
                statusCombo.addItem(STATE.BETA.concat("1"));
115
                statusCombo.addItem(STATE.BETA.concat("2"));
116
                statusCombo.addItem(STATE.BETA.concat("3"));
117
                statusCombo.addItem(STATE.RC.concat("1"));
118
                statusCombo.addItem(STATE.RC.concat("2"));
119
                statusCombo.addItem(STATE.RC.concat("3"));
120
                statusCombo.addItem(STATE.FINAL);
121

    
122
                operatingSystemCombo.addItem(OS.ALL);
123
                operatingSystemCombo.addItem(OS.LINUX);
124
                operatingSystemCombo.addItem(OS.WINDOWS);
125
                operatingSystemCombo.addItem(OS.OSX_10_4);
126
                operatingSystemCombo.addItem(OS.OSX_10_5);
127
                operatingSystemCombo.addItem(OS.OSX_10_6);
128

    
129
                architectureCombo.addItem(ARCH.ALL);
130
                architectureCombo.addItem(ARCH.X86);
131
                architectureCombo.addItem(ARCH.X86_64);
132

    
133
                javaVMCombo.addItem(JVM.J1_5);
134
                javaVMCombo.addItem(JVM.J1_6);
135
        }
136

    
137
        private void initComponents() {
138
                java.awt.GridBagConstraints gridBagConstraints;
139

    
140
                nameLabel = new JLabel();
141
                nameText = new JTextField();
142
                descriptionScrollPane = new JScrollPane();
143
                descriptionArea = new JTextArea();
144
                descriptionLabel = new JLabel();
145
                versionLabel = new JLabel();
146
                versionText = new JTextField();
147
                buildLabel = new JLabel();
148
                buildText = new JTextField();
149
                statusLabel = new JLabel();
150
                statusCombo = new JComboBox();
151
                officialLabel = new javax.swing.JLabel();
152
                officialCheckBox = new JCheckBox();
153
                codeLabel = new JLabel();
154
                codeText = new JTextField();
155

    
156
                operatingSystemLabel = new JLabel();
157
                operatingSystemCombo = new JComboBox();
158
                architectureLabel = new JLabel();
159
                architectureCombo = new JComboBox();
160
                javaVMLabel = new JLabel();
161
                javaVMCombo = new JComboBox();
162
                applicationVersionLabel = new JLabel();
163
                applicationVersionText = new JTextField();
164

    
165
                sourcesLabel = new JLabel();
166
                sourcesText = new JTextField();
167
                ownerLabel = new JLabel();
168
                ownerText = new JTextField();
169
                ownerURLLabel = new JLabel();
170
                ownerURLText = new JTextField();
171

    
172
                dependenciesLabel = new JLabel();
173
                dependenciesText = new JTextField();
174

    
175
                setLayout(new java.awt.GridBagLayout());
176

    
177
                nameLabel.setText(swingInstallerManager.getText("name"));
178
                gridBagConstraints = new GridBagConstraints();
179
                gridBagConstraints.gridx = 0;
180
                gridBagConstraints.gridy = 1;
181
                gridBagConstraints.anchor = GridBagConstraints.EAST;
182
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
183
                add(nameLabel, gridBagConstraints);
184

    
185
                gridBagConstraints = new GridBagConstraints();
186
                gridBagConstraints.gridx = 1;
187
                gridBagConstraints.gridy = 1;
188
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
189
                gridBagConstraints.weightx = 1.0;
190
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
191
                add(nameText, gridBagConstraints);
192

    
193
                descriptionLabel.setText(swingInstallerManager.getText("description"));
194
                gridBagConstraints = new GridBagConstraints();
195
                gridBagConstraints.gridx = 0;
196
                gridBagConstraints.gridy = 2;
197
                gridBagConstraints.anchor = GridBagConstraints.EAST;
198
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
199
                add(descriptionLabel, gridBagConstraints);
200

    
201
                descriptionArea.setColumns(20);
202
                descriptionArea.setRows(5);
203
                descriptionScrollPane.setViewportView(descriptionArea);
204
                gridBagConstraints = new GridBagConstraints();
205
                gridBagConstraints.gridx = 1;
206
                gridBagConstraints.gridy = 2;
207
                gridBagConstraints.fill = GridBagConstraints.BOTH;
208
                gridBagConstraints.weightx = 1.0;
209
                gridBagConstraints.weighty = 1.0;
210
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
211
                add(descriptionScrollPane, gridBagConstraints);
212

    
213
                versionLabel.setText(swingInstallerManager.getText("version"));
214
                gridBagConstraints = new GridBagConstraints();
215
                gridBagConstraints.gridx = 0;
216
                gridBagConstraints.gridy = 3;
217
                gridBagConstraints.anchor = GridBagConstraints.EAST;
218
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
219
                add(versionLabel, gridBagConstraints);
220

    
221
                versionText.setPreferredSize(new Dimension(100, 27));
222
                gridBagConstraints = new java.awt.GridBagConstraints();
223
                gridBagConstraints.gridx = 1;
224
                gridBagConstraints.gridy = 3;
225
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
226
                gridBagConstraints.weightx = 1.0;
227
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
228
                add(versionText, gridBagConstraints);
229

    
230
                buildLabel.setText(swingInstallerManager.getText("build"));
231
                gridBagConstraints = new GridBagConstraints();
232
                gridBagConstraints.gridx = 0;
233
                gridBagConstraints.gridy = 4;
234
                gridBagConstraints.anchor = GridBagConstraints.EAST;
235
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
236
                add(buildLabel, gridBagConstraints);
237

    
238
                buildText.setPreferredSize(new java.awt.Dimension(100, 27));
239
                gridBagConstraints = new GridBagConstraints();
240
                gridBagConstraints.gridx = 1;
241
                gridBagConstraints.gridy = 4;
242
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
243
                gridBagConstraints.weightx = 1.0;
244
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
245
                add(buildText, gridBagConstraints);
246

    
247
                officialLabel.setText(swingInstallerManager.getText("is_official"));
248
                gridBagConstraints = new GridBagConstraints();
249
                gridBagConstraints.gridx = 0;
250
                gridBagConstraints.gridy = 6;
251
                gridBagConstraints.anchor = GridBagConstraints.EAST;
252
                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
253
                add(officialLabel, gridBagConstraints);
254

    
255
                gridBagConstraints = new GridBagConstraints();
256
                gridBagConstraints.gridx = 1;
257
                gridBagConstraints.gridy = 6;
258
                gridBagConstraints.anchor = GridBagConstraints.WEST;
259
                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
260
                add(officialCheckBox, gridBagConstraints);
261

    
262
                statusLabel.setText(swingInstallerManager.getText("status"));
263
                gridBagConstraints = new GridBagConstraints();
264
                gridBagConstraints.gridx = 0;
265
                gridBagConstraints.gridy = 5;
266
                gridBagConstraints.anchor = GridBagConstraints.EAST;
267
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
268
                add(statusLabel, gridBagConstraints);
269

    
270
                statusCombo.setPreferredSize(new java.awt.Dimension(100, 27));
271
                gridBagConstraints = new GridBagConstraints();
272
                gridBagConstraints.gridx = 1;
273
                gridBagConstraints.gridy = 5;
274
                gridBagConstraints.anchor = GridBagConstraints.WEST;
275
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
276
                add(statusCombo, gridBagConstraints);
277

    
278
                codeLabel.setText(swingInstallerManager.getText("code"));
279
                gridBagConstraints = new GridBagConstraints();
280
                gridBagConstraints.anchor = GridBagConstraints.EAST;
281
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
282
                add(codeLabel, gridBagConstraints);
283

    
284
                gridBagConstraints = new GridBagConstraints();
285
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
286
                gridBagConstraints.weightx = 1.0;
287
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
288
                add(codeText, gridBagConstraints);
289

    
290
                operatingSystemLabel.setText(swingInstallerManager
291
                                .getText("operating_system"));
292
                gridBagConstraints = new GridBagConstraints();
293
                gridBagConstraints.gridx = 0;
294
                gridBagConstraints.gridy = 7;
295
                gridBagConstraints.anchor = GridBagConstraints.EAST;
296
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
297
                add(operatingSystemLabel, gridBagConstraints);
298

    
299
                operatingSystemCombo.setPreferredSize(new java.awt.Dimension(100, 27));
300
                gridBagConstraints = new GridBagConstraints();
301
                gridBagConstraints.gridx = 1;
302
                gridBagConstraints.gridy = 7;
303
                gridBagConstraints.anchor = GridBagConstraints.WEST;
304
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
305
                add(operatingSystemCombo, gridBagConstraints);
306

    
307
                architectureLabel
308
                                .setText(swingInstallerManager.getText("architecture"));
309
                gridBagConstraints = new GridBagConstraints();
310
                gridBagConstraints.gridx = 0;
311
                gridBagConstraints.gridy = 8;
312
                gridBagConstraints.anchor = GridBagConstraints.EAST;
313
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
314
                add(architectureLabel, gridBagConstraints);
315

    
316
                architectureCombo.setPreferredSize(new java.awt.Dimension(100, 27));
317
                gridBagConstraints = new GridBagConstraints();
318
                gridBagConstraints.gridx = 1;
319
                gridBagConstraints.gridy = 8;
320
                gridBagConstraints.anchor = GridBagConstraints.WEST;
321
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
322
                add(architectureCombo, gridBagConstraints);
323

    
324
                javaVMLabel.setText(swingInstallerManager.getText("java_version"));
325
                gridBagConstraints = new GridBagConstraints();
326
                gridBagConstraints.gridx = 0;
327
                gridBagConstraints.gridy = 9;
328
                gridBagConstraints.anchor = GridBagConstraints.EAST;
329
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
330
                add(javaVMLabel, gridBagConstraints);
331

    
332
                javaVMCombo.setPreferredSize(new java.awt.Dimension(100, 27));
333
                gridBagConstraints = new GridBagConstraints();
334
                gridBagConstraints.gridx = 1;
335
                gridBagConstraints.gridy = 9;
336
                gridBagConstraints.anchor = GridBagConstraints.WEST;
337
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
338
                add(javaVMCombo, gridBagConstraints);
339

    
340
                applicationVersionLabel.setText(swingInstallerManager
341
                                .getText("gvSIG_desktop_version"));
342
                gridBagConstraints = new GridBagConstraints();
343
                gridBagConstraints.gridx = 0;
344
                gridBagConstraints.gridy = 10;
345
                gridBagConstraints.anchor = GridBagConstraints.EAST;
346
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
347
                add(applicationVersionLabel, gridBagConstraints);
348

    
349
                applicationVersionText.setText(findCurrentGvSIGVersion());
350
                gridBagConstraints = new GridBagConstraints();
351
                gridBagConstraints.gridx = 1;
352
                gridBagConstraints.gridy = 10;
353
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
354
                gridBagConstraints.weightx = 1.0;
355
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
356
                add(applicationVersionText, gridBagConstraints);
357

    
358
                ownerLabel.setText(swingInstallerManager.getText("package_owner"));
359
                gridBagConstraints = new GridBagConstraints();
360
                gridBagConstraints.gridx = 0;
361
                gridBagConstraints.gridy = 11;
362
                gridBagConstraints.anchor = GridBagConstraints.EAST;
363
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
364
                add(ownerLabel, gridBagConstraints);
365

    
366
                ownerText.setPreferredSize(new Dimension(100, 27));
367
                gridBagConstraints = new java.awt.GridBagConstraints();
368
                gridBagConstraints.gridx = 1;
369
                gridBagConstraints.gridy = 11;
370
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
371
                gridBagConstraints.weightx = 1.0;
372
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
373
                add(ownerText, gridBagConstraints);
374

    
375
                ownerURLLabel.setText(swingInstallerManager
376
                                .getText("package_URL_owner"));
377
                gridBagConstraints = new GridBagConstraints();
378
                gridBagConstraints.gridx = 0;
379
                gridBagConstraints.gridy = 12;
380
                gridBagConstraints.anchor = GridBagConstraints.EAST;
381
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
382
                add(ownerURLLabel, gridBagConstraints);
383

    
384
                ownerURLText.setPreferredSize(new Dimension(100, 27));
385
                gridBagConstraints = new java.awt.GridBagConstraints();
386
                gridBagConstraints.gridx = 1;
387
                gridBagConstraints.gridy = 12;
388
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
389
                gridBagConstraints.weightx = 1.0;
390
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
391
                add(ownerURLText, gridBagConstraints);
392

    
393
                sourcesLabel.setText(swingInstallerManager.getText("sources_url"));
394
                gridBagConstraints = new GridBagConstraints();
395
                gridBagConstraints.gridx = 0;
396
                gridBagConstraints.gridy = 13;
397
                gridBagConstraints.anchor = GridBagConstraints.EAST;
398
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
399
                add(sourcesLabel, gridBagConstraints);
400

    
401
                sourcesText.setPreferredSize(new Dimension(100, 27));
402
                gridBagConstraints = new java.awt.GridBagConstraints();
403
                gridBagConstraints.gridx = 1;
404
                gridBagConstraints.gridy = 13;
405
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
406
                gridBagConstraints.weightx = 1.0;
407
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
408
                add(sourcesText, gridBagConstraints);
409

    
410
                dependenciesLabel
411
                                .setText(swingInstallerManager.getText("dependencies"));
412
                gridBagConstraints = new GridBagConstraints();
413
                gridBagConstraints.gridx = 0;
414
                gridBagConstraints.gridy = 14;
415
                gridBagConstraints.anchor = GridBagConstraints.EAST;
416
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
417
                add(dependenciesLabel, gridBagConstraints);
418

    
419
                dependenciesText.setPreferredSize(new Dimension(100, 27));
420
                gridBagConstraints = new java.awt.GridBagConstraints();
421
                gridBagConstraints.gridx = 1;
422
                gridBagConstraints.gridy = 14;
423
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
424
                gridBagConstraints.weightx = 1.0;
425
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
426
                add(dependenciesText, gridBagConstraints);
427
        }
428

    
429
        private void initComponents2() {
430
                java.awt.GridBagConstraints gridBagConstraints;
431

    
432
                // new
433
                newPanel = new JPanel();
434

    
435
                nameLabel = new JLabel();
436
                nameText = new JTextField();
437
                descriptionScrollPane = new JScrollPane();
438
                descriptionArea = new JTextArea();
439
                descriptionLabel = new JLabel();
440
                versionLabel = new JLabel();
441
                versionText = new JTextField();
442
                buildLabel = new JLabel();
443
                buildText = new JTextField();
444
                statusLabel = new JLabel();
445
                statusCombo = new JComboBox();
446
                officialLabel = new javax.swing.JLabel();
447
                officialCheckBox = new JCheckBox();
448
                codeLabel = new JLabel();
449
                codeText = new JTextField();
450

    
451
                operatingSystemLabel = new JLabel();
452
                operatingSystemCombo = new JComboBox();
453
                architectureLabel = new JLabel();
454
                architectureCombo = new JComboBox();
455
                javaVMLabel = new JLabel();
456
                javaVMCombo = new JComboBox();
457
                applicationVersionLabel = new JLabel();
458
                applicationVersionText = new JTextField();
459

    
460
                sourcesLabel = new JLabel();
461
                sourcesText = new JTextField();
462
                ownerLabel = new JLabel();
463
                ownerText = new JTextField();
464
                ownerURLLabel = new JLabel();
465
                ownerURLText = new JTextField();
466

    
467
                dependenciesLabel = new JLabel();
468
                dependenciesText = new JTextField();
469

    
470
                newPanel.setLayout(new java.awt.GridBagLayout());
471

    
472
                nameLabel.setText(swingInstallerManager.getText("name"));
473
                gridBagConstraints = new GridBagConstraints();
474
                gridBagConstraints.gridx = 0;
475
                gridBagConstraints.gridy = 1;
476
                gridBagConstraints.anchor = GridBagConstraints.EAST;
477
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
478
                newPanel.add(nameLabel, gridBagConstraints);
479

    
480
                nameText.setPreferredSize(new Dimension(100, 27));
481
                gridBagConstraints = new GridBagConstraints();
482
                gridBagConstraints.gridx = 1;
483
                gridBagConstraints.gridy = 1;
484
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
485
                gridBagConstraints.weightx = 1.0;
486
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
487
                newPanel.add(nameText, gridBagConstraints);
488

    
489
                descriptionLabel.setText(swingInstallerManager.getText("description"));
490
                gridBagConstraints = new GridBagConstraints();
491
                gridBagConstraints.gridx = 0;
492
                gridBagConstraints.gridy = 2;
493
                gridBagConstraints.anchor = GridBagConstraints.EAST;
494
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
495
                newPanel.add(descriptionLabel, gridBagConstraints);
496

    
497
                descriptionArea.setColumns(20);
498
                descriptionArea.setRows(5);
499
                descriptionScrollPane.setViewportView(descriptionArea);
500
                gridBagConstraints = new GridBagConstraints();
501
                gridBagConstraints.gridx = 1;
502
                gridBagConstraints.gridy = 2;
503
                gridBagConstraints.fill = GridBagConstraints.BOTH;
504
                gridBagConstraints.weightx = 1.0;
505
                gridBagConstraints.weighty = 1.0;
506
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
507
                newPanel.add(descriptionScrollPane, gridBagConstraints);
508

    
509
                versionLabel.setText(swingInstallerManager.getText("version"));
510
                gridBagConstraints = new GridBagConstraints();
511
                gridBagConstraints.gridx = 0;
512
                gridBagConstraints.gridy = 3;
513
                gridBagConstraints.anchor = GridBagConstraints.EAST;
514
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
515
                newPanel.add(versionLabel, gridBagConstraints);
516

    
517
                versionText.setPreferredSize(new Dimension(100, 27));
518
                gridBagConstraints = new java.awt.GridBagConstraints();
519
                gridBagConstraints.gridx = 1;
520
                gridBagConstraints.gridy = 3;
521
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
522
                gridBagConstraints.weightx = 1.0;
523
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
524
                newPanel.add(versionText, gridBagConstraints);
525

    
526
                buildLabel.setText(swingInstallerManager.getText("build"));
527
                gridBagConstraints = new GridBagConstraints();
528
                gridBagConstraints.gridx = 0;
529
                gridBagConstraints.gridy = 4;
530
                gridBagConstraints.anchor = GridBagConstraints.EAST;
531
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
532
                newPanel.add(buildLabel, gridBagConstraints);
533

    
534
                buildText.setPreferredSize(new java.awt.Dimension(100, 27));
535
                gridBagConstraints = new GridBagConstraints();
536
                gridBagConstraints.gridx = 1;
537
                gridBagConstraints.gridy = 4;
538
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
539
                gridBagConstraints.weightx = 1.0;
540
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
541
                newPanel.add(buildText, gridBagConstraints);
542

    
543
                officialLabel.setText(swingInstallerManager.getText("is_official"));
544
                gridBagConstraints = new GridBagConstraints();
545
                gridBagConstraints.gridx = 0;
546
                gridBagConstraints.gridy = 6;
547
                gridBagConstraints.anchor = GridBagConstraints.EAST;
548
                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
549
                newPanel.add(officialLabel, gridBagConstraints);
550

    
551
                gridBagConstraints = new GridBagConstraints();
552
                gridBagConstraints.gridx = 1;
553
                gridBagConstraints.gridy = 6;
554
                gridBagConstraints.anchor = GridBagConstraints.WEST;
555
                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
556
                newPanel.add(officialCheckBox, gridBagConstraints);
557

    
558
                statusLabel.setText(swingInstallerManager.getText("status"));
559
                gridBagConstraints = new GridBagConstraints();
560
                gridBagConstraints.gridx = 0;
561
                gridBagConstraints.gridy = 5;
562
                gridBagConstraints.anchor = GridBagConstraints.EAST;
563
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
564
                newPanel.add(statusLabel, gridBagConstraints);
565

    
566
                statusCombo.setPreferredSize(new java.awt.Dimension(100, 27));
567
                gridBagConstraints = new GridBagConstraints();
568
                gridBagConstraints.gridx = 1;
569
                gridBagConstraints.gridy = 5;
570
                gridBagConstraints.anchor = GridBagConstraints.WEST;
571
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
572
                newPanel.add(statusCombo, gridBagConstraints);
573

    
574
                codeLabel.setText(swingInstallerManager.getText("code"));
575
                gridBagConstraints = new GridBagConstraints();
576
                gridBagConstraints.anchor = GridBagConstraints.EAST;
577
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
578
                newPanel.add(codeLabel, gridBagConstraints);
579

    
580
                codeText.setPreferredSize(new java.awt.Dimension(100, 27));
581
                gridBagConstraints = new GridBagConstraints();
582
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
583
                gridBagConstraints.weightx = 1.0;
584
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
585
                newPanel.add(codeText, gridBagConstraints);
586

    
587
                operatingSystemLabel.setText(swingInstallerManager
588
                                .getText("operating_system"));
589
                gridBagConstraints = new GridBagConstraints();
590
                gridBagConstraints.gridx = 0;
591
                gridBagConstraints.gridy = 7;
592
                gridBagConstraints.anchor = GridBagConstraints.EAST;
593
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
594
                newPanel.add(operatingSystemLabel, gridBagConstraints);
595

    
596
                operatingSystemCombo.setPreferredSize(new java.awt.Dimension(100, 27));
597
                gridBagConstraints = new GridBagConstraints();
598
                gridBagConstraints.gridx = 1;
599
                gridBagConstraints.gridy = 7;
600
                gridBagConstraints.anchor = GridBagConstraints.WEST;
601
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
602
                newPanel.add(operatingSystemCombo, gridBagConstraints);
603

    
604
                architectureLabel
605
                                .setText(swingInstallerManager.getText("architecture"));
606
                gridBagConstraints = new GridBagConstraints();
607
                gridBagConstraints.gridx = 0;
608
                gridBagConstraints.gridy = 8;
609
                gridBagConstraints.anchor = GridBagConstraints.EAST;
610
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
611
                newPanel.add(architectureLabel, gridBagConstraints);
612

    
613
                architectureCombo.setPreferredSize(new java.awt.Dimension(100, 27));
614
                gridBagConstraints = new GridBagConstraints();
615
                gridBagConstraints.gridx = 1;
616
                gridBagConstraints.gridy = 8;
617
                gridBagConstraints.anchor = GridBagConstraints.WEST;
618
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
619
                newPanel.add(architectureCombo, gridBagConstraints);
620

    
621
                javaVMLabel.setText(swingInstallerManager.getText("java_version"));
622
                gridBagConstraints = new GridBagConstraints();
623
                gridBagConstraints.gridx = 0;
624
                gridBagConstraints.gridy = 9;
625
                gridBagConstraints.anchor = GridBagConstraints.EAST;
626
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
627
                newPanel.add(javaVMLabel, gridBagConstraints);
628

    
629
                javaVMCombo.setPreferredSize(new java.awt.Dimension(100, 27));
630
                gridBagConstraints = new GridBagConstraints();
631
                gridBagConstraints.gridx = 1;
632
                gridBagConstraints.gridy = 9;
633
                gridBagConstraints.anchor = GridBagConstraints.WEST;
634
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
635
                newPanel.add(javaVMCombo, gridBagConstraints);
636

    
637
                applicationVersionLabel.setText(swingInstallerManager
638
                                .getText("gvSIG_desktop_version"));
639
                gridBagConstraints = new GridBagConstraints();
640
                gridBagConstraints.gridx = 0;
641
                gridBagConstraints.gridy = 10;
642
                gridBagConstraints.anchor = GridBagConstraints.EAST;
643
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
644
                newPanel.add(applicationVersionLabel, gridBagConstraints);
645

    
646
                applicationVersionText.setText(findCurrentGvSIGVersion());
647
                gridBagConstraints = new GridBagConstraints();
648
                gridBagConstraints.gridx = 1;
649
                gridBagConstraints.gridy = 10;
650
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
651
                gridBagConstraints.weightx = 1.0;
652
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
653
                newPanel.add(applicationVersionText, gridBagConstraints);
654

    
655
                ownerLabel.setText(swingInstallerManager.getText("package_owner"));
656
                gridBagConstraints = new GridBagConstraints();
657
                gridBagConstraints.gridx = 0;
658
                gridBagConstraints.gridy = 11;
659
                gridBagConstraints.anchor = GridBagConstraints.EAST;
660
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
661
                newPanel.add(ownerLabel, gridBagConstraints);
662

    
663
                ownerText.setPreferredSize(new Dimension(100, 27));
664
                gridBagConstraints = new java.awt.GridBagConstraints();
665
                gridBagConstraints.gridx = 1;
666
                gridBagConstraints.gridy = 11;
667
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
668
                gridBagConstraints.weightx = 1.0;
669
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
670
                newPanel.add(ownerText, gridBagConstraints);
671

    
672
                sourcesLabel.setText(swingInstallerManager.getText("sources_url"));
673
                gridBagConstraints = new GridBagConstraints();
674
                gridBagConstraints.gridx = 0;
675
                gridBagConstraints.gridy = 12;
676
                gridBagConstraints.anchor = GridBagConstraints.EAST;
677
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
678
                newPanel.add(sourcesLabel, gridBagConstraints);
679

    
680
                sourcesText.setPreferredSize(new Dimension(100, 27));
681
                gridBagConstraints = new java.awt.GridBagConstraints();
682
                gridBagConstraints.gridx = 1;
683
                gridBagConstraints.gridy = 12;
684
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
685
                gridBagConstraints.weightx = 1.0;
686
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
687
                newPanel.add(sourcesText, gridBagConstraints);
688

    
689
                dependenciesLabel
690
                                .setText(swingInstallerManager.getText("dependencies"));
691
                gridBagConstraints = new GridBagConstraints();
692
                gridBagConstraints.gridx = 0;
693
                gridBagConstraints.gridy = 13;
694
                gridBagConstraints.anchor = GridBagConstraints.EAST;
695
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
696
                newPanel.add(dependenciesLabel, gridBagConstraints);
697

    
698
                dependenciesText.setPreferredSize(new Dimension(100, 27));
699
                gridBagConstraints = new java.awt.GridBagConstraints();
700
                gridBagConstraints.gridx = 1;
701
                gridBagConstraints.gridy = 13;
702
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
703
                gridBagConstraints.weightx = 1.0;
704
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
705
                newPanel.add(dependenciesText, gridBagConstraints);
706

    
707
                ownerURLLabel.setPreferredSize(new Dimension(100, 27));
708
                ownerURLLabel.setText(swingInstallerManager
709
                                .getText("package_URL_owner"));
710
                gridBagConstraints = new GridBagConstraints();
711
                gridBagConstraints.gridx = 0;
712
                gridBagConstraints.gridy = 14;
713
                gridBagConstraints.anchor = GridBagConstraints.EAST;
714
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
715
                newPanel.add(ownerURLLabel, gridBagConstraints);
716

    
717
                ownerURLText.setPreferredSize(new Dimension(100, 27));
718
                gridBagConstraints = new java.awt.GridBagConstraints();
719
                gridBagConstraints.gridx = 1;
720
                gridBagConstraints.gridy = 14;
721
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
722
                gridBagConstraints.weightx = 1.0;
723
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
724
                newPanel.add(ownerURLText, gridBagConstraints);
725

    
726
                // scrollPane = new JScrollPane(newPanel);
727

    
728
                add(newPanel);
729
        }
730

    
731
        protected String findCurrentGvSIGVersion() {
732
                return SwingInstallerLocator.getSwingInstallerManager()
733
                                .getApplicationVersion();
734
        }
735

    
736
        /**
737
         * @return the build
738
         */
739
        private Integer getBuild() {
740
                try {
741
                        return Integer.parseInt(buildText.getText());
742
                } catch (Exception e) {
743
                        return 0;
744
                }
745
        }
746

    
747
        /**
748
         * @param build
749
         *            the build to set
750
         */
751
        private void setBuildText(Integer build) {
752
                this.buildText.setText(build.toString());
753
        }
754

    
755
        /**
756
         * @return the code
757
         */
758
        private String getCode() {
759
                return codeText.getText();
760
        }
761

    
762
        /**
763
         * @param code
764
         *            the codeText to set
765
         */
766
        private void setCode(String code) {
767
                this.codeText.setText(code);
768
        }
769

    
770
        /**
771
         * @return the naem
772
         */
773
        @Override
774
        public String getName() {
775
                return nameText.getText();
776
        }
777

    
778
        /**
779
         * @param naem
780
         *            the naem to set
781
         */
782
        @Override
783
        public void setName(String name) {
784
                this.nameText.setText(name);
785
        }
786

    
787
        /**
788
         * @return the offcicial
789
         */
790
        private boolean isOfficial() {
791
                return officialCheckBox.isSelected();
792
        }
793

    
794
        /**
795
         * @param offcicial
796
         *            the offcicial to set
797
         */
798
        private void setOfficial(boolean isOfficial) {
799
                this.officialCheckBox.setSelected(isOfficial);
800
        }
801

    
802
        /**
803
         * @return the status
804
         */
805
        private String getState() {
806
                return (String) statusCombo.getSelectedItem();
807
        }
808

    
809
        /**
810
         * @param status
811
         *            the status to set
812
         */
813
        private void setState(String state) {
814
                this.statusCombo.setSelectedItem(state);
815
        }
816

    
817
        /**
818
         * @return the version
819
         */
820
        private String getVersion() {
821
                return versionText.getText();
822
        }
823

    
824
        /**
825
         * @param version
826
         *            the version to set
827
         */
828
        private void setVersion(String version) {
829
                this.versionText.setText(version);
830
        }
831

    
832
        /**
833
         * @return the descriptionArea
834
         */
835
        private String getDescription() {
836
                return descriptionArea.getText();
837
        }
838

    
839
        /**
840
         * @param descriptionArea
841
         *            the descriptionArea to set
842
         */
843
        private void setDescription(String description) {
844
                this.descriptionArea.setText(description);
845
        }
846

    
847
        private String getOperatingSystem() {
848
                return (String) this.operatingSystemCombo.getSelectedItem();
849
        }
850

    
851
        private void setOperatingSystem(String operatingSystem) {
852
                this.operatingSystemCombo.setSelectedItem(operatingSystem);
853
        }
854

    
855
        private String getArchitecture() {
856
                return (String) this.architectureCombo.getSelectedItem();
857
        }
858

    
859
        private void setArchitecture(String architecture) {
860
                this.architectureCombo.setSelectedItem(architecture);
861
        }
862

    
863
        private String getJavaVM() {
864
                return (String) this.javaVMCombo.getSelectedItem();
865
        }
866

    
867
        private void setJavaVM(String javaVM) {
868
                this.javaVMCombo.setSelectedItem(javaVM);
869
        }
870

    
871
        private String getGvSIGVersion() {
872
                return this.applicationVersionText.getText();
873
        }
874

    
875
        private void setGvSIGVersion(String gvSIGVersion) {
876
                this.applicationVersionText.setText(gvSIGVersion);
877
        }
878

    
879
        private void setOwner(String owner) {
880
                this.ownerText.setText(owner);
881
        }
882

    
883
        private String getOwner() {
884
                return this.ownerText.getText();
885
        }
886

    
887
        private void setSources(String sources) {
888
                this.sourcesText.setText(sources);
889
        }
890

    
891
        private URL getSources() throws MalformedURLException {
892
                String str = this.sourcesText.getText();
893
                str = str.trim();
894
                if (str.equals("")) {
895
                        return null;
896
                }
897
                return new URL(str);
898
        }
899

    
900
        private void setOwnerURL(String sources) {
901
                this.ownerURLText.setText(sources);
902
        }
903

    
904
        private URL getOwnerURL() throws MalformedURLException {
905
                String str = this.ownerURLText.getText();
906
                str = str.trim();
907
                if (str.equals("")) {
908
                        return null;
909
                }
910
                return new URL(str);
911
        }
912

    
913
        private void setDependencies(String dependencies) {
914
                this.dependenciesText.setText(dependencies);
915
        }
916

    
917
        private String getDependencies() {
918
                return this.dependenciesText.getText();
919
        }
920

    
921
        @Override
922
        public boolean validatePanel() {
923
                try {
924
                        getSources();
925
                } catch (MalformedURLException e) {
926
                        JOptionPane
927
                                        .showMessageDialog(
928
                                                        null,
929
                                                        swingInstallerManager
930
                                                                        .getText("_the_package_source_files_url_is_malformed._Please_review_it"),
931
                                                        "_malformed_url", JOptionPane.OK_OPTION
932
                                                                        + JOptionPane.WARNING_MESSAGE);
933
                        return false;
934
                }
935

    
936
                try {
937
                        getOwnerURL();
938
                } catch (MalformedURLException e) {
939
                        JOptionPane.showMessageDialog(null, swingInstallerManager
940
                                        .getText("_the_owners_url_is_malformed._Please_review_it"),
941
                                        "_malformed_url", JOptionPane.OK_OPTION
942
                                                        + JOptionPane.WARNING_MESSAGE);
943
                        return false;
944
                }
945

    
946
                return true;
947
        }
948

    
949
        @Override
950
        public void panelToPackageInfo(PackageInfo packageInfo) {
951
                packageInfo.setCode(getCode());
952
                packageInfo.setName(getName());
953
                packageInfo.setDescription(getDescription());
954
                packageInfo.setVersion(getVersion());
955
                packageInfo.setBuild(getBuild());
956
                packageInfo.setState(getState());
957
                packageInfo.setOfficial(isOfficial());
958
                packageInfo.setOperatingSystem(getOperatingSystem());
959
                packageInfo.setArchitecture(getArchitecture());
960
                packageInfo.setJavaVM(getJavaVM());
961
                packageInfo.setGvSIGVersion(getGvSIGVersion());
962
                try {
963
                        packageInfo.setSourcesURL(getSources());
964
                } catch (MalformedURLException e) {
965
                        throw new RuntimeException(e);
966
                }
967
                try {
968
                        packageInfo.setOwnerURL(getOwnerURL());
969
                } catch (MalformedURLException e) {
970
                        throw new RuntimeException(e);
971
                }
972
                packageInfo.setOwner(getOwner());
973
                packageInfo.setDependencies(getDependencies());
974
        }
975

    
976
        @Override
977
        public void packageInfoToPanel(PackageInfo packageInfo) {
978
                setCode(packageInfo.getCode());
979
                setName(packageInfo.getName());
980
                setVersion(packageInfo.getVersion().toString());
981
                setBuildText(packageInfo.getBuild());
982
                setOfficial(packageInfo.isOfficial());
983
                setState(packageInfo.getState());
984
                setDescription(packageInfo.getDescription());
985
                setOperatingSystem(packageInfo.getOperatingSystem());
986
                setArchitecture(packageInfo.getArchitecture());
987
                setJavaVM(packageInfo.getJavaVM());
988
                String version = packageInfo.getGvSIGVersion();
989
                if ((version == null) || version.equals("")) {
990
                        setGvSIGVersion(findCurrentGvSIGVersion());
991
                } else {
992
                        setGvSIGVersion(packageInfo.getGvSIGVersion());
993
                }
994
                if (packageInfo.getSourcesURL() == null) {
995
                        setSources("");
996
                } else {
997
                        setSources(packageInfo.getSourcesURL().toString());
998
                }
999
                if (packageInfo.getOwner() == null) {
1000
                        setOwner("");
1001
                } else {
1002
                        setOwner(packageInfo.getOwner());
1003
                }
1004
                if (packageInfo.getOwnerURL() == null) {
1005
                        setOwnerURL("");
1006
                } else {
1007
                        setOwnerURL(packageInfo.getOwnerURL().toString());
1008
                }
1009
                if (packageInfo.getDependencies() == null) {
1010
                        setDependencies("");
1011
                } else {
1012
                        setDependencies(packageInfo.getDependencies().toString());
1013
                }
1014

    
1015
        }
1016
}