Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / search / SearchUpperPanel.java @ 3613

History | View | Annotate | Download (9.21 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.schemas.Schemas;
44
import es.gva.cit.catalogClient.traductor.ITranslator;
45
import es.gva.cit.catalogClient.traductor.Translator;
46
import es.gva.cit.catalogClient.utils.comboServer.ServerData;
47
import java.awt.FlowLayout;
48
import java.awt.GridLayout;
49
import javax.swing.BoxLayout;
50
import javax.swing.ImageIcon;
51
import javax.swing.JButton;
52
import javax.swing.JCheckBox;
53
import javax.swing.JLabel;
54
import javax.swing.JPanel;
55
import javax.swing.JTextField;
56

    
57
/**
58
 * 
59
 * 
60
 * 
61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
62
 */
63
public class SearchUpperPanel extends JPanel {
64
/**
65
 * 
66
 * 
67
 */
68
    private JTextField tituloText = null;
69
/**
70
 * 
71
 * 
72
 */
73
    private JPanel panelLabTitulo = null;
74
/**
75
 * 
76
 * 
77
 */
78
    private JLabel tituloLabel = null;
79
/**
80
 * 
81
 * 
82
 */
83
    private JPanel panelCheckBox = null;
84
/**
85
 * 
86
 * 
87
 */
88
    private JPanel panelTextTitulo = null;
89
/**
90
 * 
91
 * 
92
 */
93
    private JCheckBox coordinatesCheckBox = null;
94
/**
95
 * 
96
 * 
97
 */
98
    private JPanel upperPanel = null;
99
/**
100
 * 
101
 * 
102
 */
103
    private JPanel upperLeftPanel = null;
104
/**
105
 * 
106
 * 
107
 */
108
    private JPanel upperRightPanel = null;
109
/**
110
 * 
111
 * 
112
 */
113
    private JPanel jPanel1 = null;
114
/**
115
 * 
116
 * 
117
 */
118
    private JButton sizeButton = null;
119
/**
120
 * 
121
 * 
122
 */
123
    private JPanel jPanel4 = null;
124
/**
125
 * 
126
 * 
127
 */
128
    private ITranslator translator = null;
129

    
130
/**
131
 * This method initializes
132
 * 
133
 * 
134
 * @param translator 
135
 * @param type 
136
 * @param profile 
137
 */
138
    public  SearchUpperPanel(ITranslator translator, String type, String profile) {        
139
        super();
140
        this.translator = translator;
141
        initialize();
142
        disableComponents(type,profile);
143
    } 
144

    
145
/**
146
 * This method initializes this
147
 * 
148
 */
149
    private void initialize() {        
150
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
151
        setLocation(0, 0);
152
        setSize(675, 50);
153
        setPreferredSize(new java.awt.Dimension(510,50));
154
        add(getUpperPanel(), null);
155
    } 
156

    
157
/**
158
 * This method initializes jTextField
159
 * 
160
 * 
161
 * @return javax.swing.JTextField
162
 */
163
    private JTextField getTituloText() {        
164
        if (tituloText == null) {
165
            tituloText = new JTextField();
166
            tituloText.setPreferredSize(new java.awt.Dimension(250,20));
167
        }
168
        return tituloText;
169
    } 
170

    
171
/**
172
 * This method initializes jPanel
173
 * 
174
 * 
175
 * @return javax.swing.JPanel
176
 */
177
    private JPanel getPanelLabTitulo() {        
178
        if (panelLabTitulo == null) {
179
            GridLayout gridLayout10 = new GridLayout();
180
            tituloLabel = new JLabel();
181
            panelLabTitulo = new JPanel();
182
            panelLabTitulo.setLayout(gridLayout10);
183
            tituloLabel.setText(Translator.getText(translator,"title"));
184
            gridLayout10.setRows(1);
185
            panelLabTitulo.add(tituloLabel, null);
186
        }
187
        return panelLabTitulo;
188
    } 
189

    
190
/**
191
 * This method initializes jPanel1
192
 * 
193
 * 
194
 * @return javax.swing.JPanel
195
 */
196
    private JPanel getPanelCheckBox() {        
197
        if (panelCheckBox == null) {
198
            panelCheckBox = new JPanel();
199
            panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS));
200
            panelCheckBox.setPreferredSize(new java.awt.Dimension(310,30));
201
            panelCheckBox.add(getCoordinatesCheckBox(), null);
202
            panelCheckBox.add(getJPanel4(), null);
203
        }
204
        return panelCheckBox;
205
    } 
206

    
207
/**
208
 * This method initializes jPanel9
209
 * 
210
 * 
211
 * @return javax.swing.JPanel
212
 */
213
    private JPanel getPanelTextTitulo() {        
214
        if (panelTextTitulo == null) {
215
            panelTextTitulo = new JPanel();
216
            panelTextTitulo.add(getTituloText(), null);
217
        }
218
        return panelTextTitulo;
219
    } 
220
/* (non-Javadoc)
221
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
222
     */
223

    
224
/**
225
 * 
226
 * 
227
 * 
228
 * @return 
229
 */
230
    public String getTitle() {        
231
        if (getTituloText().getText().equals("")) {
232
            return null;
233
        }
234
        return getTituloText().getText();
235
    } 
236
/* (non-Javadoc)
237
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
238
     */
239

    
240
/**
241
 * 
242
 * 
243
 * 
244
 * @return 
245
 */
