Revision 36287

View differences:

tags/v2_0_0_Build_2035/applications/appGazetteer/src/org/gvsig/gazetteer/ui/search/SearchDialog.java
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 org.gvsig.gazetteer.ui.search;
43
import java.awt.event.WindowEvent;
44
import java.awt.event.WindowListener;
45

  
46
import javax.swing.JFrame;
47

  
48
import org.gvsig.catalog.utils.Frames;
49
import org.gvsig.gazetteer.GazetteerClient;
50

  
51

  
52
/**
53
 * This class represents the search frame.
54
 * 
55
 * 
56
 * @author Jorge Piera Llodra (piera_jor@gva.es)
57
 */
58
public class SearchDialog extends JFrame implements WindowListener {
59

  
60
/**
61
 * Crea un nuevo SearchDialog.
62
 * 
63
 * @param cliente DOCUMENT ME!
64
 * 
65
 * @param gazetterClient 
66
 */
67
    public  SearchDialog(GazetteerClient gazetterClient,Object serverConnectFrame) {        
68
        super();
69
        initialize(gazetterClient, serverConnectFrame);
70
    } 
71

  
72
/**
73
 * This method initializes jDialog
74
 * 
75
 * 
76
 * @param gazetterClient 
77
 */
78
    private void initialize(org.gvsig.gazetteer.GazetteerClient gazetterClient,Object serverConnectFrame) {        
79
        Frames.centerFrame(this,525,115);
80
                
81
      this.setTitle("B?squeda por Nomencl?tor");
82
      setName("search");
83
        SearchDialogPanel panel = new SearchDialogPanel(gazetterClient,serverConnectFrame);
84
        panel.setGazetteerClient(gazetterClient);
85
        panel.setParent(this);
86
        getContentPane().add(panel);
87
        addWindowListener(this);
88
        setVisible(true);
89
    } 
90
/* (non-Javadoc)
91
     * @see java.awt.event.WindowListener#windowActivated(java.awt.event.WindowEvent)
92
     */
93

  
94
/**
95
 * 
96
 * 
97
 * 
98
 * @param e 
99
 */
100
    public void windowActivated(WindowEvent e) {        
101
        // your code here
102
    } 
103
/* (non-Javadoc)
104
     * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent)
105
     */
106

  
107
/**
108
 * 
109
 * 
110
 * 
111
 * @param e 
112
 */
113
    public void windowClosed(WindowEvent e) {        
114
        System.exit(0);
115
    } 
116
/* (non-Javadoc)
117
     * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent)
118
     */
119

  
120
/**
121
 * 
122
 * 
123
 * 
124
 * @param arg0 
125
 */
126
    public void windowClosing(WindowEvent arg0) {        
127
        System.exit(0);
128
    } 
129
/* (non-Javadoc)
130
     * @see java.awt.event.WindowListener#windowDeactivated(java.awt.event.WindowEvent)
131
     */
132

  
133
/**
134
 * 
135
 * 
136
 * 
137
 * @param e 
138
 */
139
    public void windowDeactivated(WindowEvent e) {        
140
        // your code here
141
    } 
142
/* (non-Javadoc)
143
     * @see java.awt.event.WindowListener#windowDeiconified(java.awt.event.WindowEvent)
144
     */
145

  
146
/**
147
 * 
148
 * 
149
 * 
150
 * @param e 
151
 */
152
    public void windowDeiconified(WindowEvent e) {        
153
        // your code here
154
    } 
155
/* (non-Javadoc)
156
     * @see java.awt.event.WindowListener#windowIconified(java.awt.event.WindowEvent)
157
     */
158

  
159
/**
160
 * 
161
 * 
162
 * 
163
 * @param e 
164
 */
165
    public void windowIconified(WindowEvent e) {        
166
        // your code here
167
    } 
168
/* (non-Javadoc)
169
     * @see java.awt.event.WindowListener#windowOpened(java.awt.event.WindowEvent)
170
     */
171

  
172
/**
173
 * 
174
 * 
175
 * 
176
 * @param e 
177
 */
178
    public void windowOpened(WindowEvent e) {        
179
        // your code here
180
    } 
181
 }
0 182

  
tags/v2_0_0_Build_2035/applications/appGazetteer/src/org/gvsig/gazetteer/ui/search/SearchDialogPanel.java
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 org.gvsig.gazetteer.ui.search;
43
import java.awt.BorderLayout;
44
import java.awt.Cursor;
45
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionListener;
47
import java.util.Collection;
48

  
49
import javax.swing.Icon;
50
import javax.swing.ImageIcon;
51
import javax.swing.JFrame;
52
import javax.swing.JOptionPane;
53
import javax.swing.JPanel;
54

  
55
import org.gvsig.catalog.ui.search.SearchButtonPanel;
56
import org.gvsig.catalog.utils.CatalogConstants;
57
import org.gvsig.gazetteer.GazetteerClient;
58
import org.gvsig.gazetteer.querys.Feature;
59
import org.gvsig.gazetteer.querys.FeatureType;
60
import org.gvsig.gazetteer.querys.FeatureTypeAttribute;
61
import org.gvsig.gazetteer.querys.GazetteerQuery;
62
import org.gvsig.gazetteer.ui.showresults.ShowResultsDialog;
63
import org.gvsig.i18n.Messages;
64

  
65

  
66
/**
67
 * @author Jorge Piera Llodra (piera_jor@gva.es)
68
 */
