Statistics
| Revision:

root / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / gazetteer / ui / search / SearchUpperPanel.java @ 3229

History | View | Annotate | Download (7.88 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.search;
42

    
43

    
44
import java.awt.FlowLayout;
45
import java.awt.GridLayout;
46

    
47
import javax.swing.BoxLayout;
48
import javax.swing.JLabel;
49
import javax.swing.JPanel;
50
import javax.swing.JTextField;
51

    
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
/**
60
 * @author Jorge Piera Llodra (piera_jor@gva.es)
61
 */
62
public class SearchUpperPanel extends JPanel{
63
    private JTextField tituloText = null;
64
    private JPanel panelLabTitulo = null;
65
    private JLabel tituloLabel = null;
66
    private JPanel panelCheckBox = null;
67
    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
     * This method initializes
78
     *
79
     */
80
    public SearchUpperPanel(ITranslator translator) {
81
        super();
82
        this.translator = translator;
83
        initialize();
84
    }
85

    
86
    /**
87
     * This method initializes this
88
     *
89
     * @return void
90
     */
91
    private void initialize() {
92
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
93
        this.setLocation(0, 0);
94
        this.setSize(675, 50);
95
        this.setPreferredSize(new java.awt.Dimension(510,50));
96
        this.add(getUpperPanel(), null);
97
    }
98

    
99
    /**
100
     * This method initializes jTextField
101
     *
102
     * @return javax.swing.JTextField
103
     */
104
    private JTextField getTituloText() {
105
        if (tituloText == null) {
106
            tituloText = new JTextField();
107
            tituloText.setPreferredSize(new java.awt.Dimension(250,20));
108
        }
109

    
110
        return tituloText;
111
    }
112

    
113
    /**
114
     * This method initializes jPanel
115
     *
116
     * @return javax.swing.JPanel
117
     */
118
    private JPanel getPanelLabTitulo() {
119
        if (panelLabTitulo == null) {
120
            GridLayout gridLayout10 = new GridLayout();
121
            tituloLabel = new JLabel();
122
            panelLabTitulo = new JPanel();
123
            panelLabTitulo.setLayout(gridLayout10);
124
            tituloLabel.setText(Translator.getText(translator,"name"));
125
            gridLayout10.setRows(1);
126
            panelLabTitulo.add(tituloLabel, null);
127
        }
128

    
129
        return panelLabTitulo;
130
    }
131

    
132
    /**
133
     * This method initializes jPanel1
134
     *
135
     * @return javax.swing.JPanel
136
     */
137
    private JPanel getPanelCheckBox() {
138
        if (panelCheckBox == null) {
139
            panelCheckBox = new JPanel();
140
            panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS));
141
            panelCheckBox.setPreferredSize(new java.awt.Dimension(310,30));
142
            panelCheckBox.add(getCoordinatesCheckBox(), null);
143
            panelCheckBox.add(getJPanel4(), null);
144
        }
145

    
146
        return panelCheckBox;
147
    }
148

    
149
    /**
150
     * This method initializes jPanel9
151
     *
152
     * @return javax.swing.JPanel
153
     */
154
    private JPanel getPanelTextTitulo() {
155
        if (panelTextTitulo == null) {
156
            panelTextTitulo = new JPanel();
157
            panelTextTitulo.add(getTituloText(), null);
158
        }
159

    
160
        return panelTextTitulo;
161
    }
162

    
163
    /* (non-Javadoc)
164
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
165
     */
166
    public String getName() {
167
        if (getTituloText().getText().equals("")) {
168
            return null;
169
        }
170

    
171
        return getTituloText().getText();
172
    }
173

    
174
    /* (non-Javadoc)
175
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
176
     */
177
    public boolean getRestrictAreaClicked() {
178
        // TODO Auto-generated method stub
179
        return coordinatesCheckBox.isSelected();
180
    }
181

    
182
    /* (non-Javadoc)
183
     * @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
184
     */
