svn-gvsig-desktop / trunk / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / EditionPanel.java @ 3746
History | View | Annotate | Download (8.93 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: EditionPanel.java 3746 2006-01-24 14:40:18Z jaume $
|
45 |
* $Log$
|
46 |
* Revision 1.2 2006-01-24 14:36:33 jaume
|
47 |
* This is the new version
|
48 |
*
|
49 |
* Revision 1.1.2.2 2006/01/11 12:20:30 jaume
|
50 |
* *** empty log message ***
|
51 |
*
|
52 |
* Revision 1.1.2.1 2006/01/10 13:11:38 jaume
|
53 |
* *** empty log message ***
|
54 |
*
|
55 |
* Revision 1.1.2.2 2006/01/10 11:33:31 jaume
|
56 |
* Time dimension working against Jet Propulsion Laboratory's WMS server
|
57 |
*
|
58 |
* Revision 1.1.2.1 2006/01/09 18:10:38 jaume
|
59 |
* casi con el time dimension
|
60 |
*
|
61 |
*
|
62 |
*/
|
63 |
/**
|
64 |
*
|
65 |
*/
|
66 |
package com.iver.cit.gvsig.gui.panels; |
67 |
|
68 |
import java.awt.Component; |
69 |
import java.awt.GridLayout; |
70 |
import java.awt.event.ActionEvent; |
71 |
import java.awt.event.ActionListener; |
72 |
|
73 |
import javax.swing.JLabel; |
74 |
import javax.swing.JPanel; |
75 |
|
76 |
import com.iver.andami.PluginServices; |
77 |
import com.iver.andami.ui.mdiFrame.JButton; |
78 |
import com.iver.andami.ui.mdiManager.View; |
79 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
80 |
import com.iver.cit.gvsig.fmap.layers.IFMapWMSDimension; |
81 |
import com.iver.cit.gvsig.gui.beans.DefaultBean; |
82 |
import com.iver.cit.gvsig.gui.beans.listeners.BeanListener; |
83 |
import com.iver.cit.gvsig.gui.beans.Pager; |
84 |
|
85 |
/**
|
86 |
* @author jaume
|
87 |
*
|
88 |
*/
|
89 |
public class EditionPanel extends DefaultBean implements View { |
90 |
private Integer min; |
91 |
private Integer max; |
92 |
private IFMapWMSDimension dim;
|
93 |
private ViewInfo mViewInfo;
|
94 |
private JPanel minPanel = null; |
95 |
private JPanel maxPanel = null; |
96 |
private JPanel btnPanel = null; |
97 |
private JButton btnOk = null; |
98 |
private JButton btnCancel = null; |
99 |
private Pager minBrowser = null; |
100 |
private Pager maxBrowser = null; |
101 |
private JLabel lblPeriod = null; |
102 |
private JLabel lblPeriod1 = null; |
103 |
private JLabel lblMin = null; |
104 |
private JLabel lblMin1 = null; |
105 |
private JLabel lblMax1; |
106 |
private JLabel lblMax; |
107 |
|
108 |
public EditionPanel(){
|
109 |
super();
|
110 |
initialize(); |
111 |
} |
112 |
|
113 |
private void initialize() { |
114 |
GridLayout gridLayout = new GridLayout(); |
115 |
gridLayout.setRows(5);
|
116 |
gridLayout.setColumns(1);
|
117 |
this.setSize(195, 255); |
118 |
this.setLayout(gridLayout);
|
119 |
this.add(getMinPanel(), null); |
120 |
this.add(getMinBrowser(), null); |
121 |
this.add(getMaxPanel(), null); |
122 |
this.add(getMaxBrowser(), null); |
123 |
this.add(getBtnPanel(), null); |
124 |
} |
125 |
|
126 |
/**
|
127 |
* @return
|
128 |
*/
|
129 |
private Pager getMaxBrowser() {
|
130 |
if (maxBrowser==null){ |
131 |
maxBrowser = new Pager();
|
132 |
maxBrowser.addListener(new BeanListener(){
|
133 |
public void beanValueChanged(Object value) { |
134 |
max = (Integer) value;
|
135 |
lblMax1.setText(dim.valueAt(max.intValue())); |
136 |
} |
137 |
}); |
138 |
} |
139 |
return maxBrowser;
|
140 |
} |
141 |
|
142 |
/**
|
143 |
* @return
|
144 |
*/
|
145 |
private Pager getMinBrowser() {
|
146 |
if (minBrowser==null){ |
147 |
minBrowser = new Pager();
|
148 |
minBrowser.addListener(new BeanListener() {
|
149 |
|
150 |
public void beanValueChanged(Object value) { |
151 |
min = (Integer) value;
|
152 |
lblMin1.setText(dim.valueAt(min.intValue())); |
153 |
} |
154 |
|
155 |
}); |
156 |
} |
157 |
return minBrowser;
|
158 |
} |
159 |
|
160 |
/**
|
161 |
* @return
|
162 |
*/
|
163 |
private JPanel getBtnPanel() { |
164 |
if (btnPanel == null){ |
165 |
btnPanel = new JPanel(); |
166 |
GridLayout gridLayout = new GridLayout(); |
167 |
gridLayout.setRows(1);
|
168 |
gridLayout.setColumns(1);
|
169 |
getBtnPanel().add(getBtnOk()); |
170 |
getBtnPanel().add(getBtnCancel()); |
171 |
|
172 |
} |
173 |
return btnPanel;
|
174 |
} |
175 |
|
176 |
/**
|
177 |
* @return
|
178 |
*/
|
179 |
private Component getBtnOk() { |
180 |
if (btnOk == null){ |
181 |
btnOk = new JButton(); |
182 |
btnOk.setText(PluginServices.getText(this, "aceptar")); |
183 |
btnOk.setBounds(40, 5, 20, 60); |
184 |
btnOk.addActionListener(new ActionListener() { |
185 |
public void actionPerformed(ActionEvent e) { |
186 |
execute("OK");
|
187 |
} |
188 |
|
189 |
}); |
190 |
} |
191 |
return btnOk; }
|
192 |
|
193 |
/**
|
194 |
* @return
|
195 |
*/
|
196 |
private JButton getBtnCancel() { |
197 |
if (btnCancel == null){ |
198 |
btnCancel = new JButton(); |
199 |
btnCancel.setText(PluginServices.getText(this, "cancelar")); |
200 |
btnCancel.setBounds(105, 5, 20, 60); |
201 |
btnCancel.addActionListener(new ActionListener() { |
202 |
public void actionPerformed(ActionEvent e) { |
203 |
execute("Cancel");
|
204 |
} |
205 |
}); |
206 |
} |
207 |
return btnCancel;
|
208 |
} |
209 |
|
210 |
public ViewInfo getViewInfo() {
|
211 |
if (mViewInfo == null) |
212 |
{ |
213 |
mViewInfo=new ViewInfo(ViewInfo.MODALDIALOG);
|
214 |
mViewInfo.setWidth(195);
|
215 |
mViewInfo.setHeight(255);
|
216 |
} |
217 |
return mViewInfo;
|
218 |
} |
219 |
|
220 |
public void setProperties(IFMapWMSDimension _dim, Integer _min, Integer _max){ |
221 |
min = _min; |
222 |
max = _max; |
223 |
dim = _dim; |
224 |
|
225 |
getViewInfo().setTitle(PluginServices.getText(this, "edit")+" "+dim.getName()); |
226 |
|
227 |
getMinBrowser().setItemCount(dim.valueCount()); |
228 |
getMinBrowser().setValue(min.intValue(), false);
|
229 |
|
230 |
getMaxBrowser().setItemCount(dim.valueCount()); |
231 |
getMaxBrowser().setValue(max.intValue(), false);
|
232 |
|
233 |
lblMin1.setText(dim.valueAt(min.intValue())); |
234 |
lblMax1.setText(dim.valueAt(max.intValue())); |
235 |
|
236 |
} |
237 |
|
238 |
|
239 |
|
240 |
/**
|
241 |
* This method initializes jPanel
|
242 |
*
|
243 |
* @return javax.swing.JPanel
|
244 |
*/
|
245 |
private JPanel getMinPanel() { |
246 |
if (minPanel == null) { |
247 |
lblMin1 = new JLabel(); |
248 |
lblMin1.setText("");
|
249 |
lblMin1.setFont(new java.awt.Font("MS Sans Serif", java.awt.Font.BOLD, 11)); |
250 |
lblMin1.setBounds(52, 32, 138, 15); |
251 |
lblMin = new JLabel(); |
252 |
lblMin.setText(PluginServices.getText(this, "from")); |
253 |
lblMin.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
254 |
lblMin.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
255 |
lblMin.setBounds(5, 32, 41, 15); |
256 |
minPanel = new JPanel(); |
257 |
minPanel.setLayout(null);
|
258 |
minPanel.add(lblMin, null);
|
259 |
minPanel.add(lblMin1, null);
|
260 |
lblPeriod1 = new JLabel(); |
261 |
lblPeriod1.setText("");
|
262 |
lblPeriod1.setFont(new java.awt.Font("MS Sans Serif", java.awt.Font.BOLD, 11)); |
263 |
lblPeriod1.setBounds(52, 3, 138, 15); |
264 |
lblPeriod = new JLabel(); |
265 |
lblPeriod.setText(PluginServices.getText(this, "period")); |
266 |
lblPeriod.setBounds(5, 3, 41, 15); |
267 |
|
268 |
minPanel.add(lblPeriod, null);
|
269 |
minPanel.add(lblPeriod1, null);
|
270 |
} |
271 |
return minPanel;
|
272 |
} |
273 |
|
274 |
/**
|
275 |
* This method initializes jPanel1
|
276 |
*
|
277 |
* @return javax.swing.JPanel
|
278 |
*/
|
279 |
private JPanel getMaxPanel() { |
280 |
if (maxPanel == null) { |
281 |
lblMax1 = new JLabel(); |
282 |
|
283 |
lblMax1.setBounds(52, 14, 138, 15); |
284 |
lblMax1.setFont(new java.awt.Font("MS Sans Serif", java.awt.Font.BOLD, 11)); |
285 |
lblMax = new JLabel(); |
286 |
lblMax.setText(PluginServices.getText(this, "to")); |
287 |
lblMax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
288 |
lblMax.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
289 |
lblMax.setBounds(5, 14, 41, 15); |
290 |
|
291 |
maxPanel = new JPanel(); |
292 |
maxPanel.setLayout(null);
|
293 |
maxPanel.add(lblMax1); |
294 |
maxPanel.add(lblMax); |
295 |
} |
296 |
return maxPanel;
|
297 |
} |
298 |
|
299 |
private void execute(String actionCommand) { |
300 |
if (actionCommand.equals("OK")){ |
301 |
Object[] value = new Object[3]; |
302 |
value[0] = min;
|
303 |
value[1] = max;
|
304 |
value[2] = lblMin1.getText()+"/"+lblMax1.getText(); |
305 |
callValueChanged(value); |
306 |
} |
307 |
PluginServices.getMDIManager().closeView(this);
|
308 |
} |
309 |
|
310 |
} // @jve:decl-index=0:visual-constraint="10,10"
|