69
public class SearchDialogPanel extends JPanel implements ActionListener {
70
	private JFrame parent;
71
	private GazetteerQuery query = null;
72
	protected Object serverConnectFrame;
73
	protected SearchUpperPanel upperPanel = null;
74
	protected SearchLowerPanel lowerPanel = null;
75
	protected SearchButtonPanel buttonsPanel = null;
76
	protected GazetteerClient client = null;
77
	protected boolean isMinimized = true;
78
	protected Feature[] features = null;
79
	private Collection searchThreads = null;
80
	private String currentServer = null;
81
	private String featureAttribute = null;
82

  
83
	/**
84
	 * This method initializes
85
	 * 
86
	 * 
87
	 * @param client 
88
	 * @param translator 
89
	 */
90
	public  SearchDialogPanel(GazetteerClient client, Object serverConnectFrame) {        
91
		super();
92
		searchThreads = new java.util.ArrayList();
93
		this.client = client;
94
		this.isMinimized = true;
95
		this.serverConnectFrame = serverConnectFrame;
96
		initialize();
97
		getUpperPanel().setIcon(getDownIcon());
98
	} 
99

  
100
	/**
101
	 * This method initializes this
102
	 */
103
	private void initialize() {        
104
		setLayout(new BorderLayout());
105
		add(getUpperPanel(),BorderLayout.NORTH);
106
		add(getLowerPanel(),BorderLayout.CENTER);
107
		add(getButtonPanel(),BorderLayout.SOUTH);
108
		getLowerPanel().setVisible(false);
109
	} 
110

  
111
	/**
112
	 * It Gets the upperPanel
113
	 * @return 
114
	 */
115
	public SearchUpperPanel getUpperPanel() {        
116
		if (upperPanel == null){
117
			upperPanel = new SearchUpperPanel(); 
118
			upperPanel.addActionListener(this);
119
		}
120
		return upperPanel;
121

  
122
	} 
123

  
124
	/**
125
	 * It Gets the lowePanel
126
	 * @return 
127
	 */
128
	public SearchLowerPanel getLowerPanel() {        
129
		if (lowerPanel == null){
130
			FeatureType[] types = null;			
131
			try {
132
				types = ((GazetteerClient)client).getFeatureTypes();
133
			} catch (Exception e) {
134
				//The thesaurus will not loaded
135
			}			
136
			lowerPanel = new SearchLowerPanel(types,
137
					client.getAditionalSearchPanel());
138
			lowerPanel.addResultsByPageNumber(10);
139
			lowerPanel.addResultsByPageNumber(25);
140
			lowerPanel.addResultsByPageNumber(50);
141
			lowerPanel.addCoordinatesRelationship(
142
					Messages.getText("coordinatesContains"));
143
			lowerPanel.addCoordinatesRelationship(
144
					Messages.getText("coordinatesFullyOutsideOf"));
145
		}
146
		return lowerPanel;
147
	} 
148

  
149
	/**
150
	 * Set the gazetteer client
151
	 * @param 
152
	 * Gazetteer client to set
153
	 */
154
	public void setGazetteerClient(GazetteerClient gazetteerClient) {        
155
		this.client = gazetteerClient;
156
	} 
157

  
158
	/**
159
	 * @return the buttons panel
160
	 */
161
	public JPanel getButtonPanel() {        
162
		if (buttonsPanel == null) {
163
			buttonsPanel = new SearchButtonPanel();
164
			buttonsPanel.addActionListener(this);			
165
		}
166
		return buttonsPanel;
167
	} 	
168

  
169
	/**
170
	 * @return 
171
	 */
172
	public FeatureType getFeatureSelected() {        
173
		return lowerPanel.getType();
174
	} 
175

  
176
	/*
177
	 * (non-Javadoc)
178
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
179
	 */	
180
	public void actionPerformed(ActionEvent e) {        
181
		if (e.getActionCommand().compareTo(CatalogConstants.SEARCH_BUTTON_ACTION_COMMAND)==0) {
182
			searchButtonActionPerformed();
183
		}else if (e.getActionCommand().compareTo(CatalogConstants.CLOSE_BUTTON_ACTION_COMMAND)==0){
184
			closeButtonActionPerformed();
185
		}else if(e.getActionCommand().compareTo(CatalogConstants.RESIZE_BUTTON_ACTION_COMMAND)==0){
186
			resizeButtonActionPerformed();
187
		}else if (e.getActionCommand().compareTo(CatalogConstants.CANCEL_BUTTON_ACTION_COMMAND)==0){
188
			cancelSearchesButtonActionPerformed();
189
		}else if (e.getActionCommand().compareTo(CatalogConstants.LAST_BUTTON_ACTION_COMMAND)==0){
190
			lastButtonActionPerformed();
191
		}
192
	} 
193

  
194
	/**
195
	 * thrown when the resize button is clicked
196
	 */
197
	protected void resizeButtonActionPerformed() {        
198
		if (isMinimized){
199
			parent.setSize(parent.getWidth(),450);
200
			parent.doLayout();
201
			getLowerPanel().setVisible(true);
202
			getUpperPanel().setIcon(getUpIcon());
203
		}else{
204
			parent.setSize(parent.getWidth(),115);
205
			getLowerPanel().setVisible(false);			
206
			getUpperPanel().setIcon(getDownIcon());
207
		}
208
		isMinimized = !isMinimized;
209
	} 
210
	
211
	
212
	protected Icon getUpIcon(){
213
		return new ImageIcon("./gvSIG/extensiones/org.gvsig.catalog/images/up.png");
214
	}
215
	
216
	protected Icon getDownIcon(){
217
		return new ImageIcon("./gvSIG/extensiones/org.gvsig.catalog/images/down.png");
218
	}
219

  
220

  
221
	/**
222
	 * thrown when the search button is clicked
223
	 * @throws Exception 
224
	 */
225
	protected void searchButtonActionPerformed() {        
226
		FeatureType featureType = lowerPanel.getType();
227
		if (client.isDescribeFeatureTypeNeeded()){
228
			try {
229
				FeatureTypeAttribute atribute = getAttribute(featureType);
230
				if (atribute == null){
231
					return;
232
				}else{
233
					featureAttribute = atribute.getName();
234
				}
235
			} catch (Exception e) {
236
				e.printStackTrace();
237
				return;
238
			}
239
		}	
240
		searchThread st =  new searchThread();
241
		searchThreads.add(st);   
242
		setCursor(new Cursor(Cursor.WAIT_CURSOR));       
243
	} 
244

  
245
	/**
246
	 * This method open a Jdialog panel and shows a list of
247
	 * attributes to choose one of them.
248
	 * @param featureType
249
	 * Feature 
250
	 * @return
251
	 * The selected attribute
252
	 * @throws Exception
253
	 */
254
	private FeatureTypeAttribute getAttribute(FeatureType featureType) throws Exception{
255
		if ((featureType == null) || 
256
				(lowerPanel.getType().getName().equals(Messages.getText("ThesaurusRoot")))){
257
			JOptionPane.showMessageDialog(
258
					this,
259
					Messages.getText("errorNotThesaurusSelected"),
260
					"WFS",
261
					JOptionPane.ERROR_MESSAGE
262
			);
263
			return null;
264
		}	
265
		FeatureTypeAttribute[] atributes = 
266
			client.describeFeatureType(featureType.getName());
267
		FeatureTypeAttribute attribute = (FeatureTypeAttribute)JOptionPane.showInputDialog(
268
				this,
269
				Messages.getText("chooseAttribute"),
270
				null,
271
				JOptionPane.PLAIN_MESSAGE,
272
				null,
273
				atributes,
274
				featureType.getName());
275
		if (attribute == null) {
276
			JOptionPane.showMessageDialog(
277
					this,
278
					Messages.getText("chooseAttribute"),
279
					"WFS",
280
					JOptionPane.ERROR_MESSAGE
281
			);
282
		}
283
		return attribute;		
284
	}
285

  
286
	/**
287
	 * thrown when the last button is clicked
288
	 */
289
	protected void lastButtonActionPerformed() {        
290
		((JFrame)serverConnectFrame).setVisible(true);
291
		parent.setVisible(false);
292
	} 	
293

  
294
	/**
295
	 * thrown when the cancel button is clicked
296
	 */
297
	protected void cancelSearchesButtonActionPerformed() {        
298
		for (int i=0 ; i<searchThreads.size() ; i++){
299
			searchThread st = (searchThread)searchThreads.toArray()[i];
300
			st.stop();            
301
		}     
302
		searchThreads.clear();
303
		setCursor(new Cursor(Cursor.DEFAULT_CURSOR));        
304
	} 
305

  
306
	/**
307
	 * thrown when the close button is clicked
308
	 */
309
	protected void closeButtonActionPerformed() {        
310
		parent.setVisible(false);
311
	} 
312

  
313
	/**
314
	 * @return the selected query
315
	 */
316
	protected GazetteerQuery doQuery() {        
317
		query = client.createNewQuery();
318
		query.setName(upperPanel.getName());
319
		query.setNameFilter(lowerPanel.getConcordancia());
320
		query.setFieldAttribute(featureAttribute);
321
		query.setFeatures(lowerPanel.getAllTypes());
322
		query.setRecsByPage(lowerPanel.getResultsByPage());
323
		query.setCoordinates(lowerPanel.getCoordinates());
324
		query.setCoordinatesFilter(lowerPanel.getCoordinatesOption());
325
		query.setCoordinatesClicked(upperPanel.isRestrictAreaClicked());
326
		query.getOptions().getAspect().setGoTo(lowerPanel.isGoToClicked());
327
		query.getOptions().getAspect().setKeepOld(lowerPanel.isKeepOldClicked());
328
		query.getOptions().getAspect().setPaintCurrent(lowerPanel.isMarkedPlaceClicked());
329
		query.getOptions().getSearch().setWithAccents(lowerPanel.isAccentsSearchEnabled());
330
		query.setProperties(lowerPanel.getProperties());
331
		return query;
332
	} 
333
	
334
	/**
335
	 * It returns the query that the user has selected
336
	 * @throws Exception 
337
	 * 
338
	 */
339
	private void doSearch() throws Exception {        
340
		features = client.getFeature(doQuery());
341
		if (features == null) {
342
			JOptionPane.showMessageDialog(this,
343
					Messages.getText("errorGetRecords"),
344
					"Error",
345
					JOptionPane.ERROR_MESSAGE);
346
		}
347
	} 
348

  
349
	/**
350
	 * Show the results 
351
	 */
352
	private void showResults() {        
353
		if (features.length == 0){
354
			JOptionPane.showMessageDialog(this,
355
					Messages.getText("anyResult"),
356
					Messages.getText("gazetteer_search"),
357
					JOptionPane.INFORMATION_MESSAGE);
358
		}else{
359
			showResultsActionPerformed(features);
360
		}
361
	} 
362

  
363
	/**
364
	 * @param features 
365
	 */
366
	protected void showResultsActionPerformed(Feature[] features) {        
367
		new ShowResultsDialog(client,
368
				features,
369
				lowerPanel.getResultsByPage(),
370
				doQuery());
371
	} 
372

  
373
	/**
374
	 * 
375
	 * @param parent The parent to set.
376
	 */
377
	public void setParent(JFrame parent) {        
378
		this.parent = parent;
379
	} 
380

  
381
	/**
382
	 * This class is used to manage the searches.
383
	 * It contains method to start and to stop a thread. It is
384
	 * necessary to create because "stop" method (for the Thread class)
385
	 * is deprecated.
386
	 * 
387
	 * 
388
	 * @author Jorge Piera Llodra (piera_jor@gva.es)
389
	 */
390
	private class searchThread implements Runnable {
391
		volatile Thread myThread = null;
392

  
393
		public  searchThread() {        
394
			myThread = new Thread(this);
395
			myThread.start();
396
		} 
397

  
398
		public void stop() {        
399
			myThread.stop();
400
		} 
401

  
402
		/*
403
		 * (non-Javadoc)
404
		 * @see java.lang.Runnable#run()
405
		 */
406
		public void run() {        
407
			try {
408
				doSearch();
409
			} catch (Exception e) {
410
				e.printStackTrace();
411
			}
412
			if ((features != null) && (features.length >= 0)) {
413
				showResults();
414
			}
415
			searchThreads.remove(this);
416
			if (searchThreads.size() == 0){
417
				setCursor(new Cursor(Cursor.DEFAULT_CURSOR));       
418
			}
419
		} 
420
	}
421

  
422
	public GazetteerQuery getQuery() {
423
		return query;
424
	}
425

  
426
	public String getCurrentServer() {
427
		return currentServer;
428
	}
429

  
430
	public void setCurrentServer(String currentServer) {
431
		this.currentServer = currentServer;
432
	}
433
}
0 434

  
tags/v2_0_0_Build_2035/applications/appGazetteer/src/org/gvsig/gazetteer/ui/search/SearchLowerPanel.java
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 org.gvsig.gazetteer.ui.search;
43
import java.awt.GridBagConstraints;
44
import java.util.Properties;
45

  
46
import javax.swing.BorderFactory;
47
import javax.swing.ButtonGroup;
48
import javax.swing.JPanel;
49
import javax.swing.tree.DefaultMutableTreeNode;
50

  
51
import org.gvsig.catalog.querys.Coordinates;
52
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
53
import org.gvsig.catalog.utils.CatalogConstants;
54
import org.gvsig.catalog.utils.Doubles;
55
import org.gvsig.gazetteer.querys.FeatureType;
56
import org.gvsig.gazetteer.utils.thesaurusjtree.ThesaurusJTree;
57
import org.gvsig.i18n.Messages;
58

  
59

  
60
/**
61
 * @author Jorge Piera Llodra (piera_jor@gva.es)
62
 */
