svn-gvsig-desktop / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / serverConnect / ServerConnectPanel.java @ 3480
History | View | Annotate | Download (15.3 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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 |
package es.gva.cit.catalogClient.ui.serverConnect; |
42 |
|
43 |
import java.awt.GridLayout; |
44 |
|
45 |
import javax.swing.BoxLayout; |
46 |
import javax.swing.ButtonGroup; |
47 |
import javax.swing.JEditorPane; |
48 |
import javax.swing.JLabel; |
49 |
import javax.swing.JPanel; |
50 |
import javax.swing.JRadioButton; |
51 |
import javax.swing.JScrollPane; |
52 |
import javax.swing.JTextField; |
53 |
|
54 |
import es.gva.cit.catalogClient.traductor.ITranslator; |
55 |
import es.gva.cit.catalogClient.traductor.Translator; |
56 |
import es.gva.cit.catalogClient.utils.comboServer.JComboServer; |
57 |
import es.gva.cit.catalogClient.utils.comboServer.ServerData; |
58 |
|
59 |
|
60 |
/**
|
61 |
* Panel de conexi?n con los servers de cat?logo.
|
62 |
*
|
63 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
64 |
*/
|
65 |
public class ServerConnectPanel extends JPanel { |
66 |
private JPanel panelPrincipal = null; |
67 |
private JPanel panelSuperior = null; |
68 |
private JComboServer servidoresCombo = null; |
69 |
private JPanel panelBotones = null; |
70 |
private JRadioButton z3950Button = null; |
71 |
private JRadioButton srwButton = null; |
72 |
private JRadioButton cswButton = null; |
73 |
private JLabel jLabel = null; |
74 |
private JPanel panelServidores = null; |
75 |
private JPanel panelInferior = null; // @jve:decl-index=0: |
76 |
private JEditorPane respuestaText = null; |
77 |
private JPanel panelRespuesta = null; |
78 |
private JScrollPane jScrollPane = null; |
79 |
private JPanel panelLabRespuesta = null; // @jve:decl-index=0: |
80 |
private JLabel jLabel1 = null; |
81 |
private JPanel panelLabServidores = null; |
82 |
private JLabel servidoresLabel = null; |
83 |
private JPanel panelServidoresCombo = null; |
84 |
private JPanel panelLabDB = null; |
85 |
private JLabel dbLabel = null; |
86 |
private JPanel panelDBText = null; |
87 |
private JTextField dbText = null; |
88 |
private ITranslator translator = null; |
89 |
|
90 |
public ServerConnectPanel(ITranslator translator ) {
|
91 |
this.translator = translator;
|
92 |
initialize(); |
93 |
} |
94 |
|
95 |
/**
|
96 |
* This method initializes this
|
97 |
*
|
98 |
* @return void
|
99 |
*/
|
100 |
private void initialize() { |
101 |
this.setBounds(0, 0, 625, 225); |
102 |
this.setPreferredSize(new java.awt.Dimension(625, 225)); |
103 |
|
104 |
//this.add(getPanelPrincipal(), null);
|
105 |
GridLayout gridLayout1 = new GridLayout(); |
106 |
|
107 |
//panelPrincipal = this;
|
108 |
this.setLayout(gridLayout1);
|
109 |
gridLayout1.setRows(2);
|
110 |
gridLayout1.setColumns(1);
|
111 |
gridLayout1.setHgap(0);
|
112 |
gridLayout1.setVgap(0);
|
113 |
this.setBackground(java.awt.Color.white);
|
114 |
this.add(getPanelSuperior(), null); |
115 |
this.add(getPanelInferior(), null); |
116 |
} |
117 |
|
118 |
/**
|
119 |
* This method initializes jPanel
|
120 |
*
|
121 |
* @return javax.swing.JPanel
|
122 |
*/
|
123 |
private JPanel getPanelPrincipal() { |
124 |
if (panelPrincipal == null) { |
125 |
GridLayout gridLayout1 = new GridLayout(); |
126 |
panelPrincipal = new JPanel(); |
127 |
panelPrincipal.setLayout(gridLayout1); |
128 |
gridLayout1.setRows(2);
|
129 |
gridLayout1.setColumns(1);
|
130 |
gridLayout1.setHgap(0);
|
131 |
gridLayout1.setVgap(0);
|
132 |
panelPrincipal.setBackground(java.awt.Color.white); |
133 |
panelPrincipal.add(getPanelSuperior(), null);
|
134 |
panelPrincipal.add(getPanelInferior(), null);
|
135 |
} |
136 |
|
137 |
return panelPrincipal;
|
138 |
} |
139 |
|
140 |
/**
|
141 |
* This method initializes jPanel
|
142 |
*
|
143 |
* @return javax.swing.JPanel
|
144 |
*/
|
145 |
private JPanel getPanelSuperior() { |
146 |
if (panelSuperior == null) { |
147 |
jLabel = new JLabel(); |
148 |
panelSuperior = new JPanel(); |
149 |
jLabel.setText("");
|
150 |
jLabel.setPreferredSize(new java.awt.Dimension(30, 10)); |
151 |
panelSuperior.add(getPanelServidores(), null);
|
152 |
panelSuperior.add(jLabel, null);
|
153 |
panelSuperior.add(getPanelBotones(), null);
|
154 |
} |
155 |
|
156 |
return panelSuperior;
|
157 |
} |
158 |
|
159 |
/**
|
160 |
* This method initializes jComboBox1
|
161 |
*
|
162 |
* @return javax.swing.JComboBox
|
163 |
*/
|
164 |
public JComboServer getServidoresCombo() {
|
165 |
if (servidoresCombo == null) { |
166 |
servidoresCombo = new JComboServer();
|
167 |
servidoresCombo.setActionCommand("servidoresCombo");
|
168 |
servidoresCombo.setPreferredSize(new java.awt.Dimension(472, 25)); |
169 |
servidoresCombo.setEditable(true);
|
170 |
} |
171 |
|
172 |
return servidoresCombo;
|
173 |
} |
174 |
|
175 |
/**
|
176 |
* This method initializes jPanel
|
177 |
*
|
178 |
* @return javax.swing.JPanel
|
179 |
*/
|
180 |
private JPanel getPanelBotones() { |
181 |
if (panelBotones == null) { |
182 |
panelBotones = new JPanel(); |
183 |
panelBotones.setLayout(new BoxLayout(panelBotones, BoxLayout.Y_AXIS)); |
184 |
panelBotones.setBorder(javax.swing.BorderFactory.createTitledBorder( |
185 |
null, Translator.getText(translator,"protocolsGroup"), |
186 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
187 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
188 |
panelBotones.setName("Protocolos");
|
189 |
panelBotones.setToolTipText("");
|
190 |
panelBotones.add(getZ3950Button(), null);
|
191 |
panelBotones.add(getSrwButton(), null);
|
192 |
panelBotones.add(getCswButton(), null);
|
193 |
|
194 |
ButtonGroup group = new ButtonGroup(); |
195 |
group.add(getZ3950Button()); |
196 |
group.add(getSrwButton()); |
197 |
group.add(getCswButton()); |
198 |
} |
199 |
|
200 |
return panelBotones;
|
201 |
} |
202 |
|
203 |
/**
|
204 |
* This method initializes jRadioButton
|
205 |
*
|
206 |
* @return javax.swing.JRadioButton
|
207 |
*/
|
208 |
public JRadioButton getZ3950Button() { |
209 |
if (z3950Button == null) { |
210 |
z3950Button = new JRadioButton(); |
211 |
z3950Button.setText("Z39.50");
|
212 |
z3950Button.setSelected(true);
|
213 |
} |
214 |
|
215 |
return z3950Button;
|
216 |
} |
217 |
|
218 |
/**
|
219 |
* This method initializes jRadioButton
|
220 |
*
|
221 |
* @return javax.swing.JRadioButton
|
222 |
*/
|
223 |
public JRadioButton getSrwButton() { |
224 |
if (srwButton == null) { |
225 |
srwButton = new JRadioButton(); |
226 |
srwButton.setText("SRU/SRW");
|
227 |
} |
228 |
|
229 |
return srwButton;
|
230 |
} |
231 |
|
232 |
/**
|
233 |
* This method initializes jRadioButton
|
234 |
*
|
235 |
* @return javax.swing.JRadioButton
|
236 |
*/
|
237 |
public JRadioButton getCswButton() { |
238 |
if (cswButton == null) { |
239 |
cswButton = new JRadioButton(); |
240 |
cswButton.setText("CS-W");
|
241 |
} |
242 |
|
243 |
return cswButton;
|
244 |
} |
245 |
|
246 |
/**
|
247 |
* This method initializes jPanel
|
248 |
*
|
249 |
* @return javax.swing.JPanel
|
250 |
*/
|
251 |
private JPanel getPanelServidores() { |
252 |
if (panelServidores == null) { |
253 |
panelServidores = new JPanel(); |
254 |
panelServidores.setLayout(new BoxLayout(panelServidores, |
255 |
BoxLayout.Y_AXIS));
|
256 |
panelServidores.add(getJPanel(), null);
|
257 |
panelServidores.add(getJPanel2(), null);
|
258 |
panelServidores.add(getJPanel3(), null);
|
259 |
panelServidores.add(getJPanel4(), null);
|
260 |
} |
261 |
|
262 |
return panelServidores;
|
263 |
} |
264 |
|
265 |
/**
|
266 |
* This method initializes jPanel
|
267 |
*
|
268 |
* @return javax.swing.JPanel
|
269 |
*/
|
270 |
private JPanel getPanelInferior() { |
271 |
if (panelInferior == null) { |
272 |
panelInferior = new JPanel(); |
273 |
panelInferior.setLayout(new BoxLayout(panelInferior, |
274 |
BoxLayout.Y_AXIS));
|
275 |
panelInferior.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
276 |
panelInferior.add(getPanelLabRespuesta(), null);
|
277 |
panelInferior.add(getPanelRespuesta(), null);
|
278 |
} |
279 |
|
280 |
return panelInferior;
|
281 |
} |
282 |
|
283 |
/**
|
284 |
* This method initializes jTextArea
|
285 |
*
|
286 |
* @return javax.swing.JTextArea
|
287 |
*/
|
288 |
private JEditorPane getRespuestaText() { |
289 |
if (respuestaText == null) { |
290 |
respuestaText = new JEditorPane(); |
291 |
respuestaText.setPreferredSize(new java.awt.Dimension(195,500)); |
292 |
respuestaText.setEditable(false);
|
293 |
} |
294 |
|
295 |
return respuestaText;
|
296 |
} |
297 |
|
298 |
/**
|
299 |
* This method initializes jPanel
|
300 |
*
|
301 |
* @return javax.swing.JPanel
|
302 |
*/
|
303 |
private JPanel getPanelRespuesta() { |
304 |
if (panelRespuesta == null) { |
305 |
panelRespuesta = new JPanel(); |
306 |
panelRespuesta.setBorder(javax.swing.BorderFactory.createLineBorder( |
307 |
java.awt.Color.lightGray, 0));
|
308 |
panelRespuesta.add(getJScrollPane(), null);
|
309 |
} |
310 |
|
311 |
return panelRespuesta;
|
312 |
} |
313 |
|
314 |
/**
|
315 |
* This method initializes jScrollPane
|
316 |
*
|
317 |
* @return javax.swing.JScrollPane
|
318 |
*/
|
319 |
private JScrollPane getJScrollPane() { |
320 |
if (jScrollPane == null) { |
321 |
jScrollPane = new JScrollPane(); |
322 |
jScrollPane.setViewportView(getRespuestaText()); |
323 |
getRespuestaText().setBackground(jScrollPane.getBackground()); |
324 |
jScrollPane.setPreferredSize(new java.awt.Dimension(600,75)); |
325 |
jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); |
326 |
} |
327 |
|
328 |
return jScrollPane;
|
329 |
} |
330 |
|
331 |
/**
|
332 |
* This method initializes jPanel
|
333 |
*
|
334 |
* @return javax.swing.JPanel
|
335 |
*/
|
336 |
private JPanel getPanelLabRespuesta() { |
337 |
if (panelLabRespuesta == null) { |
338 |
jLabel1 = new JLabel(); |
339 |
|
340 |
GridLayout gridLayout3 = new GridLayout(); |
341 |
panelLabRespuesta = new JPanel(); |
342 |
panelLabRespuesta.setLayout(gridLayout3); |
343 |
jLabel1.setText(" " + Translator.getText(translator,"serverReply")); |
344 |
gridLayout3.setRows(1);
|
345 |
panelLabRespuesta.add(jLabel1, null);
|
346 |
} |
347 |
|
348 |
return panelLabRespuesta;
|
349 |
} |
350 |
|
351 |
/**
|
352 |
* This method initializes jPanel
|
353 |
*
|
354 |
* @return javax.swing.JPanel
|
355 |
*/
|
356 |
private JPanel getJPanel() { |
357 |
if (panelLabServidores == null) { |
358 |
servidoresLabel = new JLabel(); |
359 |
|
360 |
GridLayout gridLayout6 = new GridLayout(); |
361 |
GridLayout gridLayout5 = new GridLayout(); |
362 |
GridLayout gridLayout7 = new GridLayout(); |
363 |
GridLayout gridLayout4 = new GridLayout(); |
364 |
panelLabServidores = new JPanel(); |
365 |
panelLabServidores.setLayout(gridLayout7); |
366 |
servidoresLabel.setText( |
367 |
" " + Translator.getText(translator,"serverURL")); |
368 |
servidoresLabel.setPreferredSize(new java.awt.Dimension(375, 16)); |
369 |
servidoresLabel.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM); |
370 |
servidoresLabel.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
371 |
gridLayout4.setRows(1);
|
372 |
panelLabServidores.setPreferredSize(new java.awt.Dimension(475, 30)); |
373 |
panelLabServidores.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
374 |
gridLayout5.setRows(1);
|
375 |
gridLayout6.setRows(1);
|
376 |
gridLayout7.setRows(1);
|
377 |
panelLabServidores.add(servidoresLabel, null);
|
378 |
} |
379 |
|
380 |
return panelLabServidores;
|
381 |
} |
382 |
|
383 |
/**
|
384 |
* This method initializes jPanel
|
385 |
*
|
386 |
* @return javax.swing.JPanel
|
387 |
*/
|
388 |
private JPanel getJPanel2() { |
389 |
if (panelServidoresCombo == null) { |
390 |
panelServidoresCombo = new JPanel(); |
391 |
panelServidoresCombo.setPreferredSize(new java.awt.Dimension(405, 35)); |
392 |
panelServidoresCombo.setName("Protocolos");
|
393 |
panelServidoresCombo.setToolTipText("Protocolos");
|
394 |
panelServidoresCombo.setBorder(javax.swing.BorderFactory.createEmptyBorder( |
395 |
0, 0, 0, 0)); |
396 |
panelServidoresCombo.add(getServidoresCombo(), null);
|
397 |
} |
398 |
|
399 |
return panelServidoresCombo;
|
400 |
} |
401 |
|
402 |
/**
|
403 |
* It returns the server address
|
404 |
* @return String
|
405 |
*/
|
406 |
public String getServerAddress() { |
407 |
return getServidoresCombo().getSelectedServer().getServerAddress();
|
408 |
} |
409 |
|
410 |
/**
|
411 |
* It returns the server
|
412 |
* @return ServerData
|
413 |
*/
|
414 |
public ServerData getServer(){
|
415 |
return getServidoresCombo().getSelectedServer();
|
416 |
} |
417 |
|
418 |
public JComboServer getServerCombo() {
|
419 |
return getServidoresCombo();
|
420 |
} |
421 |
|
422 |
public String getProtocol() { |
423 |
if (this.getZ3950Button().isSelected()) { |
424 |
return "Z3950"; |
425 |
} |
426 |
|
427 |
if (this.getSrwButton().isSelected()) { |
428 |
return "SRW"; |
429 |
} |
430 |
|
431 |
if (this.getCswButton().isSelected()) { |
432 |
return "CSW"; |
433 |
} |
434 |
|
435 |
return null; |
436 |
} |
437 |
|
438 |
/**
|
439 |
* Sets the button enabled
|
440 |
* @param protocol
|
441 |
* 1 - z3950
|
442 |
* 2 - SRW
|
443 |
* 3 - CSW
|
444 |
*/
|
445 |
public void setProtocol(String protocol) { |
446 |
if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_Z3950)){
|
447 |
getZ3950Button().setSelected(true);
|
448 |
} |
449 |
if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_SRW)){
|
450 |
getSrwButton().setSelected(true);
|
451 |
} |
452 |
if (protocol.equals(ServerData.SERVER_SUBTYPE_CATALOG_CSW)){
|
453 |
getCswButton().setSelected(true);
|
454 |
} |
455 |
} |
456 |
|
457 |
public void setRespuesta(String texto) { |
458 |
this.getRespuestaText().setText(texto);
|
459 |
} |
460 |
|
461 |
/**
|
462 |
* This method initializes jPanel
|
463 |
*
|
464 |
* @return javax.swing.JPanel
|
465 |
*/
|
466 |
private JPanel getJPanel3() { |
467 |
if (panelLabDB == null) { |
468 |
dbLabel = new JLabel(); |
469 |
|
470 |
GridLayout gridLayout11 = new GridLayout(); |
471 |
panelLabDB = new JPanel(); |
472 |
panelLabDB.setLayout(gridLayout11); |
473 |
dbLabel.setText(Translator.getText(translator,"database"));
|
474 |
gridLayout11.setRows(1);
|
475 |
panelLabDB.add(dbLabel, null);
|
476 |
} |
477 |
|
478 |
return panelLabDB;
|
479 |
} |
480 |
|
481 |
/**
|
482 |
* This method initializes jPanel
|
483 |
*
|
484 |
* @return javax.swing.JPanel
|
485 |
*/
|
486 |
private JPanel getJPanel4() { |
487 |
if (panelDBText == null) { |
488 |
GridLayout gridLayout2 = new GridLayout(); |
489 |
panelDBText = new JPanel(); |
490 |
panelDBText.setLayout(gridLayout2); |
491 |
gridLayout2.setRows(1);
|
492 |
panelDBText.add(getDbText(), null);
|
493 |
} |
494 |
|
495 |
return panelDBText;
|
496 |
} |
497 |
|
498 |
/**
|
499 |
* This method initializes jTextField
|
500 |
*
|
501 |
* @return javax.swing.JTextField
|
502 |
*/
|
503 |
public JTextField getDbText() { |
504 |
if (dbText == null) { |
505 |
dbText = new JTextField(); |
506 |
dbText.setPreferredSize(new java.awt.Dimension(100, 25)); |
507 |
} |
508 |
|
509 |
return dbText;
|
510 |
} |
511 |
|
512 |
public String getDatabase() { |
513 |
if (dbText.getText() == null) { |
514 |
return ""; |
515 |
} |
516 |
|
517 |
return dbText.getText();
|
518 |
} |
519 |
|
520 |
|
521 |
|
522 |
} // @jve:decl-index=0:visual-constraint="23,27"
|