Statistics
| Revision:

svn-gvsig-desktop / tags / Root_v061 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / gazetteer / ui / search / SearchUpperPanel.java @ 4812

History | View | Annotate | Download (9.29 KB)

1 3566 jorpiell
2 3214 jorpiell
/* 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 3613 jorpiell
import es.gva.cit.catalogClient.traductor.ITranslator;
44
import es.gva.cit.catalogClient.traductor.Translator;
45 3214 jorpiell
import java.awt.FlowLayout;
46
import java.awt.GridLayout;
47
import javax.swing.BoxLayout;
48 3566 jorpiell
import javax.swing.ImageIcon;
49
import javax.swing.JButton;
50
import javax.swing.JCheckBox;
51 3214 jorpiell
import javax.swing.JLabel;
52
import javax.swing.JPanel;
53
import javax.swing.JTextField;
54
55
/**
56 3566 jorpiell
 *
57
 *
58
 *
59 3214 jorpiell
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61 3566 jorpiell
public class SearchUpperPanel extends JPanel {
62
/**
63
 *
64
 *
65
 */
66 3214 jorpiell
    private JTextField tituloText = null;
67 3566 jorpiell
/**
68
 *
69
 *
70
 */
71 3214 jorpiell
    private JPanel panelLabTitulo = null;
72 3566 jorpiell
/**
73
 *
74
 *
75
 */
76 3214 jorpiell
    private JLabel tituloLabel = null;
77 3566 jorpiell
/**
78
 *
79
 *
80
 */
81 3214 jorpiell
    private JPanel panelCheckBox = null;
82 3566 jorpiell
/**
83
 *
84
 *
85
 */
86 3214 jorpiell
    private JPanel panelTextTitulo = null;
87 3566 jorpiell
/**
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 3214 jorpiell
        super();
137 3229 jorpiell
        this.translator = translator;
138 3214 jorpiell
        initialize();
139 3460 jorpiell
        disableComponents(type);
140 3566 jorpiell
    }
141 3214 jorpiell
142 3566 jorpiell
/**
143
 * This method initializes this
144
 *
145
 */
146
    private void initialize() {
147 3214 jorpiell
        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 3566 jorpiell
    }
153 3214 jorpiell
154 3566 jorpiell
/**
155
 * This method initializes jTextField
156
 *
157
 *
158
 * @return javax.swing.JTextField
159
 */
160
    private JTextField getTituloText() {
161 3214 jorpiell
        if (tituloText == null) {
162
            tituloText = new JTextField();
163
            tituloText.setPreferredSize(new java.awt.Dimension(250,20));
164
        }
165
        return tituloText;
166 3566 jorpiell
    }
167 3214 jorpiell
168 3566 jorpiell
/**
169
 * This method initializes jPanel
170
 *
171
 *
172
 * @return javax.swing.JPanel
173
 */
174
    private JPanel getPanelLabTitulo() {
175 3214 jorpiell
        if (panelLabTitulo == null) {
176
            GridLayout gridLayout10 = new GridLayout();
177
            tituloLabel = new JLabel();
178
            panelLabTitulo = new JPanel();
179
            panelLabTitulo.setLayout(gridLayout10);
180 3229 jorpiell
            tituloLabel.setText(Translator.getText(translator,"name"));
181 3214 jorpiell
            gridLayout10.setRows(1);
182
            panelLabTitulo.add(tituloLabel, null);
183
        }
184
        return panelLabTitulo;
185 3566 jorpiell
    }
186 3214 jorpiell
187 3566 jorpiell
/**
188
 * This method initializes jPanel1
189
 *
190
 *
191
 * @return javax.swing.JPanel
192
 */
193
    private JPanel getPanelCheckBox() {
194 3214 jorpiell
        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 3566 jorpiell
    }
203 3214 jorpiell
204 3566 jorpiell
/**
205
 * This method initializes jPanel9
206
 *
207
 *
208
 * @return javax.swing.JPanel
209
 */
210
    private JPanel getPanelTextTitulo() {
211 3214 jorpiell
        if (panelTextTitulo == null) {
212
            panelTextTitulo = new JPanel();
213
            panelTextTitulo.add(getTituloText(), null);
214
        }
215
        return panelTextTitulo;
216 3566 jorpiell
    }
217
/* (non-Javadoc)
218 3214 jorpiell
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
219
     */
