Statistics
| Revision:

root / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / gazetteer / ui / ServerConnectPanel.java @ 3069

History | View | Annotate | Download (12.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.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;  //  @jve:decl-index=0:visual-constraint="-17,415"
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
        private JRadioButton IDECButton = null;
79
    public ServerConnectPanel() {
80
        this.initialize();
81
    }
82

    
83
    /**
84
     * This method initializes this
85
     *
86
     * @return void
87
     */
88
    private void initialize() {
89
        this.setPreferredSize(new java.awt.Dimension(625,195));
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.setLocation(0, 0);
102
        this.setSize(625, 195);
103
        this.add(getPanelSuperior(), null);
104
        this.add(getPanelInferior(), null);
105
    }
106

    
107
    /**
108
     * This method initializes jPanel
109
     *
110
     * @return javax.swing.JPanel
111
     */
112
    private JPanel getPanelPrincipal() {
113
        if (panelPrincipal == null) {
114
            GridLayout gridLayout1 = new GridLayout();
115
            panelPrincipal = new JPanel();
116
            panelPrincipal.setLayout(gridLayout1);
117
            gridLayout1.setRows(2);
118
            gridLayout1.setColumns(1);
119
            gridLayout1.setHgap(0);
120
            gridLayout1.setVgap(0);
121
            panelPrincipal.setBackground(java.awt.Color.white);
122
            panelPrincipal.add(getPanelSuperior(), null);
123
            panelPrincipal.add(getPanelInferior(), null);
124
        }
125

    
126
        return panelPrincipal;
127
    }
128

    
129
    /**
130
     * This method initializes jPanel
131
     *
132
     * @return javax.swing.JPanel
133
     */
134
    private JPanel getPanelSuperior() {
135
        if (panelSuperior == null) {
136
            jLabel = new JLabel();
137
            panelSuperior = new JPanel();
138
            jLabel.setText("");
139
            jLabel.setPreferredSize(new java.awt.Dimension(30, 10));
140
            panelSuperior.add(getPanelServidores(), null);
141
            panelSuperior.add(jLabel, null);
142
            panelSuperior.add(getPanelBotones(), null);
143
        }
144

    
145
        return panelSuperior;
146
    }
147

    
148
    /**
149
     * This method initializes jComboBox1
150
     *
151
     * @return javax.swing.JComboBox
152
     */
153
    public JComboBox getServidoresCombo() {
154
        if (servidoresCombo == null) {
155
            servidoresCombo = new JComboBox();
156
            servidoresCombo.setPreferredSize(new java.awt.Dimension(472, 25));
157
            servidoresCombo.setEditable(true);
158
        }
159

    
160
        return servidoresCombo;
161
    }
162

    
163
    /**
164
     * This method initializes jPanel
165
     *
166
     * @return javax.swing.JPanel
167
     */
168
    private JPanel getPanelBotones() {
169
        if (panelBotones == null) {
170
            panelBotones = new JPanel();
171
            panelBotones.setLayout(new BoxLayout(panelBotones, BoxLayout.Y_AXIS));
172
            panelBotones.setBorder(javax.swing.BorderFactory.createTitledBorder(
173
                    null, "Protocolos",
174
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
175
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
176
            panelBotones.setName("Protocolos");
177
            panelBotones.setToolTipText("");
178
            panelBotones.add(getWFSGButton(), null);
179
            panelBotones.add(getADLButton(), null);
180
            panelBotones.add(getIDECButton(), null);
181
            ButtonGroup group = new ButtonGroup();
182
            group.add(getWFSGButton());
183
            group.add(getADLButton());
184
            group.add(getIDECButton());
185
           
186
        }
187

    
188
        return panelBotones;
189
    }
190

    
191
    /**
192
     * This method initializes jRadioButton
193
     *
194
     * @return javax.swing.JRadioButton
195
     */
196
    public JRadioButton getWFSGButton() {
197
        if (WFSGButton == null) {
198
            WFSGButton = new JRadioButton();
199
            WFSGButton.setText("WFS-G");
200
            WFSGButton.setSelected(true);
201
            WFSGButton.setActionCommand("WFS-G");
202
        }
203

    
204
        return WFSGButton;
205
    }
206

    
207
    /**
208
     * This method initializes jRadioButton
209
     *
210
     * @return javax.swing.JRadioButton
211
     */
212
    public JRadioButton getADLButton() {
213
        if (ADLButton == null) {
214
            ADLButton = new JRadioButton();
215
            ADLButton.setText("ADL");
216
        }
217

    
218
        return ADLButton;
219
    }
220

    
221
    /**
222
     * This method initializes jPanel
223
     *
224
     * @return javax.swing.JPanel
225
     */
226
    private JPanel getPanelServidores() {
227
        if (panelServidores == null) {
228
            panelServidores = new JPanel();
229
            panelServidores.setLayout(new BoxLayout(panelServidores,
230
                    BoxLayout.Y_AXIS));
231
            panelServidores.add(getJPanel(), null);
232
            panelServidores.add(getJPanel2(), null);
233
        }
234

    
235
        return panelServidores;
236
    }
237

    
238
    /**
239
     * This method initializes jPanel
240
     *
241
     * @return javax.swing.JPanel
242
     */
243
    private JPanel getPanelInferior() {
244
        if (panelInferior == null) {
245
            panelInferior = new JPanel();
246
            panelInferior.setLayout(new BoxLayout(panelInferior,
247
                    BoxLayout.Y_AXIS));
248
            panelInferior.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
249
            panelInferior.add(getPanelLabRespuesta(), null);
250
            panelInferior.add(getPanelRespuesta(), null);
251
        }
252

    
253
        return panelInferior;
254
    }
255

    
256
    /**
257
     * This method initializes jTextArea
258
     *
259
     * @return javax.swing.JTextArea
260
     */
261
    private JEditorPane getRespuestaText() {
262
        if (respuestaText == null) {
263
            respuestaText = new JEditorPane();
264
            respuestaText.setPreferredSize(new java.awt.Dimension(200, 500));
265
            respuestaText.setEditable(false);
266
           
267
        }
268

    
269
        return respuestaText;
270
    }
271

    
272
    /**
273
     * This method initializes jPanel
274
     *
275
     * @return javax.swing.JPanel
276
     */
277
    private JPanel getPanelRespuesta() {
278
        if (panelRespuesta == null) {
279
            panelRespuesta = new JPanel();
280
            panelRespuesta.setBorder(javax.swing.BorderFactory.createLineBorder(
281
                    java.awt.Color.lightGray, 0));
282
            panelRespuesta.add(getJScrollPane(), null);
283
        }
284

    
285
        return panelRespuesta;
286
    }
287

    
288
    /**
289
     * This method initializes jScrollPane
290
     *
291
     * @return javax.swing.JScrollPane
292
     */
293
    private JScrollPane getJScrollPane() {
294
        if (jScrollPane == null) {
295
            jScrollPane = new JScrollPane();
296
            getRespuestaText().setBackground(jScrollPane.getBackground());
297
            jScrollPane.setPreferredSize(new java.awt.Dimension(610, 75));
298
            jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
299
            jScrollPane.setViewportView(getRespuestaText());
300
        }
301

    
302
        return jScrollPane;
303
    }
304

    
305
    /**
306
     * This method initializes jPanel
307
     *
308
     * @return javax.swing.JPanel
309
     */
310
    private JPanel getPanelLabRespuesta() {
311
        if (panelLabRespuesta == null) {
312
            jLabel1 = new JLabel();
313

    
314
            GridLayout gridLayout3 = new GridLayout();
315
            panelLabRespuesta = new JPanel();
316
            panelLabRespuesta.setLayout(gridLayout3);
317
            jLabel1.setText("  Respuesta del servidor ");
318
            gridLayout3.setRows(1);
319
            panelLabRespuesta.add(jLabel1, null);
320
        }
321

    
322
        return panelLabRespuesta;
323
    }
324

    
325
    /**
326
     * This method initializes jPanel
327
     *
328
     * @return javax.swing.JPanel
329
     */
330
    private JPanel getJPanel() {
331
        if (panelLabServidores == null) {
332
            servidoresLabel = new JLabel();
333

    
334
            GridLayout gridLayout6 = new GridLayout();
335
            GridLayout gridLayout5 = new GridLayout();
336
            GridLayout gridLayout7 = new GridLayout();
337
            GridLayout gridLayout4 = new GridLayout();
338
            panelLabServidores = new JPanel();
339
            panelLabServidores.setLayout(gridLayout7);
340
            servidoresLabel.setText(
341
                " Indroduzca la direcci?n donde se encuentra el servidor Gazetteer");
342
            servidoresLabel.setPreferredSize(new java.awt.Dimension(375, 16));
343
            gridLayout4.setRows(1);
344
            panelLabServidores.setPreferredSize(new java.awt.Dimension(475, 30));
345
            panelLabServidores.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
346
            gridLayout5.setRows(1);
347
            gridLayout6.setRows(1);
348
            gridLayout7.setRows(1);
349
            panelLabServidores.add(servidoresLabel, null);
350
        }
351

    
352
        return panelLabServidores;
353
    }
354

    
355
    /**
356
     * This method initializes jPanel
357
     *
358
     * @return javax.swing.JPanel
359
     */
360
    private JPanel getJPanel2() {
361
        if (panelServidoresCombo == null) {
362
            panelServidoresCombo = new JPanel();
363
            panelServidoresCombo.setPreferredSize(new java.awt.Dimension(350, 35));
364
            panelServidoresCombo.setName("Protocolos");
365
            panelServidoresCombo.setToolTipText("Protocolos");
366
            panelServidoresCombo.setBorder(javax.swing.BorderFactory.createEmptyBorder(
367
                    0, 0, 0, 0));
368
            panelServidoresCombo.add(getServidoresCombo(), null);
369
        }
370

    
371
        return panelServidoresCombo;
372
    }
373

    
374
    public String getServer() {
375
        return (String) this.getServidoresCombo().getSelectedItem();
376
    }
377

    
378
    public JComboBox getServerCombo() {
379
        return this.getServidoresCombo();
380
    }
381

    
382
    public String getProtocol() {
383
        if (getWFSGButton().isSelected()) {
384
            return "WFS-G";
385
        }
386

    
387
        if (getADLButton().isSelected()) {
388
            return "ADL";
389
        }
390
        
391
        if (getIDECButton().isSelected())
392
        {
393
            return "IDEC";
394
            
395
        }
396
        
397
        
398
        return null;
399
    }
400

    
401
    public void setRespuesta(String texto) {
402
        getRespuestaText().setText(texto);
403
    }
404
    
405

    
406
        /**
407
         * This method initializes jRadioButton        
408
         *         
409
         * @return javax.swing.JRadioButton        
410
         */    
411
        private JRadioButton getIDECButton() {
412
                if (IDECButton == null) {
413
                        IDECButton = new JRadioButton();
414
                        IDECButton.setText("IDEC/SOAP");
415
                }
416
                return IDECButton;
417
        }
418
} //  @jve:decl-index=0:visual-constraint="23,27"