Revision 3566 trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/gazetteer/ui/search/SearchUpperPanel.java

View differences:

SearchUpperPanel.java
1

  
1 2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2 3
*
3 4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
......
39 40
*   dac@iver.es
40 41
*/
41 42
package es.gva.cit.gazetteer.ui.search;
42

  
43

  
43
import es.gva.cit.catalogClient.traductor.ITranslator;
44
import es.gva.cit.catalogClient.traductor.Translator;
44 45
import java.awt.FlowLayout;
45 46
import java.awt.GridLayout;
46

  
47 47
import javax.swing.BoxLayout;
48
import javax.swing.ImageIcon;
49
import javax.swing.JButton;
50
import javax.swing.JCheckBox;
48 51
import javax.swing.JLabel;
49 52
import javax.swing.JPanel;
50 53
import javax.swing.JTextField;
51 54

  
52

  
53
import javax.swing.JCheckBox;
54
import javax.swing.JButton;
55
import javax.swing.ImageIcon;
56

  
57
import es.gva.cit.catalogClient.traductor.ITranslator;
58
import es.gva.cit.catalogClient.traductor.Translator;
59 55
/**
56
 * 
57
 * 
58
 * 
60 59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
61 60
 */
62
public class SearchUpperPanel extends JPanel{
61
public class SearchUpperPanel extends JPanel {
62
/**
63
 * 
64
 * 
65
 */
63 66
    private JTextField tituloText = null;
67
/**
68
 * 
69
 * 
70
 */
64 71
    private JPanel panelLabTitulo = null;
72
/**
73
 * 
74
 * 
75
 */
65 76
    private JLabel tituloLabel = null;
77
/**
78
 * 
79
 * 
80
 */
66 81
    private JPanel panelCheckBox = null;
82
/**
83
 * 
84
 * 
85
 */
67 86
    private JPanel panelTextTitulo = null;
68
	private JCheckBox coordinatesCheckBox = null;
69
	private JPanel upperPanel = null;
70
	private JPanel upperLeftPanel = null;
71
	private JPanel upperRightPanel = null;
72
	private JPanel jPanel1 = null;
73
	private JButton sizeButton = null;
74
	private JPanel jPanel4 = null;
75
	private ITranslator translator = null;
76
	 
77
	/**
78
	 * @param translator
79
	 * Class to translate the interface
80
	 * @param type
81
	 * Server type used to enable/disable some interface components
82
	 */
83
    public SearchUpperPanel(ITranslator translator,String type ) {
87
/**
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) {        
84 136
        super();
85 137
        this.translator = translator;
86 138
        initialize();
87 139
        disableComponents(type);
88
    }
140
    } 
89 141

  
90
    /**
91
     * This method initializes this
92
     *
93
     * @return void
94
     */
95
    private void initialize() {
142
/**
143
 * This method initializes this
144
 * 
145
 */
146
    private void initialize() {        
96 147
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
97 148
        this.setLocation(0, 0);
98 149
        this.setSize(675, 50);
99 150
        this.setPreferredSize(new java.awt.Dimension(510,50));
100 151
        this.add(getUpperPanel(), null);
101
    }
152
    } 
102 153

  
103
    /**
104
     * This method initializes jTextField
105
     *
106
     * @return javax.swing.JTextField
107
     */
108
    private JTextField getTituloText() {
154
/**
155
 * This method initializes jTextField
156
 * 
157
 * 
158
 * @return javax.swing.JTextField
159
 */
160
    private JTextField getTituloText() {        
109 161
        if (tituloText == null) {
110 162
            tituloText = new JTextField();
111 163
            tituloText.setPreferredSize(new java.awt.Dimension(250,20));
112 164
        }
113

  
114 165
        return tituloText;
115
    }
166
    } 
116 167

  
117
    /**
118
     * This method initializes jPanel
119
     *
120
     * @return javax.swing.JPanel
121
     */
122
    private JPanel getPanelLabTitulo() {
168
/**
169
 * This method initializes jPanel
170
 * 
171
 * 
172
 * @return javax.swing.JPanel
173
 */
174
    private JPanel getPanelLabTitulo() {        
123 175
        if (panelLabTitulo == null) {
124 176
            GridLayout gridLayout10 = new GridLayout();
125 177
            tituloLabel = new JLabel();
......
129 181
            gridLayout10.setRows(1);
130 182
            panelLabTitulo.add(tituloLabel, null);
131 183
        }
132

  
133 184
        return panelLabTitulo;
134
    }
185
    } 
135 186

  
136
    /**
137
     * This method initializes jPanel1
138
     *
139
     * @return javax.swing.JPanel
140
     */
141
    private JPanel getPanelCheckBox() {
187
/**
188
 * This method initializes jPanel1
189
 * 
190
 * 
191
 * @return javax.swing.JPanel
192
 */
193
    private JPanel getPanelCheckBox() {        
142 194
        if (panelCheckBox == null) {
143 195
            panelCheckBox = new JPanel();
144 196
            panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS));
......
146 198
            panelCheckBox.add(getCoordinatesCheckBox(), null);
147 199
            panelCheckBox.add(getJPanel4(), null);
148 200
        }
149

  
150 201
        return panelCheckBox;
151
    }
202
    } 
152 203

  
153
    /**
154
     * This method initializes jPanel9
155
     *
156
     * @return javax.swing.JPanel
157
     */
158
    private JPanel getPanelTextTitulo() {
204
/**
205
 * This method initializes jPanel9
206
 * 
207
 * 
208
 * @return javax.swing.JPanel
209
 */
210
    private JPanel getPanelTextTitulo() {        
159 211
        if (panelTextTitulo == null) {
160 212
            panelTextTitulo = new JPanel();
161 213
            panelTextTitulo.add(getTituloText(), null);
162 214
        }
163

  
164 215
        return panelTextTitulo;
165
    }
166

  
167
    /* (non-Javadoc)
216
    } 
217
/* (non-Javadoc)
168 218
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
169 219
     */
170
    public String getName() {
220

  
221
/**
222
 * 
223
 * 
224
 * 
225
 * @return 
226
 */
227
    public String getName() {        
171 228
        if (getTituloText().getText().equals("")) {
172 229
            return null;
173 230
        }
174

  
175 231
        return getTituloText().getText();
176
    }
177

  
178
    /* (non-Javadoc)
232
    } 
233
/* (non-Javadoc)
179 234
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
180 235
     */
181
    public boolean isRestrictAreaClicked() {
236

  
237
/**
238
 * 
239
 * 
240
 * 
241
 * @return 
242
 */
243
    public boolean isRestrictAreaClicked() {        
182 244
        // TODO Auto-generated method stub
183 245
        return coordinatesCheckBox.isSelected();
184
    }
185

  
186
    /* (non-Javadoc)
246
    } 
247
/* (non-Javadoc)
187 248
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
188 249
     */
189
    public void setTitle(String title) {
250

  
251
/**
252
 * 
253
 * 
254
 * 
255
 * @param title 
256
 */
257
    public void setTitle(String title) {        
190 258
        getTituloText().setText(title);
191 259
        
192
    }
260
    } 
193 261

  
194
    
195
	/**
196
	 * This method initializes jCheckBox	
197
	 * 	
198
	 * @return javax.swing.JCheckBox	
199
	 */    
200
	public JCheckBox getCoordinatesCheckBox() {
262
/**
263
 * This method initializes jCheckBox
264
 * 
265
 * 
266
 * @return javax.swing.JCheckBox
267
 */
268
    public JCheckBox getCoordinatesCheckBox() {        
201 269
		if (coordinatesCheckBox == null) {
202 270
			coordinatesCheckBox = new JCheckBox();
203 271
			coordinatesCheckBox.setText(Translator.getText(translator,"restrictArea"));
204 272
		}
205 273
		return coordinatesCheckBox;
206
	}
207
	/**
208
	 * This method initializes jPanel1	
209
	 * 	
210
	 * @return javax.swing.JPanel	
211
	 */    
212
	private JPanel getUpperPanel() {
274
    } 
275

  
276
/**
277
 * This method initializes jPanel1
278
 * 
279
 * 
280
 * @return javax.swing.JPanel
281
 */
282
    private JPanel getUpperPanel() {        
213 283
		if (upperPanel == null) {
214 284
			upperPanel = new JPanel();
215 285
			upperPanel.setLayout(new FlowLayout());
......
218 288
			upperPanel.add(getUpperRightPanel(), null);
219 289
		}
220 290
		return upperPanel;
221
	}
222
	/**
223
	 * This method initializes jPanel1	
224
	 * 	
225
	 * @return javax.swing.JPanel	
226
	 */    
227
	private JPanel getUpperLeftPanel() {
291
    } 
292

  
293
/**
294
 * This method initializes jPanel1
295
 * 
296
 * 
297
 * @return javax.swing.JPanel
298
 */
299
    private JPanel getUpperLeftPanel() {        
228 300
		if (upperLeftPanel == null) {
229 301
			upperLeftPanel = new JPanel();
230 302
			upperLeftPanel.setLayout(new BoxLayout(upperLeftPanel, BoxLayout.Y_AXIS));
......
233 305
			upperLeftPanel.add(getPanelTextTitulo(), null);
234 306
		}
235 307
		return upperLeftPanel;
236
	}
237
	/**
238
	 * This method initializes jPanel4	
239
	 * 	
240
	 * @return javax.swing.JPanel	
241
	 */    
242
	private JPanel getUpperRightPanel() {
308
    } 
309

  
310
/**
311
 * This method initializes jPanel4
312
 * 
313
 * 
314
 * @return javax.swing.JPanel
315
 */
316
    private JPanel getUpperRightPanel() {        
243 317
		if (upperRightPanel == null) {
244 318
			upperRightPanel = new JPanel();
245 319
			upperRightPanel.setLayout(new BoxLayout(upperRightPanel, BoxLayout.Y_AXIS));
......
248 322
			upperRightPanel.add(getPanelCheckBox(), null);
249 323
		}
250 324
		return upperRightPanel;
251
	}
252
	/**
253
	 * This method initializes jPanel1	
254
	 * 	
255
	 * @return javax.swing.JPanel	
256
	 */    
257
	private JPanel getJPanel1() {
325
    } 
326

  
327
/**
328
 * This method initializes jPanel1
329
 * 
330
 * 
331
 * @return javax.swing.JPanel
332
 */
333
    private JPanel getJPanel1() {        
258 334
		if (jPanel1 == null) {
259 335
			jPanel1 = new JPanel();
260 336
			jPanel1.setPreferredSize(new java.awt.Dimension(37,15));
261 337
		}
262 338
		return jPanel1;
263
	}
264
	/**
265
	 * This method initializes jButton	
266
	 * 	
267
	 * @return javax.swing.JButton	
268
	 */    
269
	public JButton getSizeButton() {
339
    } 
340

  
341
/**
342
 * This method initializes jButton
343
 * 
344
 * 
345
 * @return javax.swing.JButton
346
 */
347
    public JButton getSizeButton() {        
270 348
		if (sizeButton == null) {
271 349
			sizeButton = new JButton();
272 350
	        setDownIcon();
......
274 352
			
275 353
		}
276 354
		return sizeButton;
277
	}
278
	/**
279
	 * This method initializes jPanel4	
280
	 * 	
281
	 * @return javax.swing.JPanel	
282
	 */    
283
	private JPanel getJPanel4() {
355
    } 
356

  
357
/**
358
 * This method initializes jPanel4
359
 * 
360
 * 
361
 * @return javax.swing.JPanel
362
 */
363
    private JPanel getJPanel4() {        
284 364
		if (jPanel4 == null) {
285 365
			jPanel4 = new JPanel();
286 366
			jPanel4.add(getSizeButton(), null);
287 367
		}
288 368
		return jPanel4;
289
	}
290
	
291
	/**
292
	 * Sets the UP icon (to minimize)
293
	 */
294
	public void setUpIcon(){
369
    } 
370

  
371
/**
372
 * Sets the UP icon (to minimize)
373
 * 
374
 */
375
    public void setUpIcon() {        
295 376
	    sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png"));
296
	}
297
	
298
	/**
299
	 * Sets the Down icon (to maximize)
300
	 */
301
	public void setDownIcon(){
377
    } 
378

  
379
/**
380
 * Sets the Down icon (to maximize)
381
 * 
382
 */
383
    public void setDownIcon() {        
302 384
	    sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png"));
303
	}
304
	
305
	   /**
306
     * This method disables the components that represent 
307
     * the fileds that the protocol used to do the search doesn't 
308
     * support
309
     * @param type
310
     * Server type: WFS,WFS-G,ADL,IDEC
311
    
312
     */
313
    private void disableComponents(String type){
385
    } 
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) {        
314 396
        //System.out.println("TYPE: " + type);
315 397
        //System.out.println("SUBTYPE: " + profile);
316 398
        
......
330 412
            getCoordinatesCheckBox().setEnabled(false);
331 413
        }
332 414
        
333
    }
334
	
335
   } //  @jve:decl-index=0:visual-constraint="10,10"
415
    } 
416
 }
417
//  @jve:decl-index=0:visual-constraint="10,10"

Also available in: Unified diff