220 3566 jorpiell
221
/**
222
 *
223
 *
224
 *
225
 * @return
226
 */
227
    public String getName() {
228 3214 jorpiell
        if (getTituloText().getText().equals("")) {
229
            return null;
230
        }
231
        return getTituloText().getText();
232 3566 jorpiell
    }
233
/* (non-Javadoc)
234 3214 jorpiell
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
235
     */
236 3566 jorpiell
237
/**
238
 *
239
 *
240
 *
241
 * @return
242
 */
243
    public boolean isRestrictAreaClicked() {
244 3214 jorpiell
        // TODO Auto-generated method stub
245
        return coordinatesCheckBox.isSelected();
246 3566 jorpiell
    }
247
/* (non-Javadoc)
248 3214 jorpiell
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
249
     */
250 3566 jorpiell
251
/**
252
 *
253
 *
254
 *
255
 * @param title
256
 */
257
    public void setTitle(String title) {
258 3214 jorpiell
        getTituloText().setText(title);
259
260 3566 jorpiell
    }
261 3214 jorpiell
262 3566 jorpiell
/**
263
 * This method initializes jCheckBox
264
 *
265
 *
266
 * @return javax.swing.JCheckBox
267
 */
268
    public JCheckBox getCoordinatesCheckBox() {
269 3214 jorpiell
                if (coordinatesCheckBox == null) {
270
                        coordinatesCheckBox = new JCheckBox();
271 3229 jorpiell
                        coordinatesCheckBox.setText(Translator.getText(translator,"restrictArea"));
272 3214 jorpiell
                }
273
                return coordinatesCheckBox;
274 3566 jorpiell
    }
275
276
/**
277
 * This method initializes jPanel1
278
 *
279
 *
280
 * @return javax.swing.JPanel
281
 */
282
    private JPanel getUpperPanel() {
283 3214 jorpiell
                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 3566 jorpiell
    }
292
293
/**
294
 * This method initializes jPanel1
295
 *
296
 *
297
 * @return javax.swing.JPanel
298
 */
299
    private JPanel getUpperLeftPanel() {
300 3214 jorpiell
                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 3566 jorpiell
    }
309
310
/**
311
 * This method initializes jPanel4
312
 *
313
 *
314
 * @return javax.swing.JPanel
315
 */
316
    private JPanel getUpperRightPanel() {
317 3214 jorpiell
                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 3566 jorpiell
    }
326
327
/**
328
 * This method initializes jPanel1
329
 *
330
 *
331
 * @return javax.swing.JPanel
332
 */
333
    private JPanel getJPanel1() {
334 3214 jorpiell
                if (jPanel1 == null) {
335
                        jPanel1 = new JPanel();
336
                        jPanel1.setPreferredSize(new java.awt.Dimension(37,15));
337
                }
338
                return jPanel1;
339 3566 jorpiell
    }
340
341
/**
342
 * This method initializes jButton
343
 *
344
 *
345
 * @return javax.swing.JButton
346
 */
347
    public JButton getSizeButton() {
348 3214 jorpiell
                if (sizeButton == null) {
349
                        sizeButton = new JButton();
350 3229 jorpiell
                setDownIcon();
351 3214 jorpiell
                        sizeButton.setPreferredSize(new java.awt.Dimension(18,18));
352
353
                }
354
                return sizeButton;
355 3566 jorpiell
    }
356
357
/**
358
 * This method initializes jPanel4
359
 *
360
 *
361
 * @return javax.swing.JPanel
362
 */
363
    private JPanel getJPanel4() {
364 3214 jorpiell
                if (jPanel4 == null) {
365
                        jPanel4 = new JPanel();
366
                        jPanel4.add(getSizeButton(), null);
367
                }
368
                return jPanel4;
369 3566 jorpiell
    }
370
371
/**
372
 * Sets the UP icon (to minimize)
373
 *
374
 */
375
    public void setUpIcon() {
376 3214 jorpiell
            sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png"));
377 3566 jorpiell
    }
378
379
/**
380
 * Sets the Down icon (to maximize)
381
 *
382
 */
383
    public void setDownIcon() {
384 3214 jorpiell
            sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png"));
385 3566 jorpiell
    }
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 3460 jorpiell
        //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 3566 jorpiell
    }
416
 }
417
//  @jve:decl-index=0:visual-constraint="10,10"