63
public class SearchLowerPanel extends JPanel {
64
	private FeatureType[] features = null; 
65
	private SearchAditionalPropertiesPanel aditionalPanel = null;
66
	
67
	  private javax.swing.JRadioButton allRButton;
68
	    private javax.swing.JRadioButton anyRButton;
69
	    private javax.swing.JPanel aspectPanel;
70
	    private javax.swing.JLabel brxLabel;
71
	    private javax.swing.JTextField brxText;
72
	    private javax.swing.JLabel bryLabel;
73
	    private javax.swing.JTextField bryText;
74
	    private javax.swing.JPanel coordinatesPanel;
75
	    private javax.swing.JComboBox coordinatesRelationshipCombo;
76
	    private javax.swing.JPanel coordinatesRelationshipPanel;
77
	    private javax.swing.JCheckBox deleteCheck;
78
	    private javax.swing.JRadioButton exactRButton;
79
	    private javax.swing.JCheckBox insSearchCheck;
80
	    private javax.swing.JPanel intSearchPanel;
81
	    private javax.swing.JPanel leftPanel;
82
	    private javax.swing.JPanel lowerCoordinatesPanel;
83
	    private javax.swing.JComboBox nResultsCombo;
84
	    private javax.swing.JLabel nResultsLabel;
85
	    private javax.swing.JPanel nResultsPanel;
86
	    private javax.swing.JPanel nameOptionsPanel;
87
	    private javax.swing.JCheckBox paintCheck;
88
	    private javax.swing.JPanel rigthPanel;
89
	    private javax.swing.JPanel rigthUpperPanel;
90
	    private javax.swing.JScrollPane scroll;
91
	    private javax.swing.JLabel typeLabel;
92
	    private javax.swing.JPanel typePanel;
93
	    private ThesaurusJTree typeTree;
94
	    private javax.swing.JLabel ulxLabel;
95
	    private javax.swing.JTextField ulxText;
96
	    private javax.swing.JLabel ulyLabel;
97
	    private javax.swing.JTextField ulyText;
98
	    private javax.swing.JPanel upperCoordinatesPanel;
99
	    private javax.swing.JCheckBox zoomCheck;
100

  
101
	/** Creates new form searchLowerPanel */
102
	public SearchLowerPanel(FeatureType[] features, SearchAditionalPropertiesPanel aditionalPanel) {
103
		this.features = features;
104
		initComponents();
105
		initLabels();
106
		initDefaultValues();
107
		addOptionalPanel(aditionalPanel);
108
	}
109
	
110
	/**
111
	 * It adds the aditional panel
112
	 * @param aditionalPanel
113
	 */
114
	private void addOptionalPanel(SearchAditionalPropertiesPanel aditionalPanel){
115
		if (aditionalPanel != null){
116
			this.aditionalPanel = aditionalPanel;
117
			GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
118
			gridBagConstraints.gridx = 0;
119
			gridBagConstraints.gridy = 3;
120
			gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
121
			gridBagConstraints.weightx = 1.0;
122
			rigthUpperPanel.add(aditionalPanel, gridBagConstraints);
123
		}
124
	}
125

  
126
	/** This method is called from within the constructor to
127
	 * initialize the form.
128
	 * WARNING: Do NOT modify this code. The content of this method is
129
	 * always regenerated by the Form Editor.
130
	 */
131
	// <editor-fold defaultstate="collapsed" desc=" C?digo Generado  ">                          
132
	private void initComponents() { 	       
133
        java.awt.GridBagConstraints gridBagConstraints;
134

  
135
        leftPanel = new javax.swing.JPanel();
136
        nameOptionsPanel = new javax.swing.JPanel();
137
        exactRButton = new javax.swing.JRadioButton();
138
        anyRButton = new javax.swing.JRadioButton();
139
        allRButton = new javax.swing.JRadioButton();
140
        typePanel = new javax.swing.JPanel();
141
        typeLabel = new javax.swing.JLabel();
142
        scroll = new javax.swing.JScrollPane();
143
        typeTree = new ThesaurusJTree(features,Messages.getText("rootNode"));
144
        nResultsPanel = new javax.swing.JPanel();
145
        nResultsLabel = new javax.swing.JLabel();
146
        nResultsCombo = new javax.swing.JComboBox();
147
        rigthPanel = new javax.swing.JPanel();
148
        rigthUpperPanel = new javax.swing.JPanel();
149
        intSearchPanel = new javax.swing.JPanel();
150
        insSearchCheck = new javax.swing.JCheckBox();
151
        coordinatesPanel = new javax.swing.JPanel();
152
        upperCoordinatesPanel = new javax.swing.JPanel();
153
        ulxLabel = new javax.swing.JLabel();
154
        ulxText = new javax.swing.JTextField();
155
        ulyLabel = new javax.swing.JLabel();
156
        ulyText = new javax.swing.JTextField();
157
        lowerCoordinatesPanel = new javax.swing.JPanel();
158
        brxLabel = new javax.swing.JLabel();
159
        brxText = new javax.swing.JTextField();
160
        bryLabel = new javax.swing.JLabel();
161
        bryText = new javax.swing.JTextField();
162
        coordinatesRelationshipPanel = new javax.swing.JPanel();
163
        coordinatesRelationshipCombo = new javax.swing.JComboBox();
164
        aspectPanel = new javax.swing.JPanel();
165
        zoomCheck = new javax.swing.JCheckBox();
166
        deleteCheck = new javax.swing.JCheckBox();
167
        paintCheck = new javax.swing.JCheckBox();
168

  
169
        setLayout(new java.awt.GridLayout());
170

  
171
        setPreferredSize(new java.awt.Dimension(200, 518));
172
        leftPanel.setLayout(new java.awt.BorderLayout());
173

  
174
        leftPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 5, 2, 5));