246
    public boolean getRestrictAreaClicked() {        
247
        // TODO Auto-generated method stub
248
        return coordinatesCheckBox.isSelected();
249
    } 
250
/* (non-Javadoc)
251
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
252
     */
253

    
254
/**
255
 * 
256
 * 
257
 * 
258
 * @param title 
259
 */
260
    public void setTitle(String title) {        
261
        getTituloText().setText(title);
262
        
263
    } 
264

    
265
/**
266
 * This method initializes jCheckBox
267
 * 
268
 * 
269
 * @return javax.swing.JCheckBox
270
 */
271
    public JCheckBox getCoordinatesCheckBox() {        
272
                if (coordinatesCheckBox == null) {
273
                        coordinatesCheckBox = new JCheckBox();
274
                        coordinatesCheckBox.setText(Translator.getText(translator,"restrictArea"));
275
                }
276
                return coordinatesCheckBox;
277
    } 
278

    
279
/**
280
 * This method initializes jPanel1
281
 * 
282
 * 
283
 * @return javax.swing.JPanel
284
 */
285
    private JPanel getUpperPanel() {        
286
                if (upperPanel == null) {
287
                        upperPanel = new JPanel();
288
                        upperPanel.setLayout(new FlowLayout());
289
                        upperPanel.setPreferredSize(new java.awt.Dimension(510,50));
290
                        upperPanel.add(getUpperLeftPanel(), null);
291
                        upperPanel.add(getUpperRightPanel(), null);
292
                }
293
                return upperPanel;
294
    } 
295

    
296
/**
297
 * This method initializes jPanel1
298
 * 
299
 * 
300
 * @return javax.swing.JPanel
301
 */
302
    private JPanel getUpperLeftPanel() {        
303
                if (upperLeftPanel == null) {
304
                        upperLeftPanel = new JPanel();
305
                        upperLeftPanel.setLayout(new BoxLayout(upperLeftPanel, BoxLayout.Y_AXIS));
306
                        upperLeftPanel.setPreferredSize(new java.awt.Dimension(250,45));
307
                        upperLeftPanel.add(getPanelLabTitulo(), null);
308
                        upperLeftPanel.add(getPanelTextTitulo(), null);
309
                }
310
                return upperLeftPanel;
311
    } 
312

    
313
/**
314
 * This method initializes jPanel4
315
 * 
316
 * 
317
 * @return javax.swing.JPanel
318
 */
319
    private JPanel getUpperRightPanel() {        
320
                if (upperRightPanel == null) {
321
                        upperRightPanel = new JPanel();
322
                        upperRightPanel.setLayout(new BoxLayout(upperRightPanel, BoxLayout.Y_AXIS));
323
                        upperRightPanel.setPreferredSize(new java.awt.Dimension(250,45));
324
                        upperRightPanel.add(getJPanel1(), null);
325
                        upperRightPanel.add(getPanelCheckBox(), null);
326
                }
327
                return upperRightPanel;
328
    } 
329

    
330
/**
331
 * This method initializes jPanel1
332
 * 
333
 * 
334
 * @return javax.swing.JPanel
335
 */
336
    private JPanel getJPanel1() {        
337
                if (jPanel1 == null) {
338
                        jPanel1 = new JPanel();
339
                        jPanel1.setPreferredSize(new java.awt.Dimension(37,15));
340
                }
341
                return jPanel1;
342
    } 
343

    
344
/**
345
 * This method initializes jButton
346
 * 
347
 * 
348
 * @return javax.swing.JButton
349
 */
350
    public JButton getSizeButton() {        
351
                if (sizeButton == null) {
352
                        sizeButton = new JButton();
353
                sizeButton.setPreferredSize(new java.awt.Dimension(18,18));
354
                setDownIcon();
355
                }
356
                return sizeButton;
357
    } 
358

    
359
/**
360
 * This method initializes jPanel4
361
 * 
362
 * 
363
 * @return javax.swing.JPanel
364
 */
365
    private JPanel getJPanel4() {        
366
                if (jPanel4 == null) {
367
                        jPanel4 = new JPanel();
368
                        jPanel4.add(getSizeButton(), null);
369
                }
370
                return jPanel4;
371
    } 
372

    
373
/**
374
 * It sets the icon image up
375
 * 
376
 */
377
    public void setUpIcon() {        
378
            sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png"));
379
    } 
380

    
381
/**
382
 * It sets the icon image down
383
 * 
384
 */
385
    public void setDownIcon() {        
386
            sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png"));
387
    } 
388

    
389
/**
390
 * This methos disables the components that are representing
391
 * fileds that the protocol used to do the search doesn't
392
 * support
393
 * 
394
 * 
395
 * @param type Server type: Z3950, SRW or CSW
396
 * @param profile Server Profile: DUBLINCORE, ISO19115, ebRIM
397
 */
398
    private void disableComponents(String type, String profile) {        
399
        //System.out.println("TYPE: " + type);
400
        //System.out.println("SUBTYPE: " + profile);
401
        
402
        if (type.equals(ServerData.SERVER_SUBTYPE_CATALOG_SRW) ||
403
                profile.equals(Schemas.ISO19115) ||
404
                profile.equals(Schemas.DUBLINCORE)){
405
            getCoordinatesCheckBox().setEnabled(false);
406
        }
407
    } 
408
 }
409
//  @jve:decl-index=0:visual-constraint="10,10"