svn-gvsig-desktop / tags / v1_1_Build_914 / extensions / extCatalogYNomenclator / src / es / gva / cit / gvsig / catalogClient / gui / SearchDialog.java @ 11873
History | View | Annotate | Download (5.96 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 | 9418 | jorpiell | IWindow,ViewPortListener { |
74 | public WindowInfo m_windowInfo = null; |
||
75 | 3161 | jorpiell | |
76 | 9418 | jorpiell | public SearchDialog(Object serverConnectFrame,CatalogClient client) { |
77 | 4713 | cesar | super(null,serverConnectFrame,client); |
78 | 4238 | jorpiell | setViewChangeListener(); |
79 | loadViewPortCoordinates(); |
||
80 | 2026 | luisw | } |
81 | |||
82 | 3180 | jorpiell | /**
|
83 | * This method opens the show results frame.
|
||
84 | 3567 | jorpiell | * @param nodes
|
85 | 3180 | jorpiell | * XML node returned by the query
|
86 | */
|
||
87 | 3613 | jorpiell | protected void showResults(Collection nodes) { |
88 | 9418 | jorpiell | JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
89 | Frames.centerFrame(panel,610,418); |
||
90 | panel.setTitle(Messages.getText("search_results"));
|
||
91 | panel.setResizable(false);
|
||
92 | |||
93 | ShowResultsPanel.mustShowThumbnails = true;
|
||
94 | ShowResultsDialog dialog = |
||
95 | new ShowResultsDialog(panel,client,nodes,1); |
||
96 | |||
97 | panel.getContentPane().add(dialog); |
||
98 | panel.show(); |
||
99 | 2026 | luisw | } |
100 | 3161 | jorpiell | |
101 | 2026 | luisw | /**
|
102 | 3180 | jorpiell | * It Closes the dialog
|
103 | 2026 | luisw | */
|
104 | public void closeJDialog() { |
||
105 | 9418 | jorpiell | PluginServices.getMDIManager().closeWindow(this);
|
106 | 2026 | luisw | } |
107 | |||
108 | /* (non-Javadoc)
|
||
109 | * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
||
110 | */
|
||
111 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
112 | 9418 | jorpiell | if (m_windowInfo == null){ |
113 | m_windowInfo = new WindowInfo(WindowInfo.PALETTE);
|
||
114 | m_windowInfo.setTitle(Messages.getText("catalog_search") + " [" + |
||
115 | getCurrentServer() + "]");
|
||
116 | m_windowInfo.setHeight(125);
|
||
117 | m_windowInfo.setWidth(525);
|
||
118 | 3161 | jorpiell | } |
119 | 9418 | jorpiell | return m_windowInfo;
|
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 | 9418 | jorpiell | getWindowInfo().setHeight(509);
|
136 | getWindowInfo().setWidth(525);
|
||
137 | 8604 | jorpiell | ppalPanel.setPreferredSize(new Dimension(514,470)); |
138 | getLowerPanel().setPreferredSize(new Dimension(514,470)); |
||
139 | 3161 | jorpiell | getLowerPanel().setVisible(true);
|
140 | getUpperPanel().setUpIcon(); |
||
141 | 9418 | jorpiell | }else{
|
142 | getWindowInfo().setHeight(165);
|
||
143 | getWindowInfo().setWidth(525);
|
||
144 | ppalPanel.setPreferredSize(new Dimension(514,150)); |
||
145 | getLowerPanel().setPreferredSize(new Dimension(514,0)); |
||
146 | getLowerPanel().setVisible(false);
|
||
147 | getUpperPanel().setDownIcon(); |
||
148 | 3161 | jorpiell | } |
149 | 9418 | jorpiell | 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.getSearchButton().setEnabled(false);
|
||
159 | 9418 | jorpiell | PluginServices.getMDIManager().addWindow(serverConnect); |
160 | 4336 | jorpiell | |
161 | } |
||
162 | |||
163 | 4238 | jorpiell | |
164 | /**
|
||
165 | * This method loads the view coordinates to the catalog search dialog
|
||
166 | *
|
||
167 | */
|
||
168 | private void loadViewPortCoordinates(){ |
||
169 | 7400 | jorpiell | View activeView =
|
170 | (View) PluginServices.getMDIManager().getActiveWindow();
|
||
171 | 4238 | jorpiell | |
172 | Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent();
|
||
173 | |||
174 | try{
|
||
175 | getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
|
||
176 | r2d.getMaxY(), |
||
177 | r2d.getMaxX(), |
||
178 | r2d.getMinY())); |
||
179 | }catch(NullPointerException E){ |
||
180 | //We cant retrieve the coordinates if it doesn't
|
||
181 | //exist a loaded layer
|
||
182 | } |
||
183 | } |
||
184 | 3161 | jorpiell | |
185 | /**
|
||
186 | 4238 | jorpiell | * This methos joins the viewPort event to the listener
|
187 | 3161 | jorpiell | */
|
188 | 4238 | jorpiell | private void setViewChangeListener(){ |
189 | 7400 | jorpiell | View activeView =
|
190 | (View) PluginServices.getMDIManager().getActiveWindow();
|
||
191 | 4238 | jorpiell | |
192 | activeView.getMapControl().getViewPort().addViewPortListener(this);
|
||
193 | 3161 | jorpiell | } |
194 | 4238 | jorpiell | |
195 | public void extentChanged(ExtentEvent e) { |
||
196 | loadViewPortCoordinates(); |
||
197 | |||
198 | } |
||
199 | |||
200 | public void backColorChanged(ColorEvent e) { |
||
201 | // TODO Auto-generated method stub
|
||
202 | |||
203 | } |
||
204 | 5939 | jmvivo | |
205 | public void projectionChanged(ProjectionEvent e) { |
||
206 | loadViewPortCoordinates(); |
||
207 | } |
||
208 | 3161 | jorpiell | |
209 | |||
210 | 2986 | jorpiell | |
211 | 3100 | jorpiell | |
212 | 2986 | jorpiell | |
213 | 2026 | luisw | } |