Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / tool / properties / panel / TranspByPixelAndOrSelectorPanel.java @ 2480

History | View | Annotate | Download (3.6 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.raster.tools.app.basic.tool.properties.panel;
23

    
24
import java.awt.FlowLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27

    
28
import javax.swing.ButtonGroup;
29
import javax.swing.JPanel;
30
import javax.swing.JRadioButton;
31

    
32
public class TranspByPixelAndOrSelectorPanel extends JPanel {
33
        final private static long        serialVersionUID = 0;
34
        private JPanel                                 pBorder = null;
35
        private JRadioButton                 rbAnd = null;
36
        private JRadioButton                 rbOr = null;
37
        private ButtonGroup                 group = null;
38
        /**
39
         * This is the default constructor
40
         */
41
        public TranspByPixelAndOrSelectorPanel() {
42
                super();
43
                initialize();
44
        }
45

    
46
        /**
47
         * This method initializes this
48
         * 
49
         * @return void
50
         */
51
        private void initialize() {
52
                FlowLayout flowLayout = new FlowLayout();
53
                flowLayout.setHgap(0);
54
                flowLayout.setVgap(0);
55
                this.setLayout(flowLayout);
56
                this.setSize(60, 60);
57
                this.setPreferredSize(new java.awt.Dimension(52,50));
58
                this.add(getJPanel(), null);
59
                this.getRbAnd().setSelected(true);
60
                group = new ButtonGroup();
61
                group.add(this.getRbAnd());
62
                group.add(this.getRbOr());
63
        }
64

    
65
        /**
66
         * This method initializes jPanel        
67
         *         
68
         * @return javax.swing.JPanel        
69
         */
70
        private JPanel getJPanel() {
71
                if (pBorder == null) {
72
                        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
73
                        gridBagConstraints1.gridx = 0;
74
                        gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
75
                        gridBagConstraints1.gridy = 0;
76
                        GridBagConstraints gridBagConstraints = new GridBagConstraints();
77
                        gridBagConstraints.gridx = 0;
78
                        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
79
                        gridBagConstraints.gridy = 1;
80
                        pBorder = new JPanel();
81
                        pBorder.setLayout(new GridBagLayout());
82
                        pBorder.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
83
                        pBorder.setPreferredSize(new java.awt.Dimension(60,60));
84
                        pBorder.add(getRbAnd(), gridBagConstraints1);
85
                        pBorder.add(getRbOr(), gridBagConstraints);
86
                }
87
                return pBorder;
88
        }
89

    
90
        /**
91
         * This method initializes jRadioButton        
92
         *         
93
         * @return javax.swing.JRadioButton        
94
         */
95
        public JRadioButton getRbAnd() {
96
                if (rbAnd == null) {
97
                        rbAnd = new JRadioButton();
98
                        rbAnd.setText("And");
99
                        rbAnd.setPreferredSize(new java.awt.Dimension(60,25));
100
                }
101
                return rbAnd;
102
        }
103

    
104
        /**
105
         * This method initializes jRadioButton1        
106
         *         
107
         * @return javax.swing.JRadioButton        
108
         */
109
        public JRadioButton getRbOr() {
110
                if (rbOr == null) {
111
                        rbOr = new JRadioButton();
112
                        rbOr.setText("Or");
113
                        rbOr.setPreferredSize(new java.awt.Dimension(60,25));
114
                }
115
                return rbOr;
116
        }
117
        
118
        /**
119
         * Activa o desactiva el control
120
         * @param enable True activa el control y false lo desactiva
121
         */
122
        public void setControlEnabled(boolean enabled){
123
                this.getRbAnd().setEnabled(enabled);
124
                this.getRbOr().setEnabled(enabled);
125
        }
126

    
127
}