root / tags / v1_0_RELEASE / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / SearchDialog.java @ 9167
History | View | Annotate | Download (5.87 KB)
1 | 2819 | jorpiell | /* 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 | 2026 | luisw | package es.gva.cit.gvsig.catalogClient.gui; |
42 | |||
43 | 4354 | jorpiell | import java.awt.Dimension; |
44 | 3613 | jorpiell | import java.awt.Frame; |
45 | 3161 | jorpiell | import java.awt.geom.Rectangle2D; |
46 | 3567 | jorpiell | import java.util.Collection; |
47 | 3161 | jorpiell | |
48 | 3177 | jorpiell | import javax.swing.JDialog; |
49 | |||
50 | 4713 | cesar | import org.gvsig.i18n.Messages; |
51 | |||
52 | 2026 | luisw | import com.iver.andami.PluginServices; |
53 | 6877 | cesar | import com.iver.andami.ui.mdiManager.IWindow; |
54 | 6880 | cesar | import com.iver.andami.ui.mdiManager.WindowInfo; |
55 | 4238 | jorpiell | import com.iver.cit.gvsig.fmap.ColorEvent; |
56 | import com.iver.cit.gvsig.fmap.ExtentEvent; |
||
57 | 5939 | jmvivo | import com.iver.cit.gvsig.fmap.ProjectionEvent; |
58 | 4238 | jorpiell | import com.iver.cit.gvsig.fmap.ViewPortListener; |
59 | 8765 | jjdelcerro | import com.iver.cit.gvsig.project.documents.view.gui.View; |
60 | 2026 | luisw | |
61 | 3456 | jorpiell | import es.gva.cit.catalogClient.CatalogClient; |
62 | 3161 | jorpiell | import es.gva.cit.catalogClient.querys.Coordinates; |
63 | 3224 | jorpiell | import es.gva.cit.catalogClient.ui.search.SearchDialogPanel; |
64 | import es.gva.cit.catalogClient.ui.showResults.ShowResultsPanel; |
||
65 | 3613 | jorpiell | import es.gva.cit.catalogClient.utils.Frames; |
66 | 2026 | luisw | |
67 | /**
|
||
68 | 3180 | jorpiell | * This class is used to search a record using the catalog client
|
69 | 2026 | luisw | * @author luisw
|
70 | 3180 | jorpiell | * @modified by Jorge Piera
|
71 | 2026 | luisw | */
|
72 | 2149 | jorpiell | public class SearchDialog extends SearchDialogPanel implements |
73 | 6877 | cesar | IWindow,ViewPortListener { |
74 | 3177 | jorpiell | private JDialog frame = null; |
75 | 6880 | cesar | public WindowInfo m_viewinfo = null; |
76 | 3161 | jorpiell | |
77 | 4336 | jorpiell | public SearchDialog(JDialog frame,Object serverConnectFrame,CatalogClient client) { |
78 | 4713 | cesar | super(null,serverConnectFrame,client); |
79 | 3177 | jorpiell | this.frame = frame;
|
80 | 4238 | jorpiell | setViewChangeListener(); |
81 | loadViewPortCoordinates(); |
||
82 | 2026 | luisw | } |
83 | |||
84 | 3180 | jorpiell | /**
|
85 | * This method opens the show results frame.
|
||
86 | 3567 | jorpiell | * @param nodes
|
87 | 3180 | jorpiell | * XML node returned by the query
|
88 | */
|
||
89 | 3613 | jorpiell | protected void showResults(Collection nodes) { |
90 | JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
||
91 | 4346 | jorpiell | Frames.centerFrame(panel,610,418); |
92 | 4713 | cesar | panel.setTitle(Messages.getText("search_results"));
|
93 | 3613 | jorpiell | panel.setResizable(false);
|
94 | |||
95 | ShowResultsPanel.mustShowThumbnails = true;
|
||
96 | 2026 | luisw | ShowResultsDialog dialog = |
97 | 3613 | jorpiell | new ShowResultsDialog(panel,client,nodes,1); |
98 | |||
99 | panel.getContentPane().add(dialog); |
||
100 | panel.show(); |
||
101 | 2026 | luisw | } |
102 | 3161 | jorpiell | |
103 | 2026 | luisw | /**
|
104 | 3180 | jorpiell | * It Closes the dialog
|
105 | 2026 | luisw | */
|
106 | public void closeJDialog() { |
||
107 | 3177 | jorpiell | frame.setVisible(false);
|
108 | 3613 | jorpiell | |
109 | 2026 | luisw | } |
110 | |||
111 | /* (non-Javadoc)
|
||
112 | * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
||
113 | */
|
||
114 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
115 | 3161 | jorpiell | if (m_viewinfo == null){ |
116 | 6880 | cesar | m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
117 | 3161 | jorpiell | m_viewinfo.setTitle(getName()); |
118 | } |
||
119 | 2309 | luisw | return m_viewinfo;
|
120 | 2026 | luisw | } |
121 | 3599 | jorpiell | |
122 | 2309 | luisw | |
123 | 3180 | jorpiell | /**
|
124 | * Close button Action performed
|
||
125 | */
|
||
126 | 2868 | jorpiell | public void closeButtonActionPerformed() { |
127 | closeJDialog(); |
||
128 | } |
||
129 | 2986 | jorpiell | |
130 | 3180 | jorpiell | /**
|
131 | * Size button action performed
|
||
132 | */
|
||
133 | 2986 | jorpiell | public void sizeButtonActionPerformed(){ |
134 | 8765 | jjdelcerro | if (isMinimized){
|
135 | frame.setSize(525,507); |
||
136 | 8604 | jorpiell | ppalPanel.setPreferredSize(new Dimension(514,470)); |
137 | getLowerPanel().setPreferredSize(new Dimension(514,470)); |
||
138 | 3161 | jorpiell | getLowerPanel().setVisible(true);
|
139 | 4354 | jorpiell | frame.setVisible(true);
|
140 | 3161 | jorpiell | getUpperPanel().setUpIcon(); |
141 | }else{
|
||
142 | 8765 | jjdelcerro | frame.setSize(525,163); |
143 | 8604 | jorpiell | ppalPanel.setPreferredSize(new Dimension(514,150)); |
144 | 4354 | jorpiell | getLowerPanel().setPreferredSize(new Dimension(514,0)); |
145 | 3161 | jorpiell | getLowerPanel().setVisible(false);
|
146 | 4354 | jorpiell | frame.setVisible(true);
|
147 | 3161 | jorpiell | getUpperPanel().setDownIcon(); |
148 | } |
||
149 | isMinimized = !isMinimized; |
||
150 | 2986 | jorpiell | } |
151 | 4336 | jorpiell | |
152 | /**
|
||
153 | * Return button action
|
||
154 | */
|
||
155 | public void returnButtonActionPerformed() { |
||
156 | closeJDialog(); |
||
157 | ConnectDialog serverConnect = (ConnectDialog)serverConnectFrame; |
||
158 | serverConnect.setVisible(true);
|
||
159 | serverConnect.getSearchButton().setEnabled(false);
|
||
160 | 6880 | cesar | PluginServices.getMDIManager().addWindow(serverConnect); |
161 | 4336 | jorpiell | |
162 | |||
163 | } |
||
164 | |||
165 | 4238 | jorpiell | |
166 | /**
|
||
167 | * This method loads the view coordinates to the catalog search dialog
|
||
168 | *
|
||
169 | */
|
||
170 | private void loadViewPortCoordinates(){ |
||
171 | 7400 | jorpiell | View activeView =
|
172 | (View) PluginServices.getMDIManager().getActiveWindow();
|
||
173 | 4238 | jorpiell | |
174 | Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent();
|
||
175 | |||
176 | try{
|
||
177 | getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
|
||
178 | r2d.getMaxY(), |
||
179 | r2d.getMaxX(), |
||
180 | r2d.getMinY())); |
||
181 | }catch(NullPointerException E){ |
||
182 | //We cant retrieve the coordinates if it doesn't
|
||
183 | //exist a loaded layer
|
||
184 | } |
||
185 | } |
||
186 | 3161 | jorpiell | |
187 | /**
|
||
188 | 4238 | jorpiell | * This methos joins the viewPort event to the listener
|
189 | 3161 | jorpiell | */
|
190 | 4238 | jorpiell | private void setViewChangeListener(){ |
191 | 7400 | jorpiell | View activeView =
|
192 | (View) PluginServices.getMDIManager().getActiveWindow();
|
||
193 | 4238 | jorpiell | |
194 | activeView.getMapControl().getViewPort().addViewPortListener(this);
|
||
195 | 3161 | jorpiell | } |
196 | 4238 | jorpiell | |
197 | public void extentChanged(ExtentEvent e) { |
||
198 | loadViewPortCoordinates(); |
||
199 | |||
200 | } |
||
201 | |||
202 | public void backColorChanged(ColorEvent e) { |
||
203 | // TODO Auto-generated method stub
|
||
204 | |||
205 | } |
||
206 | 5939 | jmvivo | |
207 | public void projectionChanged(ProjectionEvent e) { |
||
208 | loadViewPortCoordinates(); |
||
209 | } |
||
210 | 3161 | jorpiell | |
211 | |||
212 | 2986 | jorpiell | |
213 | 3100 | jorpiell | |
214 | 2986 | jorpiell | |
215 | 2026 | luisw | } |