185
    public void setTitle(String title) {
186
        getTituloText().setText(title);
187
        
188
    }
189

    
190
    
191
        /**
192
         * This method initializes jCheckBox        
193
         *         
194
         * @return javax.swing.JCheckBox        
195
         */    
196
        public JCheckBox getCoordinatesCheckBox() {
197
                if (coordinatesCheckBox == null) {
198
                        coordinatesCheckBox = new JCheckBox();
199
                        coordinatesCheckBox.setText(Translator.getText(translator,"restrictArea"));
200
                }
201
                return coordinatesCheckBox;
202
        }
203
        /**
204
         * This method initializes jPanel1        
205
         *         
206
         * @return javax.swing.JPanel        
207
         */    
208
        private JPanel getUpperPanel() {
209
                if (upperPanel == null) {
210
                        upperPanel = new JPanel();
211
                        upperPanel.setLayout(new FlowLayout());
212
                        upperPanel.setPreferredSize(new java.awt.Dimension(510,50));
213
                        upperPanel.add(getUpperLeftPanel(), null);
214
                        upperPanel.add(getUpperRightPanel(), null);
215
                }
216
                return upperPanel;
217
        }
218
        /**
219
         * This method initializes jPanel1        
220
         *         
221
         * @return javax.swing.JPanel        
222
         */    
223
        private JPanel getUpperLeftPanel() {
224
                if (upperLeftPanel == null) {
225
                        upperLeftPanel = new JPanel();
226
                        upperLeftPanel.setLayout(new BoxLayout(upperLeftPanel, BoxLayout.Y_AXIS));
227
                        upperLeftPanel.setPreferredSize(new java.awt.Dimension(250,45));
228
                        upperLeftPanel.add(getPanelLabTitulo(), null);
229
                        upperLeftPanel.add(getPanelTextTitulo(), null);
230
                }
231
                return upperLeftPanel;
232
        }
233
        /**
234
         * This method initializes jPanel4        
235
         *         
236
         * @return javax.swing.JPanel        
237
         */    
238
        private JPanel getUpperRightPanel() {
239
                if (upperRightPanel == null) {
240
                        upperRightPanel = new JPanel();
241
                        upperRightPanel.setLayout(new BoxLayout(upperRightPanel, BoxLayout.Y_AXIS));
242
                        upperRightPanel.setPreferredSize(new java.awt.Dimension(250,45));
243
                        upperRightPanel.add(getJPanel1(), null);
244
                        upperRightPanel.add(getPanelCheckBox(), null);
245
                }
246
                return upperRightPanel;
247
        }
248
        /**
249
         * This method initializes jPanel1        
250
         *         
251
         * @return javax.swing.JPanel        
252
         */    
253
        private JPanel getJPanel1() {
254
                if (jPanel1 == null) {
255
                        jPanel1 = new JPanel();
256
                        jPanel1.setPreferredSize(new java.awt.Dimension(37,15));
257
                }
258
                return jPanel1;
259
        }
260
        /**
261
         * This method initializes jButton        
262
         *         
263
         * @return javax.swing.JButton        
264
         */    
265
        public JButton getSizeButton() {
266
                if (sizeButton == null) {
267
                        sizeButton = new JButton();
268
                setDownIcon();
269
                        sizeButton.setPreferredSize(new java.awt.Dimension(18,18));
270
                        
271
                }
272
                return sizeButton;
273
        }
274
        /**
275
         * This method initializes jPanel4        
276
         *         
277
         * @return javax.swing.JPanel        
278
         */    
279
        private JPanel getJPanel4() {
280
                if (jPanel4 == null) {
281
                        jPanel4 = new JPanel();
282
                        jPanel4.add(getSizeButton(), null);
283
                }
284
                return jPanel4;
285
        }
286
        public void setUpIcon(){
287
            sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png"));
288
        }
289
        
290
        public void setDownIcon(){
291
            sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png"));
292
        }
293
        
294
   } //  @jve:decl-index=0:visual-constraint="10,10"