175
        leftPanel.setPreferredSize(new java.awt.Dimension(100, 518));
176
        nameOptionsPanel.setLayout(new java.awt.GridBagLayout());
177

  
178
        nameOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("concordancia"));
179
        nameOptionsPanel.setPreferredSize(new java.awt.Dimension(100, 81));
180
        exactRButton.setText("jRadioButton1");
181
        exactRButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
182
        exactRButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
183
        gridBagConstraints = new java.awt.GridBagConstraints();
184
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
185
        gridBagConstraints.weightx = 1.0;
186
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
187
        nameOptionsPanel.add(exactRButton, gridBagConstraints);
188

  
189
        anyRButton.setText("jRadioButton1");
190
        anyRButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
191
        anyRButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
192
        gridBagConstraints = new java.awt.GridBagConstraints();
193
        gridBagConstraints.gridx = 0;
194
        gridBagConstraints.gridy = 1;
195
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
196
        gridBagConstraints.weightx = 1.0;
197
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
198
        nameOptionsPanel.add(anyRButton, gridBagConstraints);
199

  
200
        allRButton.setText("jRadioButton2");
201
        allRButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
202
        allRButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
203
        gridBagConstraints = new java.awt.GridBagConstraints();
204
        gridBagConstraints.gridx = 0;
