root / trunk / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / gui / SearchDialog.java @ 3229
History | View | Annotate | Download (5.35 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.gazetteer.gui; |
42 |
|
43 |
import java.awt.event.MouseEvent; |
44 |
import java.awt.event.MouseListener; |
45 |
import java.awt.geom.Rectangle2D; |
46 |
|
47 |
import javax.swing.JDialog; |
48 |
|
49 |
import com.iver.andami.PluginServices; |
50 |
import com.iver.andami.ui.mdiManager.View; |
51 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
52 |
|
53 |
import es.gva.cit.catalogClient.querys.Coordinates; |
54 |
import es.gva.cit.gazetteer.GazetteerClient; |
55 |
import es.gva.cit.gazetteer.querys.Feature; |
56 |
import es.gva.cit.gazetteer.ui.search.SearchDialogPanel; |
57 |
import es.gva.cit.gvsig.catalogClient.translation.AndamiTranslation; |
58 |
|
59 |
|
60 |
/**
|
61 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
62 |
*/
|
63 |
public class SearchDialog extends SearchDialogPanel |
64 |
implements View,MouseListener { |
65 |
private JDialog frame = null; |
66 |
|
67 |
public SearchDialog(GazetteerClient client,JDialog frame){ |
68 |
super(client,new AndamiTranslation()); |
69 |
this.frame = frame;
|
70 |
setMouseListener(); |
71 |
} |
72 |
|
73 |
/* (non-Javadoc)
|
74 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
75 |
*/
|
76 |
public ViewInfo getViewInfo() {
|
77 |
ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
|
78 |
m_viewinfo.setTitle(PluginServices.getText(this, "gazetteer_search")); |
79 |
return m_viewinfo;
|
80 |
} |
81 |
|
82 |
public void ShowResultsActionPerformed(Feature[] features) { |
83 |
ShowResultsDialog dialog = new ShowResultsDialog(client,features,lowerPanel.getNPaginas());
|
84 |
dialog.setBounds(0, 0, 420, 227); |
85 |
dialog.setName(PluginServices.getText(this, "gazetteer_search")); |
86 |
dialog.setVisible(true);
|
87 |
dialog.setSearchDialog(this);
|
88 |
PluginServices.getMDIManager().addView(dialog); |
89 |
|
90 |
} |
91 |
|
92 |
public void closeButtonActionPerformed() { |
93 |
frame.setVisible(false);
|
94 |
} |
95 |
|
96 |
/**
|
97 |
* Size button action performed
|
98 |
*/
|
99 |
public void sizeButtonActionPerformed(){ |
100 |
if (isMinimized){
|
101 |
frame.setSize(525,455); |
102 |
getLowerPanel().setVisible(true);
|
103 |
getLowerPanel().repaint(); |
104 |
getUpperPanel().setUpIcon(); |
105 |
frame.setVisible(true);
|
106 |
}else{
|
107 |
frame.setSize(525,120); |
108 |
getLowerPanel().setVisible(false);
|
109 |
getUpperPanel().setDownIcon(); |
110 |
} |
111 |
isMinimized = !isMinimized; |
112 |
} |
113 |
|
114 |
public void closeJDialog() { |
115 |
setVisible(true);
|
116 |
PluginServices.getMDIManager().closeView(SearchDialog.this); |
117 |
} |
118 |
|
119 |
/* (non-Javadoc)
|
120 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
|
121 |
*/
|
122 |
public void mouseClicked(MouseEvent e) { |
123 |
// TODO Auto-generated method stub
|
124 |
|
125 |
} |
126 |
|
127 |
/* (non-Javadoc)
|
128 |
* @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
|
129 |
*/
|
130 |
public void mouseEntered(MouseEvent e) { |
131 |
// TODO Auto-generated method stub
|
132 |
|
133 |
} |
134 |
|
135 |
/* (non-Javadoc)
|
136 |
* @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
|
137 |
*/
|
138 |
public void mouseExited(MouseEvent e) { |
139 |
// TODO Auto-generated method stub
|
140 |
|
141 |
} |
142 |
|
143 |
/* (non-Javadoc)
|
144 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
|
145 |
*/
|
146 |
public void mousePressed(MouseEvent e) { |
147 |
// TODO Auto-generated method stub
|
148 |
|
149 |
} |
150 |
|
151 |
/* (non-Javadoc)
|
152 |
* @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
|
153 |
*/
|
154 |
public void mouseReleased(MouseEvent e) { |
155 |
com.iver.cit.gvsig.gui.View activeView = |
156 |
(com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
157 |
|
158 |
Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent();
|
159 |
|
160 |
try{
|
161 |
getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
|
162 |
r2d.getMaxY(), |
163 |
r2d.getMaxX(), |
164 |
r2d.getMinY())); |
165 |
}catch(NullPointerException E){ |
166 |
//We cant retrieve the coordinates if it doesn't
|
167 |
//exist a loaded layer
|
168 |
} |
169 |
|
170 |
} |
171 |
/**
|
172 |
* This methos joins the mouse event to the listener
|
173 |
*/
|
174 |
public void setMouseListener(){ |
175 |
com.iver.cit.gvsig.gui.View activeView = |
176 |
(com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
177 |
|
178 |
activeView.getMapControl().addMouseListener(this);
|
179 |
mouseReleased(null);
|
180 |
} |
181 |
|
182 |
|
183 |
|
184 |
|
185 |
} |