Statistics
| Revision:

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 / execution / panel / TypicalOrAdvancedPanel.java @ 40560

History | View | Annotate | Download (4.08 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
package org.gvsig.installer.swing.impl.execution.panel;
25

    
26
import java.awt.BorderLayout;
27
import java.awt.GridBagConstraints;
28
import java.awt.GridBagLayout;
29
import java.awt.Insets;
30
import java.awt.event.ItemEvent;
31
import java.awt.event.ItemListener;
32

    
33
import javax.swing.ButtonGroup;
34
import javax.swing.JPanel;
35
import javax.swing.JRadioButton;
36
import javax.swing.event.DocumentEvent;
37
import javax.swing.event.DocumentListener;
38

    
39
import org.gvsig.installer.swing.api.SwingInstallerLocator;
40
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
41

    
42
/**
43
 * @author gvSIG Team
44
 * @version $Id$
45
 * 
46
 */
47
public class TypicalOrAdvancedPanel extends JPanel implements ItemListener,
48
                DocumentListener {
49

    
50
        private static final long serialVersionUID = 8488517767926838568L;
51

    
52
        protected DefaultSwingInstallerManager swingInstallerManager = null;
53

    
54
        private JPanel northPanel;
55
        private JRadioButton typicalModeRadioButton;
56
        private JRadioButton advancedModeRadioButton;
57
        private ButtonGroup buttonGroup;
58

    
59
        public TypicalOrAdvancedPanel() {
60
                swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator
61
                                .getSwingInstallerManager();
62
                initComponents();
63
                initListeners();
64
                typicalModeRadioButton.setSelected(true);
65

    
66
        }
67

    
68
        private void initListeners() {
69
                typicalModeRadioButton.addItemListener(this);
70
                advancedModeRadioButton.addItemListener(this);
71
        }
72

    
73
        private void initComponents() {
74
                java.awt.GridBagConstraints gridBagConstraints;
75

    
76
                northPanel = new JPanel();
77
                typicalModeRadioButton = new JRadioButton();
78
                advancedModeRadioButton = new JRadioButton();
79

    
80
                buttonGroup = new ButtonGroup();
81

    
82
                buttonGroup.add(typicalModeRadioButton);
83
                buttonGroup.add(advancedModeRadioButton);
84

    
85
                setLayout(new BorderLayout());
86

    
87
                northPanel.setLayout(new GridBagLayout());
88

    
89
                typicalModeRadioButton.setText(swingInstallerManager
90
                                .getText("_typical_installation"));
91
                gridBagConstraints = new GridBagConstraints();
92
                gridBagConstraints.gridx = 0;
93
                gridBagConstraints.gridy = 1;
94
                gridBagConstraints.anchor = GridBagConstraints.WEST;
95
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
96
                northPanel.add(typicalModeRadioButton, gridBagConstraints);
97

    
98
                advancedModeRadioButton.setText(swingInstallerManager
99
                                .getText("_advanced_installation"));
100
                gridBagConstraints = new GridBagConstraints();
101
                gridBagConstraints.gridx = 0;
102
                gridBagConstraints.gridy = 2;
103
                gridBagConstraints.anchor = GridBagConstraints.WEST;
104
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
105
                northPanel.add(advancedModeRadioButton, gridBagConstraints);
106

    
107
                add(northPanel, java.awt.BorderLayout.WEST);
108
        }
109

    
110
        protected boolean isTypicalModeSelected() {
111
                return typicalModeRadioButton.isSelected();
112
        }
113

    
114
        protected boolean isAdvancedModeSelected() {
115
                return advancedModeRadioButton.isSelected();
116
        }
117

    
118
        protected void setEnableTypicalMode(boolean active) {
119
                if (active) {
120
                        typicalModeRadioButton.setSelected(true);
121
                } else {
122
                        advancedModeRadioButton.setSelected(true);
123
                }
124
                typicalModeRadioButton.setEnabled(active);
125
        }
126

    
127
        public void itemStateChanged(ItemEvent arg0) {
128
        }
129

    
130
        public void changedUpdate(DocumentEvent arg0) {
131
        }
132

    
133
        public void insertUpdate(DocumentEvent arg0) {
134
        }
135

    
136
        public void removeUpdate(DocumentEvent arg0) {
137
        }
138

    
139
}