205
        gridBagConstraints.gridy = 2;
206
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
207
        gridBagConstraints.weightx = 1.0;
208
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
209
        nameOptionsPanel.add(allRButton, gridBagConstraints);
210

  
211
        leftPanel.add(nameOptionsPanel, java.awt.BorderLayout.NORTH);
212

  
213
        typePanel.setLayout(new java.awt.GridBagLayout());
214

  
215
        typePanel.setPreferredSize(new java.awt.Dimension(100, 386));
216
        typeLabel.setText("jLabel1");
217
        gridBagConstraints = new java.awt.GridBagConstraints();
218
        gridBagConstraints.gridx = 0;
219
        gridBagConstraints.gridy = 0;
220
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
221
        gridBagConstraints.weightx = 1.0;
222
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
223
        typePanel.add(typeLabel, gridBagConstraints);
224

  
225
        scroll.setViewportView(typeTree);
226

  
227
        gridBagConstraints = new java.awt.GridBagConstraints();
228
        gridBagConstraints.gridx = 0;
229
        gridBagConstraints.gridy = 1;
230
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
231
        gridBagConstraints.weightx = 1.0;
232
        gridBagConstraints.weighty = 1.0;
233
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
234
        typePanel.add(scroll, gridBagConstraints);
235

  
236
        leftPanel.add(typePanel, java.awt.BorderLayout.CENTER);
237

  
238
        nResultsPanel.setLayout(new java.awt.GridBagLayout());
239

  
240
        nResultsPanel.setPreferredSize(new java.awt.Dimension(100, 47));
241
        nResultsLabel.setText("jLabel1");
242
        gridBagConstraints = new java.awt.GridBagConstraints();
243
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
244
        gridBagConstraints.weightx = 1.0;
245
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
246
        nResultsPanel.add(nResultsLabel, gridBagConstraints);
247

  
248
        nResultsCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Art\u00edculo 1", "Art\u00edculo 2", "Art\u00edculo 3", "Art\u00edculo 4" }));
249
        gridBagConstraints = new java.awt.GridBagConstraints();
250
        gridBagConstraints.gridx = 0;
251
        gridBagConstraints.gridy = 1;
252
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
253
        gridBagConstraints.weightx = 1.0;
254
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
255
        nResultsPanel.add(nResultsCombo, gridBagConstraints);
256

  
257
        leftPanel.add(nResultsPanel, java.awt.BorderLayout.SOUTH);
258

  
259
        add(leftPanel);
260

  
261
        rigthPanel.setLayout(new java.awt.BorderLayout());
262

  
263
        rigthPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 3));
264
        rigthPanel.setPreferredSize(new java.awt.Dimension(100, 274));
265
        rigthUpperPanel.setLayout(new java.awt.GridBagLayout());
266

  
267
        intSearchPanel.setLayout(new java.awt.GridBagLayout());
268

  
269
        intSearchPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("inteligent"));
270
        intSearchPanel.setPreferredSize(new java.awt.Dimension(100, 43));
271
        insSearchCheck.setText("jCheckBox1");
272
        insSearchCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
273
        insSearchCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));
274
        gridBagConstraints = new java.awt.GridBagConstraints();
275
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
276
        gridBagConstraints.weightx = 1.0;
277
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 2);
278
        intSearchPanel.add(insSearchCheck, gridBagConstraints);
279

  
280
        gridBagConstraints = new java.awt.GridBagConstraints();
281
        gridBagConstraints.gridx = 0;
282
        gridBagConstraints.gridy = 2;
283
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
284
        gridBagConstraints.weightx = 1.0;
285
        rigthUpperPanel.add(intSearchPanel, gridBagConstraints);
286

  
287
        coordinatesPanel.setLayout(new java.awt.GridBagLayout());
288

  
289
        coordinatesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("coordinates"));
290
        coordinatesPanel.setPreferredSize(new java.awt.Dimension(100, 138));
291
        upperCoordinatesPanel.setLayout(new java.awt.GridBagLayout());
292

  
293
        upperCoordinatesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("upper"));
294
        upperCoordinatesPanel.setPreferredSize(new java.awt.Dimension(100, 43));
295
        ulxLabel.setText("ULX:");
296
        gridBagConstraints = new java.awt.GridBagConstraints();
297
        gridBagConstraints.weightx = 0.15;
298
        upperCoordinatesPanel.add(ulxLabel, gridBagConstraints);
299

  
300
        ulxText.setText("jTextField1");
301
        gridBagConstraints = new java.awt.GridBagConstraints();
302
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
303
        gridBagConstraints.weightx = 0.35;
304
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
305
        upperCoordinatesPanel.add(ulxText, gridBagConstraints);
306

  
307
        ulyLabel.setText("ULY:");
308
        gridBagConstraints = new java.awt.GridBagConstraints();
309
        gridBagConstraints.weightx = 0.15;
