root / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / search / SearchUpperPanel.java @ 3456
History | View | Annotate | Download (8.66 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.catalogClient.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 |
/**
|
78 |
* This method initializes
|
79 |
*
|
80 |
*/
|
81 |
public SearchUpperPanel(ITranslator translator,String type,String profile) { |
82 |
super();
|
83 |
this.translator = translator;
|
84 |
initialize(); |
85 |
disableComponents(type,profile); |
86 |
} |
87 |
|
88 |
/**
|
89 |
* This method initializes this
|
90 |
*
|
91 |
* @return void
|
92 |
*/
|
93 |
private void initialize() { |
94 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
95 |
setLocation(0, 0); |
96 |
setSize(675, 50); |
97 |
setPreferredSize(new java.awt.Dimension(510,50)); |
98 |
add(getUpperPanel(), null);
|
99 |
} |
100 |
|
101 |
/**
|
102 |
* This method initializes jTextField
|
103 |
*
|
104 |
* @return javax.swing.JTextField
|
105 |
*/
|
106 |
private JTextField getTituloText() { |
107 |
if (tituloText == null) { |
108 |
tituloText = new JTextField(); |
109 |
tituloText.setPreferredSize(new java.awt.Dimension(250,20)); |
110 |
} |
111 |
|
112 |
return tituloText;
|
113 |
} |
114 |
|
115 |
/**
|
116 |
* This method initializes jPanel
|
117 |
*
|
118 |
* @return javax.swing.JPanel
|
119 |
*/
|
120 |
private JPanel getPanelLabTitulo() { |
121 |
if (panelLabTitulo == null) { |
122 |
GridLayout gridLayout10 = new GridLayout(); |
123 |
tituloLabel = new JLabel(); |
124 |
panelLabTitulo = new JPanel(); |
125 |
panelLabTitulo.setLayout(gridLayout10); |
126 |
tituloLabel.setText(Translator.getText(translator,"title"));
|
127 |
gridLayout10.setRows(1);
|
128 |
panelLabTitulo.add(tituloLabel, null);
|
129 |
} |
130 |
|
131 |
return panelLabTitulo;
|
132 |
} |
133 |
|
134 |
/**
|
135 |
* This method initializes jPanel1
|
136 |
*
|
137 |
* @return javax.swing.JPanel
|
138 |
*/
|
139 |
private JPanel getPanelCheckBox() { |
140 |
if (panelCheckBox == null) { |
141 |
panelCheckBox = new JPanel(); |
142 |
panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS)); |
143 |
panelCheckBox.setPreferredSize(new java.awt.Dimension(310,30)); |
144 |
panelCheckBox.add(getCoordinatesCheckBox(), null);
|
145 |
panelCheckBox.add(getJPanel4(), null);
|
146 |
} |
147 |
|
148 |
return panelCheckBox;
|
149 |
} |
150 |
|
151 |
/**
|
152 |
* This method initializes jPanel9
|
153 |
*
|
154 |
* @return javax.swing.JPanel
|
155 |
*/
|
156 |
private JPanel getPanelTextTitulo() { |
157 |
if (panelTextTitulo == null) { |
158 |
panelTextTitulo = new JPanel(); |
159 |
panelTextTitulo.add(getTituloText(), null);
|
160 |
} |
161 |
|
162 |
return panelTextTitulo;
|
163 |
} |
164 |
|
165 |
/* (non-Javadoc)
|
166 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#getTitle()
|
167 |
*/
|
168 |
public String getTitle() { |
169 |
if (getTituloText().getText().equals("")) { |
170 |
return null; |
171 |
} |
172 |
|
173 |
return getTituloText().getText();
|
174 |
} |
175 |
|
176 |
/* (non-Javadoc)
|
177 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#getRestrictAreaClicked()
|
178 |
*/
|
179 |
public boolean getRestrictAreaClicked() { |
180 |
// TODO Auto-generated method stub
|
181 |
return coordinatesCheckBox.isSelected();
|
182 |
} |
183 |
|
184 |
/* (non-Javadoc)
|
185 |
* @see es.gva.cit.catalogClient.ui.ISearchPanel#setTitle(java.lang.String)
|
186 |
*/
|
187 |
public void setTitle(String title) { |
188 |
getTituloText().setText(title); |
189 |
|
190 |
} |
191 |
|
192 |
|
193 |
/**
|
194 |
* This method initializes jCheckBox
|
195 |
*
|
196 |
* @return javax.swing.JCheckBox
|
197 |
*/
|
198 |
public JCheckBox getCoordinatesCheckBox() { |
199 |
if (coordinatesCheckBox == null) { |
200 |
coordinatesCheckBox = new JCheckBox(); |
201 |
coordinatesCheckBox.setText(Translator.getText(translator,"restrictArea"));
|
202 |
} |
203 |
return coordinatesCheckBox;
|
204 |
} |
205 |
/**
|
206 |
* This method initializes jPanel1
|
207 |
*
|
208 |
* @return javax.swing.JPanel
|
209 |
*/
|
210 |
private JPanel getUpperPanel() { |
211 |
if (upperPanel == null) { |
212 |
upperPanel = new JPanel(); |
213 |
upperPanel.setLayout(new FlowLayout()); |
214 |
upperPanel.setPreferredSize(new java.awt.Dimension(510,50)); |
215 |
upperPanel.add(getUpperLeftPanel(), null);
|
216 |
upperPanel.add(getUpperRightPanel(), null);
|
217 |
} |
218 |
return upperPanel;
|
219 |
} |
220 |
/**
|
221 |
* This method initializes jPanel1
|
222 |
*
|
223 |
* @return javax.swing.JPanel
|
224 |
*/
|
225 |
private JPanel getUpperLeftPanel() { |
226 |
if (upperLeftPanel == null) { |
227 |
upperLeftPanel = new JPanel(); |
228 |
upperLeftPanel.setLayout(new BoxLayout(upperLeftPanel, BoxLayout.Y_AXIS)); |
229 |
upperLeftPanel.setPreferredSize(new java.awt.Dimension(250,45)); |
230 |
upperLeftPanel.add(getPanelLabTitulo(), null);
|
231 |
upperLeftPanel.add(getPanelTextTitulo(), null);
|
232 |
} |
233 |
return upperLeftPanel;
|
234 |
} |
235 |
/**
|
236 |
* This method initializes jPanel4
|
237 |
*
|
238 |
* @return javax.swing.JPanel
|
239 |
*/
|
240 |
private JPanel getUpperRightPanel() { |
241 |
if (upperRightPanel == null) { |
242 |
upperRightPanel = new JPanel(); |
243 |
upperRightPanel.setLayout(new BoxLayout(upperRightPanel, BoxLayout.Y_AXIS)); |
244 |
upperRightPanel.setPreferredSize(new java.awt.Dimension(250,45)); |
245 |
upperRightPanel.add(getJPanel1(), null);
|
246 |
upperRightPanel.add(getPanelCheckBox(), null);
|
247 |
} |
248 |
return upperRightPanel;
|
249 |
} |
250 |
/**
|
251 |
* This method initializes jPanel1
|
252 |
*
|
253 |
* @return javax.swing.JPanel
|
254 |
*/
|
255 |
private JPanel getJPanel1() { |
256 |
if (jPanel1 == null) { |
257 |
jPanel1 = new JPanel(); |
258 |
jPanel1.setPreferredSize(new java.awt.Dimension(37,15)); |
259 |
} |
260 |
return jPanel1;
|
261 |
} |
262 |
/**
|
263 |
* This method initializes jButton
|
264 |
*
|
265 |
* @return javax.swing.JButton
|
266 |
*/
|
267 |
public JButton getSizeButton() { |
268 |
if (sizeButton == null) { |
269 |
sizeButton = new JButton(); |
270 |
sizeButton.setPreferredSize(new java.awt.Dimension(18,18)); |
271 |
setDownIcon(); |
272 |
} |
273 |
return sizeButton;
|
274 |
} |
275 |
/**
|
276 |
* This method initializes jPanel4
|
277 |
*
|
278 |
* @return javax.swing.JPanel
|
279 |
*/
|
280 |
private JPanel getJPanel4() { |
281 |
if (jPanel4 == null) { |
282 |
jPanel4 = new JPanel(); |
283 |
jPanel4.add(getSizeButton(), null);
|
284 |
} |
285 |
return jPanel4;
|
286 |
} |
287 |
|
288 |
/**
|
289 |
* It sets the icon image up
|
290 |
*
|
291 |
*/
|
292 |
public void setUpIcon(){ |
293 |
sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/up.png")); |
294 |
} |
295 |
|
296 |
/**
|
297 |
* It sets the icon image down
|
298 |
*
|
299 |
*/
|
300 |
public void setDownIcon(){ |
301 |
sizeButton.setIcon(new ImageIcon("./gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/images/down.png")); |
302 |
} |
303 |
|
304 |
/**
|
305 |
* This methos disables the components that are representing
|
306 |
* fileds that the protocol used to do the search doesn't
|
307 |
* support
|
308 |
* @param type
|
309 |
* Server type: Z3950, SRW or CSW
|
310 |
* @param profile
|
311 |
* Server Profile: DUBLINCORE, ISO19115, ebRIM
|
312 |
*/
|
313 |
private void disableComponents(String type,String profile){ |
314 |
System.out.println("TYPE: " + type); |
315 |
System.out.println("SUBTYPE: " + profile); |
316 |
|
317 |
if (type.equals("SRW") || |
318 |
profile.equals("ISO19115") ||
|
319 |
profile.equals("DUBLINCORE")){
|
320 |
getCoordinatesCheckBox().setEnabled(false);
|
321 |
} |
322 |
} |
323 |
|
324 |
|
325 |
} // @jve:decl-index=0:visual-constraint="10,10"
|