svn-gvsig-desktop / branches / v10 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / search / SearchUpperPanel.java @ 8604
History | View | Annotate | Download (10.5 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.catalogClient.ui.search; |
43 |
import es.gva.cit.catalogClient.querys.Query; |
44 |
import es.gva.cit.catalogClient.schemas.Schemas; |
45 |
|
46 |
import com.iver.utiles.swing.JComboBox; |
47 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
48 |
import java.awt.FlowLayout; |
49 |
import java.awt.GridLayout; |
50 |
import javax.swing.BoxLayout; |
51 |
import javax.swing.ImageIcon; |
52 |
import javax.swing.JButton; |
53 |
import javax.swing.JCheckBox; |
54 |
import javax.swing.JLabel; |
55 |
import javax.swing.JPanel; |
56 |
import javax.swing.JTextField; |
57 |
|
58 |
import org.gvsig.i18n.Messages; |
59 |
import java.awt.Dimension; |
60 |
|
61 |
/**
|
62 |
*
|
63 |
*
|
64 |
*
|
65 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
66 |
*/
|
67 |
public class SearchUpperPanel extends JPanel { |
68 |
/**
|
69 |
*
|
70 |
*
|
71 |
*/
|
72 |
private JComboBox serviceText = null; |
73 |
/**
|
74 |
*
|
75 |
*
|
76 |
*/
|
77 |
private JPanel panelLabTitulo = null; |
78 |
/**
|
79 |
*
|
80 |
*
|
81 |
*/
|
82 |
private JLabel tituloLabel = null; |
83 |
/**
|
84 |
*
|
85 |
*
|
86 |
*/
|
87 |
private JPanel panelCheckBox = null; |
88 |
/**
|
89 |
*
|
90 |
*
|
91 |
*/
|
92 |
private JPanel panelTextTitulo = null; |
93 |
/**
|
94 |
*
|
95 |
*
|
96 |
*/
|
97 |
private JCheckBox coordinatesCheckBox = null; |
98 |
/**
|
99 |
*
|
100 |
*
|
101 |
*/
|
102 |
private JPanel upperPanel = null; |
103 |
/**
|
104 |
*
|
105 |
*
|
106 |
*/
|
107 |
private JPanel upperLeftPanel = null; |
108 |
/**
|
109 |
*
|
110 |
*
|
111 |
*/
|
112 |
private JPanel upperRightPanel = null; |
113 |
/**
|
114 |
*
|
115 |
*
|
116 |
*/
|
117 |
private JButton sizeButton = null; |
118 |
/**
|
119 |
*
|
120 |
*
|
121 |
*/
|
122 |
private JPanel jPanel4 = null; |
123 |
private JPanel jPanel = null; |
124 |
private JLabel jLabel = null; |
125 |
private JPanel jPanel2 = null; |
126 |
private JTextField tituloText = null; |
127 |
private JPanel jPanel3 = null; |
128 |
/**
|
129 |
* This method initializes
|
130 |
*
|
131 |
*
|
132 |
* @param translator
|
133 |
* @param type
|
134 |
* @param profile
|
135 |
*/
|
136 |
public SearchUpperPanel(String type, String profile) { |
137 |
super();
|
138 |
initialize(); |
139 |
disableComponents(type,profile); |
140 |
} |
141 |
|
142 |
/**
|
143 |
* This method initializes this
|
144 |
*
|
145 |
*/
|
146 |
private void initialize() { |
147 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
148 |
setLocation(0, 0); |
149 |
setSize(675, 100); |
150 |
setPreferredSize(new java.awt.Dimension(510,75)); |
151 |
add(getUpperPanel(), null);
|
152 |
} |
153 |
|
154 |
/**
|
155 |
* This method initializes jTextField
|
156 |
*
|
157 |
*
|
158 |
* @return javax.swing.JTextField
|
159 |
*/
|
160 |
private JComboBox getServiceText() { |
161 |
if (serviceText == null) { |
162 |
serviceText = new JComboBox(); |
163 |
serviceText.setPreferredSize(new java.awt.Dimension(250,20)); |
164 |
serviceText.addItem(Messages.getText("Data"));
|
165 |
serviceText.addItem(Messages.getText("Services"));
|
166 |
} |
167 |
return serviceText;
|
168 |
} |
169 |
|
170 |
/**
|
171 |
* This method initializes jPanel
|
172 |
*
|
173 |
*
|
174 |
* @return javax.swing.JPanel
|
175 |
*/
|
176 |
private JPanel getPanelLabTitulo() { |
177 |
if (panelLabTitulo == null) { |
178 |
GridLayout gridLayout10 = new GridLayout(); |
179 |
tituloLabel = new JLabel(); |
180 |
panelLabTitulo = new JPanel(); |
181 |
panelLabTitulo.setLayout(gridLayout10); |
182 |
tituloLabel.setText(Messages.getText("Service"));
|
183 |
gridLayout10.setRows(1);
|
184 |
panelLabTitulo.add(tituloLabel, null);
|
185 |
} |
186 |
return panelLabTitulo;
|
187 |
} |
188 |
|
189 |
/**
|
190 |
* This method initializes jPanel1
|
191 |
*
|
192 |
*
|
193 |
* @return javax.swing.JPanel
|
194 |
*/
|
195 |
private JPanel getPanelCheckBox() { |
196 |
if (panelCheckBox == null) { |
197 |
panelCheckBox = new JPanel(); |
198 |
panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS)); |
199 |
panelCheckBox.setPreferredSize(new java.awt.Dimension(310,30)); |
200 |
panelCheckBox.add(getCoordinatesCheckBox(), null);
|
201 |
panelCheckBox.add(getJPanel4(), null);
|
202 |
} |
203 |
return panelCheckBox;
|
204 |
} |
205 |
|
206 |
/**
|
207 |
* This method initializes jPanel9
|
208 |
*
|
209 |
*
|
210 |
* @return javax.swing.JPanel
|
211 |
*/
|
212 |
private JPanel getPanelTextService() { |
213 |
if (panelTextTitulo == null) { |
214 |
panelTextTitulo = new JPanel(); |
215 |
panelTextTitulo.add(getServiceText(), null);
|
216 |
} |
217 |
return panelTextTitulo;
|
218 |
} |
219 |
/* (non-Javadoc)
|
220 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
|
221 |
*/
|
222 |
|
223 |
/**
|
224 |
*
|
225 |
*
|
226 |
*
|
227 |
* @return
|
228 |
*/
|
229 |
public String getTitle() { |
230 |
if (getTitleText().getText().equals("")) { |
231 |
return null; |
232 |
} |
233 |
return getTitleText().getText();
|
234 |
} |
235 |
|
236 |
public int getService(){ |
237 |
String service = (String)serviceText.getSelectedItem(); |
238 |
if (service.equals(Messages.getText("Services"))){ |
239 |
return Query.SEARCH_SERVICE; |
240 |
}else{
|
241 |
return Query.SEARCH_DATA; |
242 |
} |
243 |
|
244 |
|
245 |
} |
246 |
/* (non-Javadoc)
|
247 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
|
248 |
*/
|
249 |
|
250 |
/**
|
251 |
*
|
252 |
*
|
253 |
*
|
254 |
* @return
|
255 |
*/
|
256 |
public boolean getRestrictAreaClicked() { |
257 |
// TODO Auto-generated method stub
|
258 |
return coordinatesCheckBox.isSelected();
|
259 |
} |
260 |
/* (non-Javadoc)
|
261 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
|
262 |
*/
|
263 |
|
264 |
/**
|
265 |
*
|
266 |
*
|
267 |
*
|
268 |
* @param title
|
269 |
*/
|
270 |
public void setTitle(String title) { |
271 |
getTitleText().setText(title); |
272 |
} |
273 |
|
274 |
/**
|
275 |
* This method initializes jCheckBox
|
276 |
*
|
277 |
*
|
278 |
* @return javax.swing.JCheckBox
|
279 |
*/
|
280 |
public JCheckBox getCoordinatesCheckBox() { |
281 |
if (coordinatesCheckBox == null) { |
282 |
coordinatesCheckBox = new JCheckBox(); |
283 |
coordinatesCheckBox.setText(Messages.getText("restrictArea"));
|
284 |
} |
285 |
return coordinatesCheckBox;
|
286 |
} |
287 |
|
288 |
/**
|
289 |
* This method initializes jPanel1
|
290 |
*
|
291 |
*
|
292 |
* @return javax.swing.JPanel
|
293 |
*/
|
294 |
private JPanel getUpperPanel() { |
295 |
if (upperPanel == null) { |
296 |
upperPanel = new JPanel(); |
297 |
upperPanel.setLayout(new FlowLayout()); |
298 |
upperPanel.setPreferredSize(new java.awt.Dimension(510,100)); |
299 |
upperPanel.add(getUpperLeftPanel(), null);
|
300 |
upperPanel.add(getUpperRightPanel(), null);
|
301 |
} |
302 |
return upperPanel;
|
303 |
} |
304 |
|
305 |
/**
|
306 |
* This method initializes jPanel1
|
307 |
*
|
308 |
*
|
309 |
* @return javax.swing.JPanel
|
310 |
*/
|
311 |
private JPanel getUpperLeftPanel() { |
312 |
if (upperLeftPanel == null) { |
313 |
upperLeftPanel = new JPanel(); |
314 |
upperLeftPanel.setLayout(new BoxLayout(upperLeftPanel, BoxLayout.Y_AXIS)); |
315 |
upperLeftPanel.setPreferredSize(new java.awt.Dimension(250,95)); |
316 |
upperLeftPanel.add(getPanelLabTitulo(), null);
|
317 |
upperLeftPanel.add(getPanelTextService(), null);
|
318 |
upperLeftPanel.add(getJPanel(), null);
|
319 |
upperLeftPanel.add(getPanelTextTitulo(), null);
|
320 |
} |
321 |
return upperLeftPanel;
|
322 |
} |
323 |
|
324 |
/**
|
325 |
* This method initializes jPanel4
|
326 |
*
|
327 |
*
|
328 |
* @return javax.swing.JPanel
|
329 |
*/
|
330 |
private JPanel getUpperRightPanel() { |
331 |
if (upperRightPanel == null) { |
332 |
upperRightPanel = new JPanel(); |
333 |
upperRightPanel.setLayout(new BoxLayout(upperRightPanel, BoxLayout.Y_AXIS)); |
334 |
upperRightPanel.setPreferredSize(new java.awt.Dimension(250,85)); |
335 |
upperRightPanel.add(getJPanel3(), null);
|
336 |
upperRightPanel.add(getPanelCheckBox(), null);
|
337 |
} |
338 |
return upperRightPanel;
|
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 |
sizeButton.setPreferredSize(new java.awt.Dimension(18,18)); |
351 |
setDownIcon(); |
352 |
} |
353 |
return sizeButton;
|
354 |
} |
355 |
|
356 |
/**
|
357 |
* This method initializes jPanel4
|
358 |
*
|
359 |
*
|
360 |
* @return javax.swing.JPanel
|
361 |
*/
|
362 |
private JPanel getJPanel4() { |
363 |
if (jPanel4 == null) { |
364 |
jPanel4 = new JPanel(); |
365 |
jPanel4.add(getSizeButton(), null);
|
366 |
} |
367 |
return jPanel4;
|
368 |
} |
369 |
|
370 |
/**
|
371 |
* It sets the icon image up
|
372 |
*
|
373 |
*/
|
374 |
public void setUpIcon() { |
375 |
sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png")); |
376 |
} |
377 |
|
378 |
/**
|
379 |
* It sets the icon image down
|
380 |
*
|
381 |
*/
|
382 |
public void setDownIcon() { |
383 |
sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png")); |
384 |
} |
385 |
|
386 |
/**
|
387 |
* This methos disables the components that are representing
|
388 |
* fileds that the protocol used to do the search doesn't
|
389 |
* support
|
390 |
*
|
391 |
*
|
392 |
* @param type Server type: Z3950, SRW or CSW
|
393 |
* @param profile Server Profile: DUBLINCORE, ISO19115, ebRIM
|
394 |
*/
|
395 |
private void disableComponents(String type, String profile) { |
396 |
//System.out.println("TYPE: " + type);
|
397 |
//System.out.println("SUBTYPE: " + profile);
|
398 |
|
399 |
if (type.equals(ServerData.SERVER_SUBTYPE_CATALOG_SRW) ||
|
400 |
profile.equals(Schemas.ISO19115) || |
401 |
profile.equals(Schemas.DUBLINCORE)){ |
402 |
getCoordinatesCheckBox().setEnabled(false);
|
403 |
} |
404 |
} |
405 |
|
406 |
/**
|
407 |
* This method initializes jPanel
|
408 |
*
|
409 |
* @return javax.swing.JPanel
|
410 |
*/
|
411 |
private JPanel getJPanel() { |
412 |
if (jPanel == null) { |
413 |
jLabel = new JLabel(); |
414 |
jLabel.setText(Messages.getText("title"));
|
415 |
GridLayout gridLayout = new GridLayout(); |
416 |
gridLayout.setRows(1);
|
417 |
jPanel = new JPanel(); |
418 |
jPanel.setLayout(gridLayout); |
419 |
jPanel.add(jLabel, null);
|
420 |
} |
421 |
return jPanel;
|
422 |
} |
423 |
|
424 |
/**
|
425 |
* This method initializes jPanel2
|
426 |
*
|
427 |
* @return javax.swing.JPanel
|
428 |
*/
|
429 |
private JPanel getPanelTextTitulo() { |
430 |
if (jPanel2 == null) { |
431 |
jPanel2 = new JPanel(); |
432 |
jPanel2.add(getTitleText(), null);
|
433 |
} |
434 |
return jPanel2;
|
435 |
} |
436 |
|
437 |
/**
|
438 |
* This method initializes jTextField
|
439 |
*
|
440 |
* @return javax.swing.JTextField
|
441 |
*/
|
442 |
private JTextField getTitleText() { |
443 |
if (tituloText == null) { |
444 |
tituloText = new JTextField(); |
445 |
tituloText.setPreferredSize(new Dimension(250, 20)); |
446 |
} |
447 |
return tituloText;
|
448 |
} |
449 |
|
450 |
/**
|
451 |
* This method initializes jPanel3
|
452 |
*
|
453 |
* @return javax.swing.JPanel
|
454 |
*/
|
455 |
private JPanel getJPanel3() { |
456 |
if (jPanel3 == null) { |
457 |
jPanel3 = new JPanel(); |
458 |
jPanel3.setPreferredSize(new java.awt.Dimension(37,200)); |
459 |
} |
460 |
return jPanel3;
|
461 |
} |
462 |
} |
463 |
// @jve:decl-index=0:visual-constraint="10,10"
|