310
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0);
311
        upperCoordinatesPanel.add(ulyLabel, gridBagConstraints);
312

  
313
        ulyText.setText("jTextField1");
314
        gridBagConstraints = new java.awt.GridBagConstraints();
315
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
316
        gridBagConstraints.weightx = 0.35;
317
        upperCoordinatesPanel.add(ulyText, gridBagConstraints);
318

  
319
        gridBagConstraints = new java.awt.GridBagConstraints();
320
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
321
        gridBagConstraints.weightx = 1.0;
322
        coordinatesPanel.add(upperCoordinatesPanel, gridBagConstraints);
323

  
324
        lowerCoordinatesPanel.setLayout(new java.awt.GridBagLayout());
325

  
326
        lowerCoordinatesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("lower"));
327
        lowerCoordinatesPanel.setPreferredSize(new java.awt.Dimension(100, 43));
328
        brxLabel.setText("ULX:");
329
        gridBagConstraints = new java.awt.GridBagConstraints();
330
        gridBagConstraints.weightx = 0.15;
331
        lowerCoordinatesPanel.add(brxLabel, gridBagConstraints);
332

  
333
        brxText.setText("jTextField1");
334
        gridBagConstraints = new java.awt.GridBagConstraints();
335
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
336
        gridBagConstraints.weightx = 0.35;
337
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
338
        lowerCoordinatesPanel.add(brxText, gridBagConstraints);
339

  
340
        bryLabel.setText("ULY:");
341
        gridBagConstraints = new java.awt.GridBagConstraints();
342
        gridBagConstraints.weightx = 0.15;
343
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0);
344
        lowerCoordinatesPanel.add(bryLabel, gridBagConstraints);
345

  
346
        bryText.setText("jTextField1");
347
        gridBagConstraints = new java.awt.GridBagConstraints();
348
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
349
        gridBagConstraints.weightx = 0.35;
350
        lowerCoordinatesPanel.add(bryText, gridBagConstraints);
351

  
352
        gridBagConstraints = new java.awt.GridBagConstraints();
353
        gridBagConstraints.gridx = 0;
354
        gridBagConstraints.gridy = 1;
355
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
356
        gridBagConstraints.weightx = 1.0;
357
        coordinatesPanel.add(lowerCoordinatesPanel, gridBagConstraints);
358

  
359
        coordinatesRelationshipPanel.setLayout(new java.awt.GridBagLayout());
360

  
361
        coordinatesRelationshipPanel.setPreferredSize(new java.awt.Dimension(100, 24));
362
        coordinatesRelationshipCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Art\u00edculo 1", "Art\u00edculo 2", "Art\u00edculo 3", "Art\u00edculo 4" }));
363
        gridBagConstraints = new java.awt.GridBagConstraints();
364
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
365
        gridBagConstraints.weightx = 1.0;
366
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
367
        coordinatesRelationshipPanel.add(coordinatesRelationshipCombo, gridBagConstraints);
368

  
369
        gridBagConstraints = new java.awt.GridBagConstraints();
370
        gridBagConstraints.gridx = 0;
371
        gridBagConstraints.gridy = 2;
372
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
373
        gridBagConstraints.weightx = 1.0;
374
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 2);
375
        coordinatesPanel.add(coordinatesRelationshipPanel, gridBagConstraints);
376

  
377
        gridBagConstraints = new java.awt.GridBagConstraints();
378
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
379
        gridBagConstraints.weightx = 1.0;
380
        rigthUpperPanel.add(coordinatesPanel, gridBagConstraints);
381

  
382
        aspectPanel.setLayout(new java.awt.GridBagLayout());
383

  
384
        aspectPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("aspect"));
385
        aspectPanel.setPreferredSize(new java.awt.Dimension(100, 81));
386
        zoomCheck.setText("jCheckBox1");
387
        zoomCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
388
        zoomCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));
389
        gridBagConstraints = new java.awt.GridBagConstraints();
390
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
391
        gridBagConstraints.weightx = 1.0;
392
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
393
        aspectPanel.add(zoomCheck, gridBagConstraints);
394

  
395
        deleteCheck.setText("jCheckBox1");
396
        deleteCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
397
        deleteCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));
398
        gridBagConstraints = new java.awt.GridBagConstraints();
399
        gridBagConstraints.gridx = 0;
400
        gridBagConstraints.gridy = 1;
401
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
402
        gridBagConstraints.weightx = 1.0;
403
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
404
        aspectPanel.add(deleteCheck, gridBagConstraints);
405

  
406
        paintCheck.setText("jCheckBox1");
407
        paintCheck.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
408
        paintCheck.setMargin(new java.awt.Insets(0, 0, 0, 0));
409
        gridBagConstraints = new java.awt.GridBagConstraints();
410
        gridBagConstraints.gridx = 0;
411
        gridBagConstraints.gridy = 2;
412
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
413
        gridBagConstraints.weightx = 1.0;
414
        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
415
        aspectPanel.add(paintCheck, gridBagConstraints);
416

  
417
        gridBagConstraints = new java.awt.GridBagConstraints();
418
        gridBagConstraints.gridx = 0;
419
        gridBagConstraints.gridy = 1;
420
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
421
        gridBagConstraints.weightx = 1.0;
422
        rigthUpperPanel.add(aspectPanel, gridBagConstraints);
423

  
424
        rigthPanel.add(rigthUpperPanel, java.awt.BorderLayout.NORTH);
425

  
426
        add(rigthPanel);
427
	}// </editor-fold>                        
428

  
429
	/**
430
	 * Rewrite the labels
431
	 */
432
	private void initLabels(){
433
		nameOptionsPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("concordancia")));
434
		exactRButton.setText(Messages.getText("exactSentence"));
435
		anyRButton.setText(Messages.getText("anyWord"));
436
		allRButton.setText(Messages.getText("allWords"));
437
		typeLabel.setText(Messages.getText("resourceTypeColumn"));
438
		nResultsLabel.setText(Messages.getText("resutsByPage"));
439
		coordinatesPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("coordinates")));
440
		upperCoordinatesPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("upperCoordinates")));
441
		lowerCoordinatesPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("lowerCoordinates")));
442
		ulxLabel.setText(Messages.getText("ULX") + ":");
443
		ulyLabel.setText(Messages.getText("ULY") + ":");
