svn-gvsig-desktop / tags / Root_piloto3d / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / gazetteer / gui / SearchDialog.java @ 9537
History | View | Annotate | Download (5.62 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.Dimension; |
44 |
import java.awt.Frame; |
45 |
import java.awt.geom.Rectangle2D; |
46 |
|
47 |
import javax.swing.JDialog; |
48 |
|
49 |
import org.gvsig.i18n.Messages; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.ui.mdiManager.IWindow; |
53 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
54 |
import com.iver.cit.gvsig.fmap.ColorEvent; |
55 |
import com.iver.cit.gvsig.fmap.ExtentEvent; |
56 |
import com.iver.cit.gvsig.fmap.ProjectionEvent; |
57 |
import com.iver.cit.gvsig.fmap.ViewPortListener; |
58 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
59 |
|
60 |
|
61 |
import es.gva.cit.catalogClient.querys.Coordinates; |
62 |
import es.gva.cit.catalogClient.utils.Frames; |
63 |
import es.gva.cit.gazetteer.GazetteerClient; |
64 |
import es.gva.cit.gazetteer.querys.Feature; |
65 |
import es.gva.cit.gazetteer.ui.search.SearchDialogPanel; |
66 |
|
67 |
|
68 |
/**
|
69 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
70 |
*/
|
71 |
public class SearchDialog extends SearchDialogPanel |
72 |
implements IWindow,ViewPortListener{
|
73 |
private JDialog frame = null; |
74 |
|
75 |
public SearchDialog(GazetteerClient client,JDialog frame, Object serverConnectFrame){ |
76 |
super(client,serverConnectFrame);
|
77 |
this.frame = frame;
|
78 |
setViewChangeListener(); |
79 |
loadViewPortCoordinates(); |
80 |
} |
81 |
|
82 |
/* (non-Javadoc)
|
83 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
84 |
*/
|
85 |
public WindowInfo getWindowInfo() {
|
86 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
87 |
m_viewinfo.setTitle(Messages.getText( "gazetteer_search"));
|
88 |
return m_viewinfo;
|
89 |
} |
90 |
|
91 |
public void ShowResultsActionPerformed(Feature[] features) { |
92 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
93 |
Frames.centerFrame(panel,420,258); |
94 |
panel.setTitle(Messages.getText( "gazetteer_search"));
|
95 |
panel.setResizable(false);
|
96 |
|
97 |
ShowResultsDialog dialog = new ShowResultsDialog(panel,
|
98 |
client, |
99 |
features, |
100 |
lowerPanel.getNPaginas(), |
101 |
getQuery()); |
102 |
|
103 |
panel.getContentPane().add(dialog); |
104 |
panel.show(); |
105 |
|
106 |
//PluginServices.getMDIManager().addView(panel);
|
107 |
} |
108 |
|
109 |
public void closeButtonActionPerformed() { |
110 |
frame.setVisible(false);
|
111 |
} |
112 |
|
113 |
/**
|
114 |
* Size button action performed
|
115 |
*/
|
116 |
public void sizeButtonActionPerformed(){ |
117 |
if (isMinimized){
|
118 |
frame.setSize(525,520); |
119 |
ppalPanel.setPreferredSize(new Dimension(514,490)); |
120 |
getLowerPanel().setPreferredSize(new Dimension(514,440)); |
121 |
getLowerPanel().setVisible(true);
|
122 |
frame.setVisible(true);
|
123 |
getUpperPanel().setUpIcon(); |
124 |
}else{
|
125 |
frame.setSize(525,117); |
126 |
ppalPanel.setPreferredSize(new Dimension(514,91)); |
127 |
getLowerPanel().setPreferredSize(new Dimension(514,0)); |
128 |
getLowerPanel().setVisible(false);
|
129 |
frame.setVisible(true);
|
130 |
getUpperPanel().setDownIcon(); |
131 |
} |
132 |
isMinimized = !isMinimized; |
133 |
} |
134 |
/**
|
135 |
* Return button action
|
136 |
*/
|
137 |
public void returnButtonActionPerformed() { |
138 |
closeJDialog(); |
139 |
ConnectDialog serverConnect = (ConnectDialog)serverConnectFrame; |
140 |
serverConnect.setVisible(true);
|
141 |
serverConnect.getSearchButton().setEnabled(false);
|
142 |
PluginServices.getMDIManager().addWindow(serverConnect); |
143 |
} |
144 |
|
145 |
public void closeJDialog() { |
146 |
frame.setVisible(false);
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* This method loads the view coordinates to the catalog search dialog
|
151 |
*
|
152 |
*/
|
153 |
private void loadViewPortCoordinates(){ |
154 |
View activeView =
|
155 |
(View) PluginServices.getMDIManager().getActiveWindow();
|
156 |
|
157 |
Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent();
|
158 |
|
159 |
try{
|
160 |
getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
|
161 |
r2d.getMaxY(), |
162 |
r2d.getMaxX(), |
163 |
r2d.getMinY())); |
164 |
}catch(NullPointerException E){ |
165 |
//We cant retrieve the coordinates if it doesn't
|
166 |
//exist a loaded layer
|
167 |
} |
168 |
} |
169 |
/*
|
170 |
* This methos joins the viewPort event to the listener
|
171 |
*/
|
172 |
private void setViewChangeListener(){ |
173 |
View activeView =
|
174 |
(View) PluginServices.getMDIManager().getActiveWindow();
|
175 |
|
176 |
activeView.getMapControl().getViewPort().addViewPortListener(this);
|
177 |
|
178 |
} |
179 |
|
180 |
public void extentChanged(ExtentEvent e) { |
181 |
loadViewPortCoordinates(); |
182 |
|
183 |
} |
184 |
|
185 |
public void backColorChanged(ColorEvent e) { |
186 |
// TODO Auto-generated method stub
|
187 |
|
188 |
} |
189 |
|
190 |
public void projectionChanged(ProjectionEvent e) { |
191 |
loadViewPortCoordinates(); |
192 |
} |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
} |