gvsig-raster / org.gvsig.raster.wcs / trunk / org.gvsig.raster.wcs / org.gvsig.raster.wcs.app / org.gvsig.raster.wcs.app.wcsclient / src / main / java / org / gvsig / raster / wcs / app / wcsclient / gui / panel / FormatPanel.java @ 418
History | View | Annotate | Download (8.17 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 |
package org.gvsig.raster.wcs.app.wcsclient.gui.panel; |
24 |
|
25 |
import java.awt.BorderLayout; |
26 |
import java.awt.GridBagConstraints; |
27 |
import java.awt.GridBagLayout; |
28 |
|
29 |
import javax.swing.JCheckBox; |
30 |
import javax.swing.JComboBox; |
31 |
import javax.swing.JList; |
32 |
import javax.swing.JPanel; |
33 |
import javax.swing.JScrollPane; |
34 |
|
35 |
import org.gvsig.andami.PluginServices; |
36 |
|
37 |
|
38 |
/**
|
39 |
* Format Panel
|
40 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
41 |
*/
|
42 |
public class FormatPanel extends JPanel { |
43 |
private static final long serialVersionUID = 1L; |
44 |
private JPanel jPanel2 = null; |
45 |
private JPanel jPanel3 = null; |
46 |
private JPanel jPanel4 = null; |
47 |
private JScrollPane jScrollPane1 = null; |
48 |
private JScrollPane jScrollPane2 = null; |
49 |
private JList lstCRSs = null; |
50 |
private JList lstFormats = null; |
51 |
private JComboBox cmbInterpolationMethods = null; |
52 |
private JCheckBox chkUseInterpolationMethod = null; |
53 |
private WCSParamsPanel parent = null; |
54 |
|
55 |
public FormatPanel() {
|
56 |
init(); |
57 |
} |
58 |
|
59 |
/**
|
60 |
* Sets the parent panel
|
61 |
* @param parent
|
62 |
*/
|
63 |
public void setWCSParamsPanel(WCSParamsPanel parent) { |
64 |
this.parent = parent;
|
65 |
} |
66 |
|
67 |
public void init() { |
68 |
setLayout(new GridBagLayout()); |
69 |
|
70 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
71 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
72 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER;
|
73 |
gridBagConstraints1.weightx = 1.0;
|
74 |
gridBagConstraints1.weighty = 1.0;
|
75 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
76 |
gridBagConstraints1.gridy = 1;
|
77 |
add(getJPanel2(), gridBagConstraints1); |
78 |
|
79 |
gridBagConstraints1.gridy = 0;
|
80 |
add(getJPanel3(), gridBagConstraints1); |
81 |
} |
82 |
|
83 |
/**
|
84 |
* This method initializes jScrollPane2
|
85 |
*
|
86 |
* @return javax.swing.JScrollPane
|
87 |
*/
|
88 |
private JScrollPane getJScrollPane2() { |
89 |
if (jScrollPane2 == null) { |
90 |
jScrollPane2 = new JScrollPane(); |
91 |
jScrollPane2.setViewportView(getLstCRSs()); |
92 |
} |
93 |
return jScrollPane2;
|
94 |
} |
95 |
|
96 |
/**
|
97 |
* This method initializes lstCRSs
|
98 |
*
|
99 |
* @return javax.swing.JList
|
100 |
*/
|
101 |
public JList getLstCRSs() { |
102 |
if (lstCRSs == null) { |
103 |
lstCRSs = new JList(); |
104 |
lstCRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
105 |
lstCRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
106 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
107 |
parent.fireWizardComplete(parent.isCorrectlyConfigured()); |
108 |
} |
109 |
}); |
110 |
} |
111 |
return lstCRSs;
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* This method initializes jPanel2
|
116 |
*
|
117 |
* @return javax.swing.JPanel
|
118 |
*/
|
119 |
private JPanel getJPanel2() { |
120 |
if (jPanel2 == null) { |
121 |
jPanel2 = new JPanel(new BorderLayout()); |
122 |
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( |
123 |
null, PluginServices.getText(this, "seleccionar_CRS"), |
124 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
125 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
126 |
jPanel2.add(getJScrollPane2(), BorderLayout.CENTER);
|
127 |
} |
128 |
return jPanel2;
|
129 |
} |
130 |
|
131 |
/**
|
132 |
* This method initializes jScrollPane1
|
133 |
*
|
134 |
* @return javax.swing.JScrollPane
|
135 |
*/
|
136 |
private JScrollPane getJScrollPane1() { |
137 |
if (jScrollPane1 == null) { |
138 |
jScrollPane1 = new JScrollPane(); |
139 |
jScrollPane1.setViewportView(getLstFormats()); |
140 |
} |
141 |
return jScrollPane1;
|
142 |
} |
143 |
|
144 |
/**
|
145 |
* This method initializes lstFormats
|
146 |
*
|
147 |
* @return javax.swing.JList
|
148 |
*/
|
149 |
public JList getLstFormats() { |
150 |
if (lstFormats == null) { |
151 |
lstFormats = new JList(); |
152 |
lstFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
153 |
lstFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
154 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
155 |
parent.fireWizardComplete(parent.isCorrectlyConfigured()); |
156 |
} |
157 |
}); |
158 |
} |
159 |
return lstFormats;
|
160 |
} |
161 |
|
162 |
/**
|
163 |
* This method initializes jPanel3
|
164 |
*
|
165 |
* @return javax.swing.JPanel
|
166 |
*/
|
167 |
private JPanel getJPanel3() { |
168 |
if (jPanel3 == null) { |
169 |
|
170 |
jPanel3 = new JPanel(new GridBagLayout()); |
171 |
|
172 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
173 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
174 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER;
|
175 |
gridBagConstraints1.weightx = 1.0;
|
176 |
gridBagConstraints1.weighty = 1.0;
|
177 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
178 |
|
179 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
180 |
null, PluginServices.getText(this, "seleccionar_formato"), |
181 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
182 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
183 |
jPanel3.add(getJScrollPane1(), gridBagConstraints1); |
184 |
|
185 |
gridBagConstraints1.gridx = 1;
|
186 |
jPanel3.add(getJPanel4(), gridBagConstraints1); |
187 |
} |
188 |
return jPanel3;
|
189 |
} |
190 |
|
191 |
/**
|
192 |
* This method initializes jPanel3
|
193 |
*
|
194 |
* @return javax.swing.JPanel
|
195 |
*/
|
196 |
private JPanel getJPanel4() { |
197 |
if (jPanel4 == null) { |
198 |
jPanel4 = new JPanel(new GridBagLayout()); |
199 |
|
200 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
201 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
|
202 |
gridBagConstraints1.weightx = 1.0;
|
203 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
204 |
|
205 |
jPanel4.add(getCmbInterpolationMethods(), gridBagConstraints1); |
206 |
gridBagConstraints1.gridy = 1;
|
207 |
jPanel4.add(getChkUseInterpolationMethod(), gridBagConstraints1); |
208 |
|
209 |
gridBagConstraints1.fill = GridBagConstraints.BOTH;
|
210 |
gridBagConstraints1.weighty = 1.0;
|
211 |
gridBagConstraints1.gridy = 2;
|
212 |
jPanel4.add(new JPanel(), gridBagConstraints1); |
213 |
} |
214 |
return jPanel4;
|
215 |
} |
216 |
|
217 |
/**
|
218 |
* This method initializes jComboBox
|
219 |
*
|
220 |
* @return javax.swing.JComboBox
|
221 |
*/
|
222 |
public JComboBox getCmbInterpolationMethods() { |
223 |
if (cmbInterpolationMethods == null) { |
224 |
cmbInterpolationMethods = new JComboBox(); |
225 |
cmbInterpolationMethods.setEnabled(false);
|
226 |
cmbInterpolationMethods.setEditable(false);
|
227 |
} |
228 |
return cmbInterpolationMethods;
|
229 |
} |
230 |
|
231 |
/**
|
232 |
* This method initializes jCheckBox
|
233 |
*
|
234 |
* @return javax.swing.JCheckBox
|
235 |
*/
|
236 |
public JCheckBox getChkUseInterpolationMethod() { |
237 |
if (chkUseInterpolationMethod == null) { |
238 |
chkUseInterpolationMethod = new JCheckBox(); |
239 |
chkUseInterpolationMethod.setText(PluginServices.getText(this, "use_interpolation_method")); |
240 |
chkUseInterpolationMethod.setSelected(false);
|
241 |
chkUseInterpolationMethod.setEnabled(false);
|
242 |
chkUseInterpolationMethod.addItemListener(new java.awt.event.ItemListener() {
|
243 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
244 |
cmbInterpolationMethods.setEnabled(chkUseInterpolationMethod.isSelected()); |
245 |
} |
246 |
}); |
247 |
} |
248 |
return chkUseInterpolationMethod;
|
249 |
} |
250 |
|
251 |
/**
|
252 |
* Returns the index of the CRS within the CRS list.
|
253 |
* @param crs
|
254 |
* @return The CRS's index if it exists, -1 if it not exists.
|
255 |
*/
|
256 |
public int getSRSIndex(String crs) { |
257 |
for (int i = 0; i < getLstCRSs().getModel().getSize(); i++){ |
258 |
if (crs.equals(getLstCRSs().getModel().getElementAt(i))) {
|
259 |
return i;
|
260 |
} |
261 |
} |
262 |
return -1; |
263 |
} |
264 |
|
265 |
/**
|
266 |
* Returns the index of the format within the formats list.
|
267 |
* @return The format's index if it exists, -1 if it not exists.
|
268 |
*/
|
269 |
public int getFormatIndex(String format) { |
270 |
for (int i = 0; i < getLstFormats().getModel().getSize(); i++){ |
271 |
if (format.equals(getLstFormats().getModel().getElementAt(i))) {
|
272 |
return i;
|
273 |
} |
274 |
} |
275 |
return -1; |
276 |
} |
277 |
} |
278 |
|