444
		brxLabel.setText(Messages.getText("BRX") + ":");
445
		bryLabel.setText(Messages.getText("BRY") + ":");
446
		aspectPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("aspect")));
447
		zoomCheck.setText(Messages.getText("goto"));
448
		deleteCheck.setText(Messages.getText("mantainold"));
449
		paintCheck.setText(Messages.getText("paint"));
450
		intSearchPanel.setBorder(BorderFactory.createTitledBorder(Messages.getText("inteligentSearch")));
451
		insSearchCheck.setText(Messages.getText("inteligentSearchAscii"));
452
	}
453
	
454
	/**
455
	 * Initializae some components with their default values
456
	 */
457
	private void initDefaultValues(){
458
		//remove the combos
459
		nResultsCombo.removeAllItems();
460
		coordinatesRelationshipCombo.removeAllItems();
461
		//remove the text fields
462
		ulxText.setText("");
463
		ulyText.setText("");
464
		brxText.setText("");
465
		bryText.setText("");
466
		//Select the check boxes
467
		deleteCheck.setSelected(true);		
468
		insSearchCheck.setSelected(true);
469
		zoomCheck.setSelected(true);
470
		paintCheck.setSelected(true);
471
		//Select the radio button
472
		ButtonGroup group = new ButtonGroup();
473
		group.add(exactRButton);
474
		group.add(anyRButton);
475
		group.add(allRButton);
476
		exactRButton.setSelected(true);
477
	}
478

  
479
	/**
480
	 * @return the selected thesaurus 
481
	 */
482
	public FeatureType getType() {        
483
		DefaultMutableTreeNode dmt = (DefaultMutableTreeNode)typeTree.getLastSelectedPathComponent();
484
		if (dmt == null)
485
			return null;
486
		return (FeatureType) dmt.getUserObject();
487
	}
488
	
489
	/**
490
	 * @return all the feature types
491
	 */
492
	 public FeatureType[] getAllTypes() {        
493
	        DefaultMutableTreeNode root = (DefaultMutableTreeNode)typeTree.getModel().getRoot();
494
	        FeatureType[] featureType = new FeatureType[root.getChildCount()];        
495
	        for (int i=0 ; i<root.getChildCount() ; i++){
496
	            DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChildAt(i);
497
	            featureType[i] = (FeatureType) child.getUserObject();
498
	        }	        
499
	        return featureType;
500
	    } 
501
	
502
	/**
503
	 * @return the concordancia
504
	 */
505
	public String getConcordancia() {        
506
		if (exactRButton.isSelected()) {
507
			return CatalogConstants.EXACT_WORDS;
508
		}else if (anyRButton.isSelected()) {
509
			return CatalogConstants.ANY_WORD;
510
		}else if (allRButton.isSelected()) {
511
			return CatalogConstants.ALL_WORDS;
512
		}
513
		return CatalogConstants.ANY_WORD;
514
	}
515

  
516
	/**
517
	 * @return the number of results by page
518
	 */
519
	public int getResultsByPage() {        
520
		return ((Integer)nResultsCombo.getSelectedItem()).intValue();		
521
	} 
522

  
523
	/**
524
	 * @return the coordinates
525
	 */
526
	public Coordinates getCoordinates() {        
527
		return new Coordinates(ulxText.getText(), ulyText.getText(),
528
				brxText.getText(), bryText.getText());
529
	} 
530
	
531
	/**
532
	 * Set the coordinates
533
	 * @param coordinates
534
	 * The coordinates to set
535
	 */
536
    public void setCoordinates(Coordinates coordinates) {        
537
        ulxText.setText(Doubles.get5Decimals(coordinates.ulx));
538
        ulyText.setText(Doubles.get5Decimals(coordinates.uly));
539
        brxText.setText(Doubles.get5Decimals(coordinates.brx));
540
        bryText.setText(Doubles.get5Decimals(coordinates.bry));
541
    } 
542

  
543
	/**
544
	 * @return the coordinates relationship
545
	 */
546
	public String getCoordinatesOption() {        
547
		return (String) coordinatesRelationshipCombo.getSelectedItem();
548
	} 
549

  
550
	/**
551
	 * @return if the GOTO component is clicked
552
	 */
553
	public boolean isGoToClicked() {        
554
		return zoomCheck.isSelected();
555
	} 
556

  
557
	/**
558
	 * @return if the Mantain Old button is enabled
559
	 */
560
	public boolean isKeepOldClicked() {        
561
		return deleteCheck.isSelected();
562
	}
563

  
564
	/**
565
	 * @return if the Mantain Old button is enabled
566
	 */
567
	public boolean isMarkedPlaceClicked() {        
568
		return paintCheck.isSelected();
569
	}
570

  
571

  
572
	/**
573
	 * @return if the With accents button is enabled
574
	 */
575
	public boolean isAccentsSearchEnabled() {        
576
		return insSearchCheck.isSelected();
577
	}
578

  
579
	/**
580
	 * Add a new number of resultas by page to the
581
	 * combo
582
	 * @param number
583
	 * Results by page
584
	 */
585
	public void addResultsByPageNumber(int number){
586
		nResultsCombo.addItem(new Integer(number));
587
	}
588

  
589
	/**
590
	 * Add a new coordinates option for the coordinates
591
	 * combo
592
	 * @param option
593
	 * Coordinates option
594
	 */
595
	public void addCoordinatesRelationship(String option){
596
		coordinatesRelationshipCombo.addItem(option);
597
	}
598

  
599
	/**
600
	 * Returns the properties for teh aditional panel
601
	 * @return
602
	 */
603
	public Properties getProperties() {
604
		if (aditionalPanel != null){
605
			return aditionalPanel.getProperties();
606
		}
607
		return null;
608
	}
609
}
610

  
0 611

  
tags/v2_0_0_Build_2035/applications/appGazetteer/src/org/gvsig/gazetteer/ui/search/SearchUpperPanel.java
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 org.gvsig.gazetteer.ui.search;
43
import java.awt.Dimension;
44
import java.awt.event.ActionListener;
45

  
46
import javax.swing.Icon;
47
import javax.swing.JPanel;
48

  
49
import org.gvsig.catalog.utils.CatalogConstants;
50
import org.gvsig.i18n.Messages;
51

  
52
/**
53
 * @author Jorge Piera Llodra (piera_jor@gva.es)
54
 */
55
public class SearchUpperPanel extends JPanel {
56
	private javax.swing.JCheckBox areaCheckBox;
57
    private javax.swing.JPanel areaPanel;
58
    private javax.swing.JPanel leftPanel;
59
    private javax.swing.JLabel nameLabel;
60
    private javax.swing.JPanel namePanel;
61
    private javax.swing.JTextField nameText;
62
    private javax.swing.JButton resizeButton;
63
    private javax.swing.JPanel resizePanel;
64
	/** Creates new form upperPanel */
65
	public SearchUpperPanel() {
66
		initComponents();
67
		initLabels();
68
	}
69

  
70
	/** This method is called from within the constructor to
71
	 * initialize the form.
72
	 * WARNING: Do NOT modify this code. The content of this method is
73
	 * always regenerated by the Form Editor.
74
	 */
75
	// <editor-fold defaultstate="collapsed" desc=" C?digo Generado  ">                          
76
	private void initComponents() {
77
		   java.awt.GridBagConstraints gridBagConstraints;
78

  
79
	        namePanel = new javax.swing.JPanel();
80
	        nameLabel = new javax.swing.JLabel();
81
	        nameText = new javax.swing.JTextField();
82
	        leftPanel = new javax.swing.JPanel();
83
	        areaPanel = new javax.swing.JPanel();
84
	        areaCheckBox = new javax.swing.JCheckBox();
85
	        resizePanel = new javax.swing.JPanel();
86
	        resizeButton = new javax.swing.JButton();
87

  
88
	        setLayout(new java.awt.GridLayout(1, 0));
89

  
90
	        setPreferredSize(new java.awt.Dimension(200, 42));
91
	        namePanel.setLayout(new java.awt.GridBagLayout());
92

  
93
	        namePanel.setPreferredSize(new java.awt.Dimension(100, 42));
94
	        nameLabel.setText("jLabel1");
95
	        gridBagConstraints = new java.awt.GridBagConstraints();
96
	        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
97
	        gridBagConstraints.weightx = 1.0;
98
	        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
99
	        namePanel.add(nameLabel, gridBagConstraints);
100

  
101
	        nameText.setText("jTextField1");
102
	        gridBagConstraints = new java.awt.GridBagConstraints();
103
	        gridBagConstraints.gridx = 0;
104
	        gridBagConstraints.gridy = 1;
105
	        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
106
	        gridBagConstraints.weightx = 1.0;
107
	        gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 4);
108
	        namePanel.add(nameText, gridBagConstraints);
109

  
110
	        add(namePanel);
111

  
112
	        leftPanel.setLayout(new java.awt.GridBagLayout());
113

  
114
	        leftPanel.setPreferredSize(new java.awt.Dimension(100, 40));
115
	        areaPanel.setLayout(new java.awt.GridBagLayout());
116

  
117
	        areaPanel.setPreferredSize(new java.awt.Dimension(200, 40));
118
	        areaCheckBox.setText("jCheckBox1");
119
	        areaCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
120
	        areaCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
121
	        areaCheckBox.setPreferredSize(new java.awt.Dimension(90, 30));
122
	        gridBagConstraints = new java.awt.GridBagConstraints();
123
	        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
124
	        gridBagConstraints.weightx = 1.0;
125
	        gridBagConstraints.insets = new java.awt.Insets(20, 2, 2, 2);
126
	        areaPanel.add(areaCheckBox, gridBagConstraints);
127

  
128
	        gridBagConstraints = new java.awt.GridBagConstraints();
129
	        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
130
	        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
131
	        gridBagConstraints.weightx = 0.3;
132
	        leftPanel.add(areaPanel, gridBagConstraints);
133

  
134
	        resizePanel.setLayout(new java.awt.GridBagLayout());
135

  
136
	        resizePanel.setPreferredSize(new java.awt.Dimension(40, 40));
137
	        resizeButton.setMaximumSize(null);
138
	        resizeButton.setMinimumSize(null);
139
	        resizeButton.setOpaque(false);
140
	        resizeButton.setPreferredSize(new java.awt.Dimension(25, 25));
141
	
142
	        gridBagConstraints = new java.awt.GridBagConstraints();
143
	        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
144
	        gridBagConstraints.insets = new java.awt.Insets(19, 2, 2, 2);
145
	        resizePanel.add(resizeButton, gridBagConstraints);
146

  
147
	        gridBagConstraints = new java.awt.GridBagConstraints();
148
	        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
149
	        gridBagConstraints.weightx = 0.7;
150
	        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
151
	        leftPanel.add(resizePanel, gridBagConstraints);
152

  
153
	        add(leftPanel);
154
	}// </editor-fold> 
155

  
156
	/**
157
	 * Rewrite the labels
158
	 */
159
	private void initLabels(){
160
		nameText.setText("");
161
		nameLabel.setText(Messages.getText("name"));
162
		areaCheckBox.setText(Messages.getText("restrictArea"));
163
		resizeButton.setSize(new Dimension(CatalogConstants.RESIZE_WINDOW_BUTTON_SIZE, 
164
				CatalogConstants.RESIZE_WINDOW_BUTTON_SIZE));
165
	}
166

  
167
	/**
168
	 * Add a listener for the buttons
169
	 * @param listener
170
	 * Listener to add
171
	 */
172
	public void addActionListener(ActionListener listener){
173
		resizeButton.addActionListener(listener);
174
		resizeButton.setActionCommand("resize");
175
	}
176

  
177
	/**
178
	 * Sets the down triangle icon (to maximize)
179
	 */
180
	public void setIcon(Icon icon) {        
181
		resizeButton.setIcon(icon);	
182
	} 
183
	
184
	/**
185
	 * @return if the are check is clicked
186
	 */
187
    public boolean isRestrictAreaClicked() {        
188
        return areaCheckBox.isSelected();
189
    } 
190
    
191
    /**
192
     * @return the geoname 
193
     */
194
    public String getName(){
195
    	return nameText.getText();
196
    }
197
}
0 198

  
tags/v2_0_0_Build_2035/applications/appGazetteer/src/org/gvsig/gazetteer/ui/serverconnect/ServerConnectDialog.java
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
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff