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 / SelectInstallersPanel.java @ 32401

History | View | Annotate | Download (4.15 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.execution.panel;
29

    
30
import java.awt.BorderLayout;
31
import java.awt.GridBagConstraints;
32
import java.awt.GridBagLayout;
33
import java.awt.Insets;
34
import java.awt.event.ItemEvent;
35
import java.awt.event.ItemListener;
36
import java.io.File;
37

    
38
import javax.swing.ButtonGroup;
39
import javax.swing.JPanel;
40
import javax.swing.JRadioButton;
41
import javax.swing.JTextField;
42

    
43
import org.gvsig.gui.beans.openfile.FileTextField;
44
import org.gvsig.installer.swing.api.SwingInstallerLocator;
45
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
46

    
47
/**
48
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
49
 */
50
public class SelectInstallersPanel extends JPanel implements ItemListener{
51
        protected DefaultSwingInstallerManager swingInstallerManager = null;
52
        private JRadioButton fileRadioButton;
53
        private ButtonGroup buttonGroup;
54
    private JPanel northPanel;
55
    private FileTextField selectFileText;
56
    private JRadioButton standardRadionButton;
57
    
58
    public SelectInstallersPanel() {
59
                super();
60
                swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager();
61
                initComponents();
62
                initListeners();
63
                standardRadionButton.setSelected(true);
64
        }
65
    
66
    private void initListeners() {
67
                standardRadionButton.addItemListener(this);
68
                fileRadioButton.addItemListener(this);
69
        }
70

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

    
74
         northPanel = new JPanel();
75
         standardRadionButton = new JRadioButton();
76
         fileRadioButton = new JRadioButton();
77
         selectFileText = new FileTextField();
78
         buttonGroup = new ButtonGroup();
79
         
80
         buttonGroup.add(standardRadionButton);
81
         buttonGroup.add(fileRadioButton);
82

    
83
         setLayout(new BorderLayout());
84

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

    
87
         standardRadionButton.setText("Standard installation");
88
         gridBagConstraints = new GridBagConstraints();
89
         gridBagConstraints.anchor = GridBagConstraints.WEST;
90
         gridBagConstraints.insets = new Insets(2, 2, 2, 2);
91
         northPanel.add(standardRadionButton, gridBagConstraints);
92

    
93
         fileRadioButton.setText("Installation from file");
94
         gridBagConstraints = new GridBagConstraints();
95
         gridBagConstraints.gridx = 0;
96
         gridBagConstraints.gridy = 1;
97
         gridBagConstraints.anchor = GridBagConstraints.WEST;
98
         gridBagConstraints.insets = new Insets(2, 2, 2, 2);
99
         northPanel.add(fileRadioButton, gridBagConstraints);
100
         gridBagConstraints = new GridBagConstraints();
101
         gridBagConstraints.gridx = 0;
102
         gridBagConstraints.gridy = 2;
103
         gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
104
         gridBagConstraints.weightx = 1.0;
105
         gridBagConstraints.insets = new Insets(2, 20, 2, 2);
106
         northPanel.add(selectFileText, gridBagConstraints);
107

    
108
         add(northPanel, java.awt.BorderLayout.NORTH);
109
    }
110
        
111
        public void itemStateChanged(ItemEvent e) {
112
                selectFileText.setEnabled(fileRadioButton.isSelected());                
113
        }
114
        
115
        public File getSelectedFile(){
116
                return selectFileText.getSelectedFile();
117
        }
118
        
119
        public boolean isStandardSelected(){
120
                return standardRadionButton.isSelected();
121
        }
122
    
123
    
124
}
125