svn-gvsig-desktop / 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 / execution / panel / TypicalOrAdvancedPanel.java @ 37592
History | View | Annotate | Download (4.03 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 |
package org.gvsig.installer.swing.impl.execution.panel; |
23 |
|
24 |
import java.awt.BorderLayout; |
25 |
import java.awt.GridBagConstraints; |
26 |
import java.awt.GridBagLayout; |
27 |
import java.awt.Insets; |
28 |
import java.awt.event.ItemEvent; |
29 |
import java.awt.event.ItemListener; |
30 |
|
31 |
import javax.swing.ButtonGroup; |
32 |
import javax.swing.JPanel; |
33 |
import javax.swing.JRadioButton; |
34 |
import javax.swing.event.DocumentEvent; |
35 |
import javax.swing.event.DocumentListener; |
36 |
|
37 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
38 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
39 |
|
40 |
/**
|
41 |
* @author gvSIG Team
|
42 |
* @version $Id$
|
43 |
*
|
44 |
*/
|
45 |
public class TypicalOrAdvancedPanel extends JPanel implements ItemListener, |
46 |
DocumentListener {
|
47 |
|
48 |
private static final long serialVersionUID = 8488517767926838568L; |
49 |
|
50 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
51 |
|
52 |
private JPanel northPanel; |
53 |
private JRadioButton typicalModeRadioButton; |
54 |
private JRadioButton advancedModeRadioButton; |
55 |
private ButtonGroup buttonGroup; |
56 |
|
57 |
public TypicalOrAdvancedPanel() {
|
58 |
swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator |
59 |
.getSwingInstallerManager(); |
60 |
initComponents(); |
61 |
initListeners(); |
62 |
typicalModeRadioButton.setSelected(true);
|
63 |
|
64 |
} |
65 |
|
66 |
private void initListeners() { |
67 |
typicalModeRadioButton.addItemListener(this);
|
68 |
advancedModeRadioButton.addItemListener(this);
|
69 |
} |
70 |
|
71 |
private void initComponents() { |
72 |
java.awt.GridBagConstraints gridBagConstraints; |
73 |
|
74 |
northPanel = new JPanel(); |
75 |
typicalModeRadioButton = new JRadioButton(); |
76 |
advancedModeRadioButton = new JRadioButton(); |
77 |
|
78 |
buttonGroup = new ButtonGroup(); |
79 |
|
80 |
buttonGroup.add(typicalModeRadioButton); |
81 |
buttonGroup.add(advancedModeRadioButton); |
82 |
|
83 |
setLayout(new BorderLayout()); |
84 |
|
85 |
northPanel.setLayout(new GridBagLayout()); |
86 |
|
87 |
typicalModeRadioButton.setText(swingInstallerManager |
88 |
.getText("_typical_installation"));
|
89 |
gridBagConstraints = new GridBagConstraints(); |
90 |
gridBagConstraints.gridx = 0;
|
91 |
gridBagConstraints.gridy = 1;
|
92 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
93 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
94 |
northPanel.add(typicalModeRadioButton, gridBagConstraints); |
95 |
|
96 |
advancedModeRadioButton.setText(swingInstallerManager |
97 |
.getText("_advanced_installation"));
|
98 |
gridBagConstraints = new GridBagConstraints(); |
99 |
gridBagConstraints.gridx = 0;
|
100 |
gridBagConstraints.gridy = 2;
|
101 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
102 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
103 |
northPanel.add(advancedModeRadioButton, gridBagConstraints); |
104 |
|
105 |
add(northPanel, java.awt.BorderLayout.WEST); |
106 |
} |
107 |
|
108 |
protected boolean isTypicalModeSelected() { |
109 |
return typicalModeRadioButton.isSelected();
|
110 |
} |
111 |
|
112 |
protected boolean isAdvancedModeSelected() { |
113 |
return advancedModeRadioButton.isSelected();
|
114 |
} |
115 |
|
116 |
protected void setEnableTypicalMode(boolean active) { |
117 |
if (active) {
|
118 |
typicalModeRadioButton.setSelected(true);
|
119 |
} else {
|
120 |
advancedModeRadioButton.setSelected(true);
|
121 |
} |
122 |
typicalModeRadioButton.setEnabled(active); |
123 |
} |
124 |
|
125 |
public void itemStateChanged(ItemEvent arg0) { |
126 |
} |
127 |
|
128 |
public void changedUpdate(DocumentEvent arg0) { |
129 |
} |
130 |
|
131 |
public void insertUpdate(DocumentEvent arg0) { |
132 |
} |
133 |
|
134 |
public void removeUpdate(DocumentEvent arg0) { |
135 |
} |
136 |
|
137 |
} |