Statistics
| Revision:

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

History | View | Annotate | Download (4.38 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 =
59
            (DefaultSwingInstallerManager) SwingInstallerLocator
60
                .getSwingInstallerManager();
61
        initComponents();
62
        initListeners();
63
        typicalModeRadioButton.setSelected(true);
64

    
65
    }
66

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

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

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

    
79
        buttonGroup = new ButtonGroup();
80

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

    
84
        setLayout(new BorderLayout());
85

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

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

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

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

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

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

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

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

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

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

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

    
138
}