svn-gvsig-desktop / tags / gvSIGv0_6_1RELEASE / applications / appCatalogYNomenclatorClient / src / es / gva / cit / gazetteer / ui / search / SearchUpperPanel.java @ 5222
History | View | Annotate | Download (9.29 KB)
1 |
|
---|---|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
3 |
*
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
19 |
*
|
20 |
* For more information, contact:
|
21 |
*
|
22 |
* Generalitat Valenciana
|
23 |
* Conselleria d'Infraestructures i Transport
|
24 |
* Av. Blasco Ib??ez, 50
|
25 |
* 46010 VALENCIA
|
26 |
* SPAIN
|
27 |
*
|
28 |
* +34 963862235
|
29 |
* gvsig@gva.es
|
30 |
* www.gvsig.gva.es
|
31 |
*
|
32 |
* or
|
33 |
*
|
34 |
* IVER T.I. S.A
|
35 |
* Salamanca 50
|
36 |
* 46005 Valencia
|
37 |
* Spain
|
38 |
*
|
39 |
* +34 963163400
|
40 |
* dac@iver.es
|
41 |
*/
|
42 |
package es.gva.cit.gazetteer.ui.search; |
43 |
import es.gva.cit.catalogClient.traductor.ITranslator; |
44 |
import es.gva.cit.catalogClient.traductor.Translator; |
45 |
import java.awt.FlowLayout; |
46 |
import java.awt.GridLayout; |
47 |
import javax.swing.BoxLayout; |
48 |
import javax.swing.ImageIcon; |
49 |
import javax.swing.JButton; |
50 |
import javax.swing.JCheckBox; |
51 |
import javax.swing.JLabel; |
52 |
import javax.swing.JPanel; |
53 |
import javax.swing.JTextField; |
54 |
|
55 |
/**
|
56 |
*
|
57 |
*
|
58 |
*
|
59 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
60 |
*/
|
61 |
public class SearchUpperPanel extends JPanel { |
62 |
/**
|
63 |
*
|
64 |
*
|
65 |
*/
|
66 |
private JTextField tituloText = null; |
67 |
/**
|
68 |
*
|
69 |
*
|
70 |
*/
|
71 |
private JPanel panelLabTitulo = null; |
72 |
/**
|
73 |
*
|
74 |
*
|
75 |
*/
|
76 |
private JLabel tituloLabel = null; |
77 |
/**
|
78 |
*
|
79 |
*
|
80 |
*/
|
81 |
private JPanel panelCheckBox = null; |
82 |
/**
|
83 |
*
|
84 |
*
|
85 |
*/
|
86 |
private JPanel panelTextTitulo = null; |
87 |
/**
|
88 |
*
|
89 |
*
|
90 |
*/
|
91 |
private JCheckBox coordinatesCheckBox = null; |
92 |
/**
|
93 |
*
|
94 |
*
|
95 |
*/
|
96 |
private JPanel upperPanel = null; |
97 |
/**
|
98 |
*
|
99 |
*
|
100 |
*/
|
101 |
private JPanel upperLeftPanel = null; |
102 |
/**
|
103 |
*
|
104 |
*
|
105 |
*/
|
106 |
private JPanel upperRightPanel = null; |
107 |
/**
|
108 |
*
|
109 |
*
|
110 |
*/
|
111 |
private JPanel jPanel1 = null; |
112 |
/**
|
113 |
*
|
114 |
*
|
115 |
*/
|
116 |
private JButton sizeButton = null; |
117 |
/**
|
118 |
*
|
119 |
*
|
120 |
*/
|
121 |
private JPanel jPanel4 = null; |
122 |
/**
|
123 |
*
|
124 |
*
|
125 |
*/
|
126 |
private ITranslator translator = null; |
127 |
|
128 |
/**
|
129 |
*
|
130 |
*
|
131 |
*
|
132 |
* @param translator Class to translate the interface
|
133 |
* @param type Server type used to enable/disable some interface components
|
134 |
*/
|
135 |
public SearchUpperPanel(ITranslator translator, String type) { |
136 |
super();
|
137 |
this.translator = translator;
|
138 |
initialize(); |
139 |
disableComponents(type); |
140 |
} |
141 |
|
142 |
/**
|
143 |
* This method initializes this
|
144 |
*
|
145 |
*/
|
146 |
private void initialize() { |
147 |
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
148 |
this.setLocation(0, 0); |
149 |
this.setSize(675, 50); |
150 |
this.setPreferredSize(new java.awt.Dimension(510,50)); |
151 |
this.add(getUpperPanel(), null); |
152 |
} |
153 |
|
154 |
/**
|
155 |
* This method initializes jTextField
|
156 |
*
|
157 |
*
|
158 |
* @return javax.swing.JTextField
|
159 |
*/
|
160 |
private JTextField getTituloText() { |
161 |
if (tituloText == null) { |
162 |
tituloText = new JTextField(); |
163 |
tituloText.setPreferredSize(new java.awt.Dimension(250,20)); |
164 |
} |
165 |
return tituloText;
|
166 |
} |
167 |
|
168 |
/**
|
169 |
* This method initializes jPanel
|
170 |
*
|
171 |
*
|
172 |
* @return javax.swing.JPanel
|
173 |
*/
|
174 |
private JPanel getPanelLabTitulo() { |
175 |
if (panelLabTitulo == null) { |
176 |
GridLayout gridLayout10 = new GridLayout(); |
177 |
tituloLabel = new JLabel(); |
178 |
panelLabTitulo = new JPanel(); |
179 |
panelLabTitulo.setLayout(gridLayout10); |
180 |
tituloLabel.setText(Translator.getText(translator,"name"));
|
181 |
gridLayout10.setRows(1);
|
182 |
panelLabTitulo.add(tituloLabel, null);
|
183 |
} |
184 |
return panelLabTitulo;
|
185 |
} |
186 |
|
187 |
/**
|
188 |
* This method initializes jPanel1
|
189 |
*
|
190 |
*
|
191 |
* @return javax.swing.JPanel
|
192 |
*/
|
193 |
private JPanel getPanelCheckBox() { |
194 |
if (panelCheckBox == null) { |
195 |
panelCheckBox = new JPanel(); |
196 |
panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS)); |
197 |
panelCheckBox.setPreferredSize(new java.awt.Dimension(310,30)); |
198 |
panelCheckBox.add(getCoordinatesCheckBox(), null);
|
199 |
panelCheckBox.add(getJPanel4(), null);
|
200 |
} |
201 |
return panelCheckBox;
|
202 |
} |
203 |
|
204 |
/**
|
205 |
* This method initializes jPanel9
|
206 |
*
|
207 |
*
|
208 |
* @return javax.swing.JPanel
|
209 |
*/
|
210 |
private JPanel getPanelTextTitulo() { |
211 |
if (panelTextTitulo == null) { |
212 |
panelTextTitulo = new JPanel(); |
213 |
panelTextTitulo.add(getTituloText(), null);
|
214 |
} |
215 |
return panelTextTitulo;
|
216 |
} |
217 |
/* (non-Javadoc)
|
218 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
|
219 |
*/
|
220 |
|
221 |
/**
|
222 |
*
|
223 |
*
|
224 |
*
|
225 |
* @return
|
226 |
*/
|
227 |
public String getName() { |
228 |
if (getTituloText().getText().equals("")) { |
229 |
return null; |
230 |
} |
231 |
return getTituloText().getText();
|
232 |
} |
233 |
/* (non-Javadoc)
|
234 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
|
235 |
*/
|
236 |
|
237 |
/**
|
238 |
*
|
239 |
*
|
240 |
*
|
241 |
* @return
|
242 |
*/
|
243 |
public boolean isRestrictAreaClicked() { |
244 |
// TODO Auto-generated method stub
|
245 |
return coordinatesCheckBox.isSelected();
|
246 |
} |
247 |
/* (non-Javadoc)
|
248 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
|
249 |
*/
|
250 |
|
251 |
/**
|
252 |
*
|
253 |
*
|
254 |
*
|
255 |
* @param title
|
256 |
*/
|
257 |
public void setTitle(String title) { |
258 |
getTituloText().setText(title); |
259 |
|
260 |
} |
261 |
|
262 |
/**
|
263 |
* This method initializes jCheckBox
|
264 |
*
|
265 |
*
|
266 |
* @return javax.swing.JCheckBox
|
267 |
*/
|
268 |
public JCheckBox getCoordinatesCheckBox() { |
269 |
if (coordinatesCheckBox == null) { |
270 |
coordinatesCheckBox = new JCheckBox(); |
271 |
coordinatesCheckBox.setText(Translator.getText(translator,"restrictArea"));
|
272 |
} |
273 |
return coordinatesCheckBox;
|
274 |
} |
275 |
|
276 |
/**
|
277 |
* This method initializes jPanel1
|
278 |
*
|
279 |
*
|
280 |
* @return javax.swing.JPanel
|
281 |
*/
|
282 |
private JPanel getUpperPanel() { |
283 |
if (upperPanel == null) { |
284 |
upperPanel = new JPanel(); |
285 |
upperPanel.setLayout(new FlowLayout()); |
286 |
upperPanel.setPreferredSize(new java.awt.Dimension(510,50)); |
287 |
upperPanel.add(getUpperLeftPanel(), null);
|
288 |
upperPanel.add(getUpperRightPanel(), null);
|
289 |
} |
290 |
return upperPanel;
|
291 |
} |
292 |
|
293 |
/**
|
294 |
* This method initializes jPanel1
|
295 |
*
|
296 |
*
|
297 |
* @return javax.swing.JPanel
|
298 |
*/
|
299 |
private JPanel getUpperLeftPanel() { |
300 |
if (upperLeftPanel == null) { |
301 |
upperLeftPanel = new JPanel(); |
302 |
upperLeftPanel.setLayout(new BoxLayout(upperLeftPanel, BoxLayout.Y_AXIS)); |
303 |
upperLeftPanel.setPreferredSize(new java.awt.Dimension(250,45)); |
304 |
upperLeftPanel.add(getPanelLabTitulo(), null);
|
305 |
upperLeftPanel.add(getPanelTextTitulo(), null);
|
306 |
} |
307 |
return upperLeftPanel;
|
308 |
} |
309 |
|
310 |
/**
|
311 |
* This method initializes jPanel4
|
312 |
*
|
313 |
*
|
314 |
* @return javax.swing.JPanel
|
315 |
*/
|
316 |
private JPanel getUpperRightPanel() { |
317 |
if (upperRightPanel == null) { |
318 |
upperRightPanel = new JPanel(); |
319 |
upperRightPanel.setLayout(new BoxLayout(upperRightPanel, BoxLayout.Y_AXIS)); |
320 |
upperRightPanel.setPreferredSize(new java.awt.Dimension(250,45)); |
321 |
upperRightPanel.add(getJPanel1(), null);
|
322 |
upperRightPanel.add(getPanelCheckBox(), null);
|
323 |
} |
324 |
return upperRightPanel;
|
325 |
} |
326 |
|
327 |
/**
|
328 |
* This method initializes jPanel1
|
329 |
*
|
330 |
*
|
331 |
* @return javax.swing.JPanel
|
332 |
*/
|
333 |
private JPanel getJPanel1() { |
334 |
if (jPanel1 == null) { |
335 |
jPanel1 = new JPanel(); |
336 |
jPanel1.setPreferredSize(new java.awt.Dimension(37,15)); |
337 |
} |
338 |
return jPanel1;
|
339 |
} |
340 |
|
341 |
/**
|
342 |
* This method initializes jButton
|
343 |
*
|
344 |
*
|
345 |
* @return javax.swing.JButton
|
346 |
*/
|
347 |
public JButton getSizeButton() { |
348 |
if (sizeButton == null) { |
349 |
sizeButton = new JButton(); |
350 |
setDownIcon(); |
351 |
sizeButton.setPreferredSize(new java.awt.Dimension(18,18)); |
352 |
|
353 |
} |
354 |
return sizeButton;
|
355 |
} |
356 |
|
357 |
/**
|
358 |
* This method initializes jPanel4
|
359 |
*
|
360 |
*
|
361 |
* @return javax.swing.JPanel
|
362 |
*/
|
363 |
private JPanel getJPanel4() { |
364 |
if (jPanel4 == null) { |
365 |
jPanel4 = new JPanel(); |
366 |
jPanel4.add(getSizeButton(), null);
|
367 |
} |
368 |
return jPanel4;
|
369 |
} |
370 |
|
371 |
/**
|
372 |
* Sets the UP icon (to minimize)
|
373 |
*
|
374 |
*/
|
375 |
public void setUpIcon() { |
376 |
sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png")); |
377 |
} |
378 |
|
379 |
/**
|
380 |
* Sets the Down icon (to maximize)
|
381 |
*
|
382 |
*/
|
383 |
public void setDownIcon() { |
384 |
sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png")); |
385 |
} |
386 |
|
387 |
/**
|
388 |
* This method disables the components that represent
|
389 |
* the fileds that the protocol used to do the search doesn't
|
390 |
* support
|
391 |
*
|
392 |
*
|
393 |
* @param type Server type: WFS,WFS-G,ADL,IDEC
|
394 |
*/
|
395 |
private void disableComponents(String type) { |
396 |
//System.out.println("TYPE: " + type);
|
397 |
//System.out.println("SUBTYPE: " + profile);
|
398 |
|
399 |
if (type.equals("WFS-G")){ |
400 |
//getCoordinatesCheckBox().setEnabled(false);
|
401 |
} |
402 |
|
403 |
if (type.equals("WFS")){ |
404 |
getCoordinatesCheckBox().setEnabled(false);
|
405 |
} |
406 |
|
407 |
if (type.equals("ADL")){ |
408 |
getCoordinatesCheckBox().setEnabled(false);
|
409 |
} |
410 |
|
411 |
if (type.equals("IDEC")){ |
412 |
getCoordinatesCheckBox().setEnabled(false);
|
413 |
} |
414 |
|
415 |
} |
416 |
} |
417 |
// @jve:decl-index=0:visual-constraint="10,10"
|