Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.algorithm / org.gvsig.raster.tools.algorithm.swing / org.gvsig.raster.tools.algorithm.swing.impl / src / main / java / org / gvsig / raster / tools / algorithm / swing / impl / maskthreshold / OutputMaskThresholdImpl.java @ 1306

History | View | Annotate | Download (3.12 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.algorithm.swing.impl.maskthreshold;
23

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

    
27
import javax.swing.BorderFactory;
28
import javax.swing.JPanel;
29

    
30
import org.gvsig.i18n.Messages;
31
import org.gvsig.raster.swing.listener.PanelChangeListener;
32
import org.gvsig.raster.tools.algorithm.swing.impl.bean.combotext.ComboTextImpl;
33
import org.gvsig.raster.tools.algorithm.swing.impl.bean.inputlayer.InputLayerImpl;
34

    
35
/**
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public class OutputMaskThresholdImpl extends JPanel {
39
        private static final long   serialVersionUID    = 1L;
40
        private ComboTextImpl       satisfyCombo        = null;
41
        private InputLayerImpl      layerSelection      = null;
42
        
43
        public OutputMaskThresholdImpl() {
44
                init();
45
        }
46
        
47
        private void init() {        
48
                this.setLayout(new GridBagLayout());
49
                setBorder(BorderFactory.createTitledBorder(Messages.getText("output")));
50
                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
51
                gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
52
                gridBagConstraints1.weightx = 1;
53
                gridBagConstraints1.insets = new java.awt.Insets(0, 0, 4, 0);
54
                
55
                gridBagConstraints1.gridx = 0;
56
                gridBagConstraints1.gridy = 0;
57
                this.add(getMethodOutput(), gridBagConstraints1);
58
                
59
                gridBagConstraints1.gridx = 0;
60
                gridBagConstraints1.gridy = 1;
61
                this.add(getLayerSelection(), gridBagConstraints1);
62
                
63
                gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
64
                gridBagConstraints1.weightx = 1;
65
                gridBagConstraints1.weighty = 1;
66
                gridBagConstraints1.gridx = 0;
67
                gridBagConstraints1.gridy = 2;
68
                this.add(new JPanel(), gridBagConstraints1);
69
        }
70

    
71
        public ComboTextImpl getMethodOutput() {
72
                if(satisfyCombo == null){
73
                        satisfyCombo = new ComboTextImpl(
74
                                        new String[]{Messages.getText("method_output"), ""}, false, true);
75
                        satisfyCombo.getTextField().setEnabled(false);
76
                }
77
                return satisfyCombo;
78
        }
79

    
80
        public InputLayerImpl getLayerSelection() {
81
                if(layerSelection == null) {
82
                        layerSelection = new InputLayerImpl(null, false, true);
83
                        layerSelection.setEnabled(false);
84
                }
85
                return layerSelection;
86
        }
87
        
88
        public void addPanelChangeEvent(PanelChangeListener listener) {
89
                getLayerSelection().addPanelChangeEvent(listener);
90
                getMethodOutput().addPanelChangeEvent(listener);
91
        }
92
}