root / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / gazetteer / ui / ServerConnectPanel.java @ 2985
History | View | Annotate | Download (11.7 KB)
1 | 2921 | jorpiell | /* 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.gazetteer.ui; |
||
42 | |||
43 | import java.awt.GridLayout; |
||
44 | |||
45 | import javax.swing.BoxLayout; |
||
46 | import javax.swing.ButtonGroup; |
||
47 | import javax.swing.JComboBox; |
||
48 | import javax.swing.JEditorPane; |
||
49 | import javax.swing.JLabel; |
||
50 | import javax.swing.JPanel; |
||
51 | import javax.swing.JRadioButton; |
||
52 | import javax.swing.JScrollPane; |
||
53 | |||
54 | |||
55 | /**
|
||
56 | * This class implements the JPanel for the Server connect window
|
||
57 | *
|
||
58 | * @author Jorge Piera Llodra (piera_jor@gva.es)
|
||
59 | */
|
||
60 | public class ServerConnectPanel extends JPanel { |
||
61 | private JPanel panelPrincipal = null; |
||
62 | private JPanel panelSuperior = null; |
||
63 | private JComboBox servidoresCombo = null; |
||
64 | private JPanel panelBotones = null; |
||
65 | private JRadioButton WFSGButton = null; |
||
66 | private JRadioButton ADLButton = null; |
||
67 | private JLabel jLabel = null; |
||
68 | private JPanel panelServidores = null; |
||
69 | private JPanel panelInferior = null; // @jve:decl-index=0: |
||
70 | private JEditorPane respuestaText = null; |
||
71 | private JPanel panelRespuesta = null; |
||
72 | private JScrollPane jScrollPane = null; |
||
73 | private JPanel panelLabRespuesta = null; // @jve:decl-index=0: |
||
74 | private JLabel jLabel1 = null; |
||
75 | private JPanel panelLabServidores = null; |
||
76 | private JLabel servidoresLabel = null; |
||
77 | private JPanel panelServidoresCombo = null; |
||
78 | public ServerConnectPanel() {
|
||
79 | this.initialize();
|
||
80 | } |
||
81 | |||
82 | /**
|
||
83 | * This method initializes this
|
||
84 | *
|
||
85 | * @return void
|
||
86 | */
|
||
87 | private void initialize() { |
||
88 | this.setBounds(0, 0, 625, 225); |
||
89 | this.setPreferredSize(new java.awt.Dimension(625, 225)); |
||
90 | |||
91 | //this.add(getPanelPrincipal(), null);
|
||
92 | GridLayout gridLayout1 = new GridLayout(); |
||
93 | |||
94 | //panelPrincipal = this;
|
||
95 | this.setLayout(gridLayout1);
|
||
96 | gridLayout1.setRows(2);
|
||
97 | gridLayout1.setColumns(1);
|
||
98 | gridLayout1.setHgap(0);
|
||
99 | gridLayout1.setVgap(0);
|
||
100 | this.setBackground(java.awt.Color.white);
|
||
101 | this.add(getPanelSuperior(), null); |
||
102 | this.add(getPanelInferior(), null); |
||
103 | } |
||
104 | |||
105 | /**
|
||
106 | * This method initializes jPanel
|
||
107 | *
|
||
108 | * @return javax.swing.JPanel
|
||
109 | */
|
||
110 | private JPanel getPanelPrincipal() { |
||
111 | if (panelPrincipal == null) { |
||
112 | GridLayout gridLayout1 = new GridLayout(); |
||
113 | panelPrincipal = new JPanel(); |
||
114 | panelPrincipal.setLayout(gridLayout1); |
||
115 | gridLayout1.setRows(2);
|
||
116 | gridLayout1.setColumns(1);
|
||
117 | gridLayout1.setHgap(0);
|
||
118 | gridLayout1.setVgap(0);
|
||
119 | panelPrincipal.setBackground(java.awt.Color.white); |
||
120 | panelPrincipal.add(getPanelSuperior(), null);
|
||
121 | panelPrincipal.add(getPanelInferior(), null);
|
||
122 | } |
||
123 | |||
124 | return panelPrincipal;
|
||
125 | } |
||
126 | |||
127 | /**
|
||
128 | * This method initializes jPanel
|
||
129 | *
|
||
130 | * @return javax.swing.JPanel
|
||
131 | */
|
||
132 | private JPanel getPanelSuperior() { |
||
133 | if (panelSuperior == null) { |
||
134 | jLabel = new JLabel(); |
||
135 | panelSuperior = new JPanel(); |
||
136 | jLabel.setText("");
|
||
137 | jLabel.setPreferredSize(new java.awt.Dimension(30, 10)); |
||
138 | panelSuperior.add(getPanelServidores(), null);
|
||
139 | panelSuperior.add(jLabel, null);
|
||
140 | panelSuperior.add(getPanelBotones(), null);
|
||
141 | } |
||
142 | |||
143 | return panelSuperior;
|
||
144 | } |
||
145 | |||
146 | /**
|
||
147 | * This method initializes jComboBox1
|
||
148 | *
|
||
149 | * @return javax.swing.JComboBox
|
||
150 | */
|
||
151 | public JComboBox getServidoresCombo() { |
||
152 | if (servidoresCombo == null) { |
||
153 | servidoresCombo = new JComboBox(); |
||
154 | servidoresCombo.setPreferredSize(new java.awt.Dimension(472, 25)); |
||
155 | servidoresCombo.setEditable(true);
|
||
156 | } |
||
157 | |||
158 | return servidoresCombo;
|
||
159 | } |
||
160 | |||
161 | /**
|
||
162 | * This method initializes jPanel
|
||
163 | *
|
||
164 | * @return javax.swing.JPanel
|
||
165 | */
|
||
166 | private JPanel getPanelBotones() { |
||
167 | if (panelBotones == null) { |
||
168 | panelBotones = new JPanel(); |
||
169 | panelBotones.setLayout(new BoxLayout(panelBotones, BoxLayout.Y_AXIS)); |
||
170 | panelBotones.setBorder(javax.swing.BorderFactory.createTitledBorder( |
||
171 | null, "Protocolos", |
||
172 | javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
||
173 | javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
||
174 | panelBotones.setName("Protocolos");
|
||
175 | panelBotones.setToolTipText("");
|
||
176 | panelBotones.add(getWFSGButton(), null);
|
||
177 | panelBotones.add(getADLButton(), null);
|
||
178 | |||
179 | ButtonGroup group = new ButtonGroup(); |
||
180 | group.add(getWFSGButton()); |
||
181 | group.add(getADLButton()); |
||
182 | } |
||
183 | |||
184 | return panelBotones;
|
||
185 | } |
||
186 | |||
187 | /**
|
||
188 | * This method initializes jRadioButton
|
||
189 | *
|
||
190 | * @return javax.swing.JRadioButton
|
||
191 | */
|
||
192 | public JRadioButton getWFSGButton() { |
||
193 | if (WFSGButton == null) { |
||
194 | WFSGButton = new JRadioButton(); |
||
195 | WFSGButton.setText("WFS-G");
|
||
196 | WFSGButton.setSelected(true);
|
||
197 | WFSGButton.setActionCommand("WFS-G");
|
||
198 | } |
||
199 | |||
200 | return WFSGButton;
|
||
201 | } |
||
202 | |||
203 | /**
|
||
204 | * This method initializes jRadioButton
|
||
205 | *
|
||
206 | * @return javax.swing.JRadioButton
|
||
207 | */
|
||
208 | public JRadioButton getADLButton() { |
||
209 | if (ADLButton == null) { |
||
210 | ADLButton = new JRadioButton(); |
||
211 | ADLButton.setText("ADL");
|
||
212 | } |
||
213 | |||
214 | return ADLButton;
|
||
215 | } |
||
216 | |||
217 | /**
|
||
218 | * This method initializes jPanel
|
||
219 | *
|
||
220 | * @return javax.swing.JPanel
|
||
221 | */
|
||
222 | private JPanel getPanelServidores() { |
||
223 | if (panelServidores == null) { |
||
224 | panelServidores = new JPanel(); |
||
225 | panelServidores.setLayout(new BoxLayout(panelServidores, |
||
226 | BoxLayout.Y_AXIS));
|
||
227 | panelServidores.add(getJPanel(), null);
|
||
228 | panelServidores.add(getJPanel2(), null);
|
||
229 | } |
||
230 | |||
231 | return panelServidores;
|
||
232 | } |
||
233 | |||
234 | /**
|
||
235 | * This method initializes jPanel
|
||
236 | *
|
||
237 | * @return javax.swing.JPanel
|
||
238 | */
|
||
239 | private JPanel getPanelInferior() { |
||
240 | if (panelInferior == null) { |
||
241 | panelInferior = new JPanel(); |
||
242 | panelInferior.setLayout(new BoxLayout(panelInferior, |
||
243 | BoxLayout.Y_AXIS));
|
||
244 | panelInferior.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
||
245 | panelInferior.add(getPanelLabRespuesta(), null);
|
||
246 | panelInferior.add(getPanelRespuesta(), null);
|
||
247 | } |
||
248 | |||
249 | return panelInferior;
|
||
250 | } |
||
251 | |||
252 | /**
|
||
253 | * This method initializes jTextArea
|
||
254 | *
|
||
255 | * @return javax.swing.JTextArea
|
||
256 | */
|
||
257 | private JEditorPane getRespuestaText() { |
||
258 | if (respuestaText == null) { |
||
259 | respuestaText = new JEditorPane(); |
||
260 | respuestaText.setPreferredSize(new java.awt.Dimension(200, 500)); |
||
261 | respuestaText.setEditable(false);
|
||
262 | } |
||
263 | |||
264 | return respuestaText;
|
||
265 | } |
||
266 | |||
267 | /**
|
||
268 | * This method initializes jPanel
|
||
269 | *
|
||
270 | * @return javax.swing.JPanel
|
||
271 | */
|
||
272 | private JPanel getPanelRespuesta() { |
||
273 | if (panelRespuesta == null) { |
||
274 | panelRespuesta = new JPanel(); |
||
275 | panelRespuesta.setBorder(javax.swing.BorderFactory.createLineBorder( |
||
276 | java.awt.Color.lightGray, 0));
|
||
277 | panelRespuesta.add(getJScrollPane(), null);
|
||
278 | } |
||
279 | |||
280 | return panelRespuesta;
|
||
281 | } |
||
282 | |||
283 | /**
|
||
284 | * This method initializes jScrollPane
|
||
285 | *
|
||
286 | * @return javax.swing.JScrollPane
|
||
287 | */
|
||
288 | private JScrollPane getJScrollPane() { |
||
289 | if (jScrollPane == null) { |
||
290 | jScrollPane = new JScrollPane(); |
||
291 | jScrollPane.setViewportView(getRespuestaText()); |
||
292 | getRespuestaText().setBackground(jScrollPane.getBackground()); |
||
293 | jScrollPane.setPreferredSize(new java.awt.Dimension(610, 75)); |
||
294 | jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); |
||
295 | } |
||
296 | |||
297 | return jScrollPane;
|
||
298 | } |
||
299 | |||
300 | /**
|
||
301 | * This method initializes jPanel
|
||
302 | *
|
||
303 | * @return javax.swing.JPanel
|
||
304 | */
|
||
305 | private JPanel getPanelLabRespuesta() { |
||
306 | if (panelLabRespuesta == null) { |
||
307 | jLabel1 = new JLabel(); |
||
308 | |||
309 | GridLayout gridLayout3 = new GridLayout(); |
||
310 | panelLabRespuesta = new JPanel(); |
||
311 | panelLabRespuesta.setLayout(gridLayout3); |
||
312 | jLabel1.setText(" Respuesta del servidor ");
|
||
313 | gridLayout3.setRows(1);
|
||
314 | panelLabRespuesta.add(jLabel1, null);
|
||
315 | } |
||
316 | |||
317 | return panelLabRespuesta;
|
||
318 | } |
||
319 | |||
320 | /**
|
||
321 | * This method initializes jPanel
|
||
322 | *
|
||
323 | * @return javax.swing.JPanel
|
||
324 | */
|
||
325 | private JPanel getJPanel() { |
||
326 | if (panelLabServidores == null) { |
||
327 | servidoresLabel = new JLabel(); |
||
328 | |||
329 | GridLayout gridLayout6 = new GridLayout(); |
||
330 | GridLayout gridLayout5 = new GridLayout(); |
||
331 | GridLayout gridLayout7 = new GridLayout(); |
||
332 | GridLayout gridLayout4 = new GridLayout(); |
||
333 | panelLabServidores = new JPanel(); |
||
334 | panelLabServidores.setLayout(gridLayout7); |
||
335 | servidoresLabel.setText( |
||
336 | " Indroduzca la direcci?n donde se encuentra el servidor Gazetteer");
|
||
337 | servidoresLabel.setPreferredSize(new java.awt.Dimension(375, 16)); |
||
338 | gridLayout4.setRows(1);
|
||
339 | panelLabServidores.setPreferredSize(new java.awt.Dimension(475, 30)); |
||
340 | panelLabServidores.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
||
341 | gridLayout5.setRows(1);
|
||
342 | gridLayout6.setRows(1);
|
||
343 | gridLayout7.setRows(1);
|
||
344 | panelLabServidores.add(servidoresLabel, null);
|
||
345 | } |
||
346 | |||
347 | return panelLabServidores;
|
||
348 | } |
||
349 | |||
350 | /**
|
||
351 | * This method initializes jPanel
|
||
352 | *
|
||
353 | * @return javax.swing.JPanel
|
||
354 | */
|
||
355 | private JPanel getJPanel2() { |
||
356 | if (panelServidoresCombo == null) { |
||
357 | panelServidoresCombo = new JPanel(); |
||
358 | panelServidoresCombo.setPreferredSize(new java.awt.Dimension(405, 35)); |
||
359 | panelServidoresCombo.setName("Protocolos");
|
||
360 | panelServidoresCombo.setToolTipText("Protocolos");
|
||
361 | panelServidoresCombo.setBorder(javax.swing.BorderFactory.createEmptyBorder( |
||
362 | 0, 0, 0, 0)); |
||
363 | panelServidoresCombo.add(getServidoresCombo(), null);
|
||
364 | } |
||
365 | |||
366 | return panelServidoresCombo;
|
||
367 | } |
||
368 | |||
369 | public String getServer() { |
||
370 | return (String) this.getServidoresCombo().getSelectedItem(); |
||
371 | } |
||
372 | |||
373 | public JComboBox getServerCombo() { |
||
374 | return this.getServidoresCombo(); |
||
375 | } |
||
376 | |||
377 | public String getProtocol() { |
||
378 | if (this.getWFSGButton().isSelected()) { |
||
379 | return "WFS-G"; |
||
380 | } |
||
381 | |||
382 | if (this.getADLButton().isSelected()) { |
||
383 | return "ADL"; |
||
384 | } |
||
385 | |||
386 | return null; |
||
387 | } |
||
388 | |||
389 | public void setRespuesta(String texto) { |
||
390 | this.getRespuestaText().setText(texto);
|
||
391 | } |
||
392 | |||
393 | } // @jve:decl-index=0:visual-constraint="23,27" |