Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / raw / ui / main / OutputHeaderFormatPanel.java @ 13957

History | View | Annotate | Download (5.03 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.raw.ui.main;
20

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

    
26
import javax.swing.JLabel;
27
import javax.swing.JPanel;
28

    
29
import org.gvsig.rastertools.raw.tools.VRTFormatOptions;
30

    
31
import com.iver.andami.PluginServices;
32
import com.iver.utiles.swing.JComboBox;
33
/**
34
 * This class implements one part of the open raw file panel. It contains the
35
 * combobox to select the "output header format".
36
 * 
37
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
38
 */
39
public class OutputHeaderFormatPanel extends JPanel {
40
  private static final long serialVersionUID = 1244938224958397171L;
41
        private JPanel    labelsPanel            = null;
42
        private JPanel    fieldsPanel            = null;
43
        private JPanel    OutputFormatTextPanel  = null;
44
        private JPanel    outputFormatLabelPanel = null;
45
        private JLabel    outputFormatLabel      = null;
46
        private JComboBox outputFormatText       = null;
47
        private final int WIDTH                  = 510;
48
        private final int HEIGHT                 = 25;
49
        private final int LABELS_PANEL_WIDTH     = 250;
50
        private final int TEXTS_PANEL_WIDTH      = 250;
51
        private final int LABELS_WIDTH           = 245;
52
        private final int LABELS_HEIGHT          = 19;
53
        private final int TEXTS_WIDTH            = 245;
54
        private final int TEXTS_HEIGHT           = 19;
55
        
56
        /**
57
         * This is the default constructor
58
         */
59
        public OutputHeaderFormatPanel() {
60
                super();
61
                initialize();
62
        }
63

    
64
        /**
65
         * This method initializes this
66
         * @return void
67
         */
68
        private void initialize() {
69
                this.setLayout(new GridBagLayout());
70
                this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
71
                this.add(getLabelsPanel(), new GridBagConstraints());
72
                this.add(getFieldsPanel(), new GridBagConstraints());
73
        }
74

    
75
        /**
76
         * This method initializes jPanel3        
77
         * @return javax.swing.JPanel        
78
         */
79
        private JPanel getOutputFormatLabelPanel() {
80
                if (outputFormatLabelPanel == null) {
81
                        outputFormatLabel = new JLabel();
82
                        outputFormatLabel.setText(PluginServices.getText(this, "output_header_format"));
83
                        FlowLayout flowLayout4 = new FlowLayout();
84
                        flowLayout4.setHgap(0);
85
                        flowLayout4.setAlignment(FlowLayout.LEFT);
86
                        flowLayout4.setVgap(1);
87
                        outputFormatLabelPanel = new JPanel();
88
                        outputFormatLabelPanel.setPreferredSize(new Dimension(LABELS_WIDTH, LABELS_HEIGHT));
89
                        outputFormatLabelPanel.setLayout(flowLayout4);
90
                        outputFormatLabelPanel.add(outputFormatLabel, null);
91
                }
92
                return outputFormatLabelPanel;
93
        }
94

    
95
        /**
96
         * This method initializes jPanel        
97
         * @return javax.swing.JPanel        
98
         */
99
        private JPanel getLabelsPanel() {
100
                if (labelsPanel == null) {
101
                        labelsPanel = new JPanel();
102
                        labelsPanel.setPreferredSize(new Dimension(LABELS_PANEL_WIDTH, HEIGHT));
103
                        labelsPanel.add(getOutputFormatLabelPanel(), null);
104
                }
105
                return labelsPanel;
106
        }
107

    
108
        /**
109
         * This method initializes jPanel        
110
         * @return javax.swing.JPanel        
111
         */
112
        private JPanel getFieldsPanel() {
113
                if (fieldsPanel == null) {
114
                        fieldsPanel = new JPanel();
115
                        fieldsPanel.setPreferredSize(new Dimension(TEXTS_PANEL_WIDTH, HEIGHT));
116
                        fieldsPanel.add(getOutputFormatTextPanel(), null);
117
                }
118
                return fieldsPanel;
119
        }
120

    
121
        /**
122
         * This method initializes jPanel        
123
         * @return javax.swing.JPanel        
124
         */
125
        private JPanel getOutputFormatTextPanel() {
126
                if (OutputFormatTextPanel == null) {
127
                        FlowLayout flowLayout = new FlowLayout();
128
                        flowLayout.setHgap(0);
129
                        flowLayout.setAlignment(FlowLayout.LEFT);
130
                        flowLayout.setVgap(1);
131
                        OutputFormatTextPanel = new JPanel();
132
                        OutputFormatTextPanel.setPreferredSize(new Dimension(TEXTS_WIDTH, TEXTS_HEIGHT));
133
                        OutputFormatTextPanel.setLayout(flowLayout);
134
                        OutputFormatTextPanel.add(getOutputFormatText(), null);
135
                }
136
                return OutputFormatTextPanel;
137
        }
138

    
139
        /**
140
         * This method initializes pronunciacionText        
141
         * @return javax.swing.JTextField        
142
         */
143
        private JComboBox getOutputFormatText() {
144
                if (outputFormatText == null) {
145
                        outputFormatText = new JComboBox(VRTFormatOptions.getOutputHeaderFormats());
146
                        outputFormatText.setPreferredSize(new Dimension(TEXTS_WIDTH, TEXTS_HEIGHT));
147
                }
148
                return outputFormatText;
149
        }
150

    
151
        /**
152
         * gets the selected outputformat
153
         * @return
154
         */
155
        public String getOutputHeaderFormat() {
156
                return ((VRTFormatOptions.UIOption) getOutputFormatText().getSelectedItem()).getVrtOptionName();
157
        }
158
}