Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / properties / panels / TranspByPixelAndOrSelectorPanel.java @ 10740

History | View | Annotate | Download (3.55 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.rastertools.properties.panels;
20

    
21
import java.awt.FlowLayout;
22
import java.awt.GridBagConstraints;
23
import java.awt.GridBagLayout;
24

    
25
import javax.swing.ButtonGroup;
26
import javax.swing.JPanel;
27
import javax.swing.JRadioButton;
28

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

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

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

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

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

    
124
}