root / branches / v05 / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / SearchDialog.java @ 3790
History | View | Annotate | Download (5.71 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.gvsig.catalogClient.gui; |
42 |
|
43 |
import java.awt.Frame; |
44 |
import java.awt.event.MouseEvent; |
45 |
import java.awt.event.MouseListener; |
46 |
import java.awt.geom.Rectangle2D; |
47 |
import java.util.Collection; |
48 |
|
49 |
import javax.swing.JDialog; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.ui.mdiManager.View; |
53 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
54 |
|
55 |
import es.gva.cit.catalogClient.CatalogClient; |
56 |
import es.gva.cit.catalogClient.querys.Coordinates; |
57 |
import es.gva.cit.catalogClient.ui.search.SearchDialogPanel; |
58 |
import es.gva.cit.catalogClient.ui.showResults.ShowResultsPanel; |
59 |
import es.gva.cit.catalogClient.utils.Frames; |
60 |
import es.gva.cit.gvsig.catalogClient.translation.AndamiTranslation; |
61 |
|
62 |
/**
|
63 |
* This class is used to search a record using the catalog client
|
64 |
* @author luisw
|
65 |
* @modified by Jorge Piera
|
66 |
*/
|
67 |
public class SearchDialog extends SearchDialogPanel implements |
68 |
View,MouseListener { |
69 |
private JDialog frame = null; |
70 |
public ViewInfo m_viewinfo = null; |
71 |
|
72 |
public SearchDialog(JDialog frame,CatalogClient client) { |
73 |
super(null,new AndamiTranslation(),client); |
74 |
this.frame = frame;
|
75 |
setMouseListener(); |
76 |
} |
77 |
|
78 |
/**
|
79 |
* This method opens the show results frame.
|
80 |
* @param nodes
|
81 |
* XML node returned by the query
|
82 |
*/
|
83 |
protected void showResults(Collection nodes) { |
84 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
85 |
Frames.centerFrame(panel,625,420); |
86 |
panel.setTitle(PluginServices.getText(this, "search_results")); |
87 |
panel.setResizable(false);
|
88 |
|
89 |
ShowResultsPanel.mustShowThumbnails = true;
|
90 |
ShowResultsDialog dialog = |
91 |
new ShowResultsDialog(panel,client,nodes,1); |
92 |
|
93 |
panel.getContentPane().add(dialog); |
94 |
panel.show(); |
95 |
} |
96 |
|
97 |
/**
|
98 |
* It Closes the dialog
|
99 |
*/
|
100 |
public void closeJDialog() { |
101 |
frame.setVisible(false);
|
102 |
|
103 |
} |
104 |
|
105 |
/* (non-Javadoc)
|
106 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
107 |
*/
|
108 |
public ViewInfo getViewInfo() {
|
109 |
if (m_viewinfo == null){ |
110 |
m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
|
111 |
m_viewinfo.setTitle(getName()); |
112 |
} |
113 |
return m_viewinfo;
|
114 |
} |
115 |
|
116 |
|
117 |
/**
|
118 |
* Close button Action performed
|
119 |
*/
|
120 |
public void closeButtonActionPerformed() { |
121 |
closeJDialog(); |
122 |
} |
123 |
|
124 |
/**
|
125 |
* Size button action performed
|
126 |
*/
|
127 |
public void sizeButtonActionPerformed(){ |
128 |
if (isMinimized){
|
129 |
frame.setSize(525,455); |
130 |
getLowerPanel().setVisible(true);
|
131 |
getLowerPanel().repaint(); |
132 |
getUpperPanel().setUpIcon(); |
133 |
frame.setVisible(true);
|
134 |
}else{
|
135 |
frame.setSize(525,120); |
136 |
getLowerPanel().setVisible(false);
|
137 |
getUpperPanel().setDownIcon(); |
138 |
} |
139 |
isMinimized = !isMinimized; |
140 |
} |
141 |
|
142 |
/* (non-Javadoc)
|
143 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
|
144 |
*/
|
145 |
public void mouseClicked(MouseEvent e) { |
146 |
// TODO Auto-generated method stub
|
147 |
|
148 |
} |
149 |
|
150 |
/* (non-Javadoc)
|
151 |
* @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
|
152 |
*/
|
153 |
public void mouseEntered(MouseEvent e) { |
154 |
// TODO Auto-generated method stub
|
155 |
|
156 |
} |
157 |
|
158 |
/* (non-Javadoc)
|
159 |
* @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
|
160 |
*/
|
161 |
public void mouseExited(MouseEvent e) { |
162 |
// TODO Auto-generated method stub
|
163 |
|
164 |
} |
165 |
|
166 |
/* (non-Javadoc)
|
167 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
|
168 |
*/
|
169 |
public void mousePressed(MouseEvent e) { |
170 |
|
171 |
|
172 |
} |
173 |
|
174 |
/* (non-Javadoc)
|
175 |
* @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
|
176 |
*/
|
177 |
public void mouseReleased(MouseEvent e) { |
178 |
com.iver.cit.gvsig.gui.View activeView = |
179 |
(com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
180 |
|
181 |
Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent();
|
182 |
|
183 |
try{
|
184 |
getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
|
185 |
r2d.getMaxY(), |
186 |
r2d.getMaxX(), |
187 |
r2d.getMinY())); |
188 |
}catch(NullPointerException E){ |
189 |
//We cant retrieve the coordinates if it doesn't
|
190 |
//exist a loaded layer
|
191 |
} |
192 |
} |
193 |
|
194 |
/**
|
195 |
* This methos joins the mouse event to the listener
|
196 |
*/
|
197 |
public void setMouseListener(){ |
198 |
com.iver.cit.gvsig.gui.View activeView = |
199 |
(com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
200 |
|
201 |
activeView.getMapControl().addMouseListener(this);
|
202 |
mouseReleased(null);
|
203 |
} |
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
} |