Revision 15110
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.154/org.gvsig.raster.wms.app.wmsclient/buildNumber.properties | ||
---|---|---|
1 |
#Fri Sep 24 15:19:55 CEST 2021 |
|
2 |
buildNumber=209 |
|
0 | 3 |
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.154/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/dialog/WMSPropsDialog.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.gui.dialog; |
|
24 |
|
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.awt.event.ActionListener; |
|
28 |
import java.util.HashMap; |
|
29 |
import java.util.List; |
|
30 |
import java.util.Vector; |
|
31 |
|
|
32 |
import javax.swing.JButton; |
|
33 |
import javax.swing.JDialog; |
|
34 |
import javax.swing.JOptionPane; |
|
35 |
import javax.swing.JPanel; |
|
36 |
import javax.swing.tree.TreePath; |
|
37 |
|
|
38 |
import org.gvsig.andami.PluginServices; |
|
39 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
40 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
41 |
import org.gvsig.app.gui.wizards.WizardListener; |
|
42 |
import org.gvsig.app.gui.wizards.WizardListenerSupport; |
|
43 |
import org.gvsig.fmap.dal.coverage.exception.ConnectException; |
|
44 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
45 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
46 |
import org.gvsig.fmap.mapcontext.exceptions.ConnectionErrorLayerException; |
|
47 |
import org.gvsig.fmap.mapcontext.exceptions.DriverLayerException; |
|
48 |
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException; |
|
49 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
50 |
import org.gvsig.fmap.mapcontext.exceptions.NameLayerException; |
|
51 |
import org.gvsig.fmap.mapcontext.exceptions.ProjectionLayerException; |
|
52 |
import org.gvsig.fmap.mapcontext.exceptions.TypeLayerException; |
|
53 |
import org.gvsig.fmap.mapcontext.exceptions.URLLayerException; |
|
54 |
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException; |
|
55 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
56 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
57 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
58 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
59 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
60 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
61 |
import org.gvsig.raster.wms.app.wmsclient.gui.panel.WMSParamsPanel; |
|
62 |
import org.gvsig.raster.wms.app.wmsclient.gui.wizard.LayerTreeModel; |
|
63 |
import org.gvsig.raster.wms.app.wmsclient.layer.FLyrWMS; |
|
64 |
import org.gvsig.raster.wms.io.RemoteWMSStyle; |
|
65 |
import org.gvsig.raster.wms.io.WMSLayerNode; |
|
66 |
import org.gvsig.raster.wms.io.WMSServerExplorer; |
|
67 |
import org.slf4j.Logger; |
|
68 |
import org.slf4j.LoggerFactory; |
|
69 |
|
|
70 |
|
|
71 |
/** |
|
72 |
* The TOC WMS properties panel container. |
|
73 |
* |
|
74 |
* @author jaume - |
|
75 |
* |
|
76 |
*/ |
|
77 |
public class WMSPropsDialog extends JPanel implements IWindow { |
|
78 |
|
|
79 |
private static final long serialVersionUID = 1L; |
|
80 |
private Logger logger = LoggerFactory.getLogger(WMSPropsDialog.class); |
|
81 |
JDialog dlg = null; |
|
82 |
private JPanel buttonsPanel = null; |
|
83 |
private FLyrRaster fLayer = null; |
|
84 |
boolean applied = false;; |
|
85 |
private WindowInfo m_ViewInfo = null; |
|
86 |
|
|
87 |
private JButton btnApply = null; |
|
88 |
private JButton btnOk = null; |
|
89 |
private JButton btnCancel = null; |
|
90 |
private WMSParamsPanel wmsParamsTabbedPane; |
|
91 |
private CommandListener m_actionListener; |
|
92 |
private WMSServerExplorer explorer = null; |
|
93 |
|
|
94 |
public WMSPropsDialog(FLayer layer) { |
|
95 |
super(); |
|
96 |
if(layer instanceof FLyrRaster) |
|
97 |
initialize((FLyrRaster)layer); |
|
98 |
} |
|
99 |
|
|
100 |
|
|
101 |
private void initialize(FLyrRaster layer) { |
|
102 |
setLayout(null); |
|
103 |
|
|
104 |
setFLayer(layer); |
|
105 |
wmsParamsTabbedPane = getParamsPanel(((FLyrWMS) layer).getProperties()); |
|
106 |
wmsParamsTabbedPane.addWizardListener(new WizardListener(){ |
|
107 |
public void wizardStateChanged(boolean finishable) { |
|
108 |
getBtnOk().setEnabled(finishable); |
|
109 |
getBtnApply().setEnabled(finishable); |
|
110 |
} |
|
111 |
|
|
112 |
public void error(Exception e) { |
|
113 |
} |
|
114 |
|
|
115 |
}) ; |
|
116 |
wmsParamsTabbedPane.disableDisagregatedLayers(); |
|
117 |
this.add(wmsParamsTabbedPane); |
|
118 |
this.add(getButtonsPanel(), null); |
|
119 |
|
|
120 |
} |
|
121 |
|
|
122 |
|
|
123 |
public void setFLayer(FLyrRaster f) { |
|
124 |
fLayer = f; |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* With getParamsPanel we have access to the map config TabbedPane. |
|
129 |
* If this panel doesn't exist yet (which can occur when an existing project is |
|
130 |
* recovered) it is been automatically constructed by connecting to the server, |
|
131 |
* reloading the necessary data, filling up the content and setting the selected |
|
132 |
* values that were selected when the projet was saved. |
|
133 |
* |
|
134 |
* |
|
135 |
* Since a connection to the server is needed when rebuiliding the panel, this |
|
136 |
* causes a delay for the panel's showing up or a nullPointer error if there is |
|
137 |
* no path to the server. |
|
138 |
* |
|
139 |
* |
|
140 |
* Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n |
|
141 |
* del mapa. Si este panel todav?a no existe (como puede ser cuando |
|
142 |
* recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando |
|
143 |
* al servidor, recuperando los datos necesarios, rellenando el contenido y |
|
144 |
* dejando seleccionados los valores que estaban seleccionados cuando se |
|
145 |
* guarda el proyecto. |
|
146 |
* |
|
147 |
* |
|
148 |
* Como para reconstruirse requiere una conexi?n con el servidor esto causa |
|
149 |
* un retardo en la aparici?n en el toc o un error de nullPointer si no |
|
150 |
* hay conexi?n hasta el servidor. |
|
151 |
* |
|
152 |
* |
|
153 |
* @return WMSParamsPanel |
|
154 |
*/ |
|
155 |
@SuppressWarnings({ "unchecked" }) |
|
156 |
public WMSParamsPanel getParamsPanel(HashMap info) { |
|
157 |
if (info != null) { |
|
158 |
try { |
|
159 |
if(explorer == null) { |
|
160 |
explorer = ((FLyrWMS)fLayer).getExplorer(); |
|
161 |
|
|
162 |
try { |
|
163 |
explorer.connect(new CancelTaskImpl(), true); |
|
164 |
} catch (ConnectException e) { |
|
165 |
RasterSwingLibrary.messageBoxError("The connection cannot be established", this, e); |
|
166 |
return null; |
|
167 |
} |
|
168 |
} |
|
169 |
} catch (Exception e) { |
|
170 |
explorer = null; |
|
171 |
JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE); |
|
172 |
} |
|
173 |
try { |
|
174 |
|
|
175 |
// name |
|
176 |
WMSParamsPanel toc = new WMSParamsPanel(); |
|
177 |
toc.setLayerName((String)info.get("name")); |
|
178 |
toc.setWizardData(explorer); |
|
179 |
|
|
180 |
toc.setVisible(true); |
|
181 |
toc.setListenerSupport(new WizardListenerSupport()); |
|
182 |
|
|
183 |
WMSLayerNode[] selectedLayers = (WMSLayerNode[]) ((Vector) info.get("selectedLayers")).toArray(new WMSLayerNode[0]); |
|
184 |
for (int i = 0; i < selectedLayers.length; i++) { |
|
185 |
toc.getJustTreeLayer().clearSelection(); |
|
186 |
// Se a?ade a la lista de layers seleccionados |
|
187 |
TreePath path = new TreePath(((LayerTreeModel)toc.getJustTreeLayer() |
|
188 |
.getModel()).getNodeByName(selectedLayers[i].getName())); |
|
189 |
toc.getJustTreeLayer().addSelectionPath(path); |
|
190 |
toc.addLayer(); |
|
191 |
} |
|
192 |
|
|
193 |
// srs |
|
194 |
String srs = (String) info.get("srs"); |
|
195 |
int index = toc.getSRSIndex( srs ); |
|
196 |
if (index != -1) { |
|
197 |
toc.getLstSRSs().setSelectedIndex(index); |
|
198 |
} |
|
199 |
|
|
200 |
// format |
|
201 |
String format = (String) info.get("format"); |
|
202 |
index = toc.getFormatIndex(format); |
|
203 |
if (index != -1) { |
|
204 |
toc.getLstFormats().setSelectedIndex(index); |
|
205 |
} |
|
206 |
|
|
207 |
//info format |
|
208 |
String infoFormat = (String) info.get("infoformat"); |
|
209 |
index = toc.getInfoFormatIndex(infoFormat); |
|
210 |
if (index != -1) { |
|
211 |
toc.getLstInfoFormats().setSelectedIndex(index); |
|
212 |
} |
|
213 |
|
|
214 |
// transparency |
|
215 |
toc.setTransparent(((Boolean) info.get("wmsTransparency")).booleanValue()); |
|
216 |
|
|
217 |
// styles |
|
218 |
List<RemoteWMSStyle> l = (List<RemoteWMSStyle>) info.get("styles"); |
|
219 |
if (l != null && l.size() > 0) { |
|
220 |
toc.setStyleSelections(l); |
|
221 |
} |
|
222 |
|
|
223 |
// dimensions |
|
224 |
Vector v = (Vector) info.get("dimensions"); |
|
225 |
if (v != null) { |
|
226 |
toc.setDimensions(v); |
|
227 |
} |
|
228 |
|
|
229 |
// fixed sizes |
|
230 |
Dimension sz = (Dimension) info.get("fixedSize"); |
|
231 |
if (sz != null) { |
|
232 |
toc.setFixedSize(sz); |
|
233 |
} |
|
234 |
toc.refreshInfo(); |
|
235 |
applied = false; |
|
236 |
return toc; |
|
237 |
} catch (Exception e) { |
|
238 |
JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE); |
|
239 |
} |
|
240 |
} |
|
241 |
return null; |
|
242 |
} |
|
243 |
|
|
244 |
|
|
245 |
public JPanel getButtonsPanel() { |
|
246 |
if (buttonsPanel == null) { |
|
247 |
m_actionListener = new CommandListener(this); |
|
248 |
buttonsPanel = new JPanel(); |
|
249 |
buttonsPanel.setBounds(5, wmsParamsTabbedPane.getHeight(), 471, 40); |
|
250 |
buttonsPanel.setLayout(null); |
|
251 |
buttonsPanel.setName("buttonPanel"); |
|
252 |
|
|
253 |
buttonsPanel.add(getBtnOk(), null); |
|
254 |
buttonsPanel.add(getBtnApply(), null); |
|
255 |
buttonsPanel.add(getBtnCancel(), null); |
|
256 |
} |
|
257 |
return buttonsPanel; |
|
258 |
} |
|
259 |
|
|
260 |
public JButton getBtnOk() { |
|
261 |
if (btnOk == null) { |
|
262 |
btnOk = new JButton("ok"); |
|
263 |
btnOk.setText(PluginServices.getText(this,"ok")); |
|
264 |
btnOk.setActionCommand("OK"); |
|
265 |
btnOk.addActionListener(m_actionListener); |
|
266 |
btnOk.setBounds(367, 9, 90, 25); |
|
267 |
} |
|
268 |
return btnOk; |
|
269 |
} |
|
270 |
|
|
271 |
public JButton getBtnApply() { |
|
272 |
if (btnApply == null) { |
|
273 |
btnApply = new JButton("apply"); |
|
274 |
btnApply.setText(PluginServices.getText(this,"apply")); |
|
275 |
btnApply.setEnabled(false); |
|
276 |
btnApply.setActionCommand("APPLY"); |
|
277 |
btnApply.addActionListener(m_actionListener); |
|
278 |
btnApply.setBounds(267, 9, 90, 25); |
|
279 |
} |
|
280 |
return btnApply; |
|
281 |
} |
|
282 |
|
|
283 |
public JButton getBtnCancel() { |
|
284 |
if (btnCancel == null) { |
|
285 |
btnCancel = new JButton("cancel"); |
|
286 |
btnCancel.setText(PluginServices.getText(this,"cancel")); |
|
287 |
btnCancel.setActionCommand("CANCEL"); |
|
288 |
btnCancel.addActionListener(m_actionListener); |
|
289 |
btnCancel.setBounds(137, 9, 90, 25); |
|
290 |
} |
|
291 |
return btnCancel; |
|
292 |
} |
|
293 |
|
|
294 |
private class CommandListener implements ActionListener { |
|
295 |
|
|
296 |
/** |
|
297 |
* Creates a new ComandosListener object. |
|
298 |
* |
|
299 |
* @param lg DOCUMENT ME! |
|
300 |
*/ |
|
301 |
public CommandListener(WMSPropsDialog tp) { |
|
302 |
//m_tp = tp; |
|
303 |
} |
|
304 |
|
|
305 |
@SuppressWarnings({ "unchecked" }) |
|
306 |
public void actionPerformed(ActionEvent e) { |
|
307 |
if (e.getActionCommand() == "CANCEL") { |
|
308 |
close(); |
|
309 |
} else { |
|
310 |
/*try { |
|
311 |
((FLyrWMS) fLayer).setFullExtent(wmsParamsTabbedPane.getLayersRectangle()); |
|
312 |
} catch (ProjectionLayerException ex) { |
|
313 |
ex.printStackTrace(); |
|
314 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), ex.getMessage()); |
|
315 |
return; |
|
316 |
}*/ |
|
317 |
((FLyrWMS) fLayer).getParameters().setFormat(wmsParamsTabbedPane.getFormat()); |
|
318 |
((FLyrWMS) fLayer).getParameters().setInfoFormat(wmsParamsTabbedPane.getInfoFormat()); |
|
319 |
try { |
|
320 |
if (!wmsParamsTabbedPane.getDisagregatedLayers()) { |
|
321 |
((FLyrWMS) fLayer).getParameters().setLayerQuery(wmsParamsTabbedPane.getLayersQuery()); |
|
322 |
} |
|
323 |
((FLyrWMS) fLayer).getParameters().setInfoLayerQuery(wmsParamsTabbedPane.getQueryableLayerQuery()); |
|
324 |
((FLyrWMS) fLayer).getParameters().setSRS(wmsParamsTabbedPane.getSRS()); |
|
325 |
((FLyrWMS) fLayer).getParameters().setName(wmsParamsTabbedPane.getLayerName()); |
|
326 |
((FLyrWMS) fLayer).getParameters().setWmsTransparency(wmsParamsTabbedPane.getTransparency()); |
|
327 |
((FLyrWMS) fLayer).getParameters().setStyles(wmsParamsTabbedPane.getStyles()); |
|
328 |
((FLyrWMS) fLayer).getParameters().setDimensions(wmsParamsTabbedPane.getDimensions()); |
|
329 |
((FLyrWMS) fLayer).getParameters().setFixedSize(wmsParamsTabbedPane.getFixedSize()); |
|
330 |
|
|
331 |
//fLayer = wmsParamsTabbedPane.getLayer(); |
|
332 |
FLayers parent = ((FLayer)fLayer).getParentLayer(); |
|
333 |
|
|
334 |
if (e.getActionCommand() == "APPLY"){ |
|
335 |
MapControl mapCtrl = null; |
|
336 |
|
|
337 |
IWindow[] w = PluginServices.getMDIManager().getAllWindows(); |
|
338 |
for (int i = 0; i < w.length; i++) { |
|
339 |
if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) { |
|
340 |
MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext(); |
|
341 |
if(mapContext == fLayer.getMapContext()) |
|
342 |
mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl(); |
|
343 |
} |
|
344 |
} |
|
345 |
|
|
346 |
if (parent != null) { |
|
347 |
if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){ |
|
348 |
mapCtrl.getMapContext().getLayers(). |
|
349 |
replaceLayer(parent.getName(),mergeFLayers(parent,(FLayers)wmsParamsTabbedPane.getLayer())); |
|
350 |
} |
|
351 |
} |
|
352 |
else { |
|
353 |
mapCtrl.getMapContext().getLayers().replaceLayer(fLayer.getName(), wmsParamsTabbedPane.getLayer()); |
|
354 |
} |
|
355 |
//mapCtrl.getMapContext().getLayers().addLayer( fLayer ); |
|
356 |
mapCtrl.getMapContext().invalidate(); |
|
357 |
applied = true; |
|
358 |
getBtnApply().setEnabled(!applied); |
|
359 |
} |
|
360 |
if (e.getActionCommand() == "OK") { |
|
361 |
if (!applied) { |
|
362 |
|
|
363 |
org.gvsig.app.project.documents.view.gui.AbstractViewPanel vista = (org.gvsig.app.project.documents.view.gui.AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
364 |
MapControl mapCtrl = vista.getMapControl(); |
|
365 |
|
|
366 |
if (parent != null){ |
|
367 |
if ( wmsParamsTabbedPane.getLayer() instanceof FLayers){ |
|
368 |
mapCtrl.getMapContext().getLayers(). |
|
369 |
replaceLayer(parent.getName(),mergeFLayers(parent,(FLayers)wmsParamsTabbedPane.getLayer())); |
|
370 |
} |
|
371 |
} |
|
372 |
else { |
|
373 |
mapCtrl.getMapContext().getLayers().replaceLayer(fLayer.getName(), wmsParamsTabbedPane.getLayer()); |
|
374 |
} mapCtrl.getMapContext().invalidate(); |
|
375 |
} |
|
376 |
close(); |
|
377 |
} |
|
378 |
} catch (ConnectionErrorLayerException e1) { |
|
379 |
logger.info("", e1); |
|
380 |
} catch (DriverLayerException e1) { |
|
381 |
logger.info("", e1); |
|
382 |
} catch (LegendLayerException e1) { |
|
383 |
logger.info("", e1); |
|
384 |
} catch (NameLayerException e1) { |
|
385 |
logger.info("", e1); |
|
386 |
} catch (ProjectionLayerException e1) { |
|
387 |
logger.info("", e1); |
|
388 |
} catch (TypeLayerException e1) { |
|
389 |
logger.info("", e1); |
|
390 |
} catch (UnsupportedVersionLayerException e1) { |
|
391 |
logger.info("", e1); |
|
392 |
} catch (URLLayerException e1) { |
|
393 |
logger.info("", e1); |
|
394 |
} catch (LoadLayerException e1) { |
|
395 |
logger.info("", e1); |
|
396 |
} catch (InitializeException e1) { |
|
397 |
logger.info("", e1); |
|
398 |
} |
|
399 |
} |
|
400 |
} |
|
401 |
} |
|
402 |
/** |
|
403 |
* Merge two FLayers in one |
|
404 |
* @param group1 |
|
405 |
* @param group2 |
|
406 |
* @return |
|
407 |
*/ |
|
408 |
private FLayers mergeFLayers(FLayers group1, FLayers group2) |
|
409 |
{ |
|
410 |
//FLayers agrupation = new FLayers(group1.getFMap(), group1.getParentLayer()); |
|
411 |
FLayer layer; |
|
412 |
for(int i = 0; i < group2.getLayersCount(); i++) |
|
413 |
{ |
|
414 |
layer = group2.getLayer( i ); |
|
415 |
if(group1.getLayer( layer.getName()) == null ){ |
|
416 |
group1.addLayer( layer ); |
|
417 |
} |
|
418 |
} |
|
419 |
|
|
420 |
return group1; |
|
421 |
} |
|
422 |
|
|
423 |
|
|
424 |
|
|
425 |
public WindowInfo getWindowInfo() { |
|
426 |
if (m_ViewInfo==null){ |
|
427 |
m_ViewInfo=new WindowInfo(WindowInfo.MODALDIALOG); |
|
428 |
m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WMS_layer")); |
|
429 |
m_ViewInfo.setWidth(wmsParamsTabbedPane.getWidth()+10); |
|
430 |
m_ViewInfo.setHeight(wmsParamsTabbedPane.getHeight()+40); |
|
431 |
|
|
432 |
} |
|
433 |
return m_ViewInfo; |
|
434 |
} |
|
435 |
|
|
436 |
public void close() { |
|
437 |
PluginServices.getMDIManager().closeWindow(this); |
|
438 |
} |
|
439 |
|
|
440 |
|
|
441 |
public Object getWindowProfile() { |
|
442 |
return WindowInfo.DIALOG_PROFILE; |
|
443 |
} |
|
444 |
|
|
445 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 446 |
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.154/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/panel/WebMapContextFileChooserAccessory.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.Dimension; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import javax.swing.JComboBox; |
|
29 |
import javax.swing.JLabel; |
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.app.project.ProjectManager; |
|
34 |
import org.gvsig.app.project.documents.Document; |
|
35 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
36 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
37 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
38 |
|
|
39 |
|
|
40 |
public class WebMapContextFileChooserAccessory extends JPanel { |
|
41 |
public static int NEW_VIEW = -1; |
|
42 |
public static int CURRENT_VIEW = -1; |
|
43 |
public static int USERS_VIEW_SELECTION = -1; |
|
44 |
|
|
45 |
private JComboBox cmbMode = null; |
|
46 |
private JComboBox cmbViews = null; |
|
47 |
private JLabel lblExplain = null; |
|
48 |
private String currentView = null; |
|
49 |
|
|
50 |
public WebMapContextFileChooserAccessory(String currentViewName) { |
|
51 |
super(); |
|
52 |
currentView = currentViewName; |
|
53 |
initialize(); |
|
54 |
} |
|
55 |
|
|
56 |
private void initialize() { |
|
57 |
lblExplain = new JLabel(); |
|
58 |
lblExplain.setBounds(25, 52, 268, 55); |
|
59 |
lblExplain.setText(PluginServices.getText(this, "html_in_a_new_view")); |
|
60 |
setLayout(null); |
|
61 |
setSize(315, 240); |
|
62 |
setPreferredSize(new Dimension(315, 72)); |
|
63 |
this.add(getCmbViews(), null); |
|
64 |
this.add(lblExplain, null); |
|
65 |
setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
66 |
null, PluginServices.getText(this, "open_layers_as"), |
|
67 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
68 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
69 |
this.add(getCmbMode(), null); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* This method initializes cmbBoxMode |
|
74 |
* |
|
75 |
* @return javax.swing.JComboBox |
|
76 |
*/ |
|
77 |
private JComboBox getCmbMode() { |
|
78 |
if (cmbMode == null) { |
|
79 |
cmbMode = new JComboBox(); |
|
80 |
cmbMode.setBounds(25, 26, 268, 20); |
|
81 |
cmbMode.removeAllItems(); |
|
82 |
cmbMode.addItemListener(new java.awt.event.ItemListener() { |
|
83 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
84 |
cmbViews.setVisible(false); |
|
85 |
|
|
86 |
if (cmbMode.getSelectedIndex() == NEW_VIEW) { |
|
87 |
lblExplain.setText(PluginServices.getText(this, "html_in_a_new_view")); |
|
88 |
} else if (cmbMode.getSelectedIndex() == CURRENT_VIEW) { |
|
89 |
lblExplain.setText(PluginServices.getText(this, "html_in_the_current_view")); |
|
90 |
} else if (cmbMode.getSelectedIndex() == USERS_VIEW_SELECTION) { |
|
91 |
lblExplain.setText(PluginServices.getText(this, "html_in_other_view")); |
|
92 |
cmbViews.setVisible(true); |
|
93 |
} |
|
94 |
} |
|
95 |
}); |
|
96 |
cmbMode.addItem(PluginServices.getText(this, "a_new_view")); |
|
97 |
if (currentView!=null) { |
|
98 |
cmbMode.addItem(PluginServices.getText(this, "layers_in_the_current_view")+": "+currentView); |
|
99 |
CURRENT_VIEW = cmbMode.getItemCount()-1; |
|
100 |
cmbMode.setSelectedIndex(CURRENT_VIEW); |
|
101 |
} |
|
102 |
if (getCmbViews().getItemCount()>0) { |
|
103 |
cmbMode.addItem(PluginServices.getText(this, "layers_in_other_view")); |
|
104 |
USERS_VIEW_SELECTION = cmbMode.getItemCount() -1; |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
return cmbMode; |
|
109 |
} |
|
110 |
|
|
111 |
public void setCurrentView(AbstractViewPanel v) { |
|
112 |
currentView = v.getName(); |
|
113 |
} |
|
114 |
|
|
115 |
public DefaultViewDocument getSelectedView() { |
|
116 |
String viewName = null; |
|
117 |
if (getCmbMode().getSelectedIndex() == NEW_VIEW) |
|
118 |
return null; |
|
119 |
else if (getCmbMode().getSelectedIndex() == CURRENT_VIEW) |
|
120 |
viewName = currentView; |
|
121 |
else if (getCmbMode().getSelectedIndex() == USERS_VIEW_SELECTION) |
|
122 |
viewName = (String) getCmbViews().getSelectedItem(); |
|
123 |
return (DefaultViewDocument) ProjectManager.getInstance().getCurrentProject().getDocument(viewName, ViewManager.TYPENAME); |
|
124 |
// ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
|
125 |
// return (ProjectView) pe.getProject().getProjectDocumentByName(viewName, ProjectViewFactory.registerName); |
|
126 |
} |
|
127 |
|
|
128 |
public int getOption() { |
|
129 |
return cmbMode.getSelectedIndex(); |
|
130 |
} |
|
131 |
|
|
132 |
/** |
|
133 |
* This method initializes cmbViews |
|
134 |
* |
|
135 |
* @return javax.swing.JComboBox |
|
136 |
*/ |
|
137 |
private JComboBox getCmbViews() { |
|
138 |
if (cmbViews == null) { |
|
139 |
cmbViews = new JComboBox(); |
|
140 |
cmbViews.setBounds(25, 114, 266, 20); |
|
141 |
List<Document> views = ProjectManager.getInstance().getCurrentProject().getDocuments( ViewManager.TYPENAME); |
|
142 |
for (Document v : views) { |
|
143 |
cmbViews.addItem(v.getName()); |
|
144 |
} |
|
145 |
|
|
146 |
// ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
|
147 |
// ArrayList views = pe.getProject().getDocumentsByType(ProjectViewFactory.registerName); |
|
148 |
// for (int i = 0; i < views.size(); i++) { |
|
149 |
// ProjectView v = (ProjectView)views.get(i); |
|
150 |
// cmbViews.addItem(v.getName()); |
|
151 |
// } |
|
152 |
} |
|
153 |
return cmbViews; |
|
154 |
} |
|
155 |
} // @jve:decl-index=0:visual-constraint="10,0" |
|
0 | 156 |
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.154/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/panel/StyleTree.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.Color; |
|
26 |
import java.awt.Component; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.Vector; |
|
29 |
|
|
30 |
import javax.swing.JLabel; |
|
31 |
import javax.swing.JPanel; |
|
32 |
import javax.swing.JRadioButton; |
|
33 |
import javax.swing.JTree; |
|
34 |
import javax.swing.event.TreeModelListener; |
|
35 |
import javax.swing.tree.DefaultTreeCellRenderer; |
|
36 |
import javax.swing.tree.TreeModel; |
|
37 |
import javax.swing.tree.TreePath; |
|
38 |
|
|
39 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
40 |
import org.gvsig.raster.wms.io.RemoteWMSStyle; |
|
41 |
import org.gvsig.raster.wms.io.WMSLayerNode; |
|
42 |
|
|
43 |
|
|
44 |
/** |
|
45 |
* This class holds a visual tree that handles the selection of the styles in the |
|
46 |
* selected layers. It encapsulates any gui interface handling the mouse selection. |
|
47 |
* <p> |
|
48 |
* It has a method getStylesSelection that returns the current selection in a |
|
49 |
* bi-dimensional string array containing the layer name and the selected style name. |
|
50 |
* </p> |
|
51 |
* <p> |
|
52 |
* Keep in mind that although it's similar to LayersTree it is not the same. |
|
53 |
* It does not use the same instances of the WMSLayerNode that LayerTreeModel |
|
54 |
* because it allows to repeat layers. So, each layer is a completely new |
|
55 |
* WMSLayerNode containing same properties but not the same parent (which is always |
|
56 |
* the tree root) and each style is a completely new FMapStyle containing same |
|
57 |
* properties but its parent is one of the layers of the StylesTree and not one |
|
58 |
* of those of the Layers tree. |
|
59 |
* </p> |
|
60 |
* |
|
61 |
* @author jaume dominguez faus |
|
62 |
* |
|
63 |
*/ |
|
64 |
public class StyleTree extends JTree { |
|
65 |
public boolean showLayerNames = false; |
|
66 |
public StyleTree(){ |
|
67 |
super(); |
|
68 |
initialize(); |
|
69 |
} |
|
70 |
|
|
71 |
private void initialize(){ |
|
72 |
setToggleClickCount(1); |
|
73 |
setRowHeight(22); |
|
74 |
|
|
75 |
setCellRenderer(new DefaultTreeCellRenderer() { |
|
76 |
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
77 |
if (leaf) { |
|
78 |
JPanel leafComponent = new JPanel(); |
|
79 |
leafComponent.setBackground(Color.WHITE); |
|
80 |
JRadioButton leafRadioButton = new JRadioButton("", ((StyleTreeModel) getModel()).isSelected((RemoteWMSStyle) value));//selected); |
|
81 |
leafRadioButton.setBackground(Color.WHITE); |
|
82 |
leafComponent.add(leafRadioButton); |
|
83 |
leafComponent.add(new JLabel(((RemoteWMSStyle) value).getTitle())); |
|
84 |
return leafComponent; |
|
85 |
} else { |
|
86 |
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); |
|
87 |
if (value instanceof WMSLayerNode) { |
|
88 |
WMSLayerNode layer = (WMSLayerNode) value; |
|
89 |
if (!showLayerNames) { |
|
90 |
if (layer.getName() != null || layer.getName() == "") { |
|
91 |
String text = layer.toString(); |
|
92 |
text = text.substring(text.indexOf(']')+2, text.length()); |
|
93 |
setText(text); |
|
94 |
} |
|
95 |
} |
|
96 |
} |
|
97 |
return this; |
|
98 |
} |
|
99 |
}}); |
|
100 |
addMouseListener(new java.awt.event.MouseAdapter() { |
|
101 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
|
102 |
((StyleTreeModel)getModel()).setSelectedLeaf(getSelectionPath()); |
|
103 |
clearSelection(); |
|
104 |
repaint(); |
|
105 |
} |
|
106 |
}); |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* Expands this tree. |
|
111 |
* |
|
112 |
*/ |
|
113 |
public void expandAll(){ |
|
114 |
int row = 0; |
|
115 |
while (row < getRowCount()) { |
|
116 |
expandRow(row); |
|
117 |
row++; |
|
118 |
} |
|
119 |
} |
|
120 |
/** |
|
121 |
* Returns a Vector of Strings containing the style titles. |
|
122 |
*/ |
|
123 |
public Vector getStyleSelectionTitles(){ |
|
124 |
if (getModel() instanceof StyleTreeModel) |
|
125 |
return ((StyleTreeModel)getModel()).getStyleSelectionTitles(); |
|
126 |
else |
|
127 |
return null; |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* Sets the selected styles in the StylesTree. The argument styleNames is |
|
132 |
* a Vector with exactly the same amount of strings than the amount of |
|
133 |
* themes (layers) contained by the tree. A blank or null string will |
|
134 |
* leave the default style for that layer, but this element <b>must exist</b> |
|
135 |
* in the array in any case. |
|
136 |
* |
|
137 |
* @param styleNames, Vector containing the style names. |
|
138 |
* The styles order <b>must match</b> with the layer order. |
|
139 |
*/ |
|
140 |
public void initSelections(Vector styleNames){ |
|
141 |
if (styleNames!=null) { |
|
142 |
StyleTreeModel model = (StyleTreeModel) getModel(); |
|
143 |
model.setStylesSelection(styleNames); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
} |
|
148 |
|
|
149 |
class StyleTreeModel implements TreeModel { |
|
150 |
private WMSLayerNode root; |
|
151 |
private ArrayList<WMSLayerNode> layers = new ArrayList<WMSLayerNode>(); |
|
152 |
|
|
153 |
public StyleTreeModel(WMSLayerNode root){ |
|
154 |
this.root = root; |
|
155 |
|
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Will return true if this style is selected. |
|
160 |
* @param style |
|
161 |
* @return |
|
162 |
*/ |
|
163 |
public boolean isSelected(RemoteWMSStyle style) { |
|
164 |
return style.getParent().getSelectedStyle().equals(style); |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* Gets the names of the selected styles into a Vector using the same order |
|
169 |
* as they was represented in the StylesTree. |
|
170 |
* @return |
|
171 |
*/ |
|
172 |
public Vector<String> getStyleSelectionTitles() { |
|
173 |
Vector<String> v = new Vector<String>(); |
|
174 |
for (int i = 0; i < layers.size(); i++) { |
|
175 |
WMSLayerNode layer = (WMSLayerNode) layers.get(i); |
|
176 |
RemoteWMSStyle sty = layer.getSelectedStyle(); |
|
177 |
if (sty == null) |
|
178 |
v.add(""); |
|
179 |
else |
|
180 |
v.add(sty.getTitle()); |
|
181 |
} |
|
182 |
return v; |
|
183 |
} |
|
184 |
|
|
185 |
/** |
|
186 |
* Sets the selected styles in the StylesTree. The argument styleNames is |
|
187 |
* a Vector with exactly the same amount of strings than the amount of |
|
188 |
* themes (layers) contained by the tree. A blank or null string will |
|
189 |
* leave the default style for that layer, but this element <b>must exist</b> |
|
190 |
* in the array in any case. |
|
191 |
* |
|
192 |
* @param styleNames, Vector containing the style names. |
|
193 |
* The styles order <b>must match</b> with the layer order. |
|
194 |
*/ |
|
195 |
public void setStylesSelection(Vector styleNames) { |
|
196 |
for (int i = 0; i < layers.size(); i++) { |
|
197 |
WMSLayerNode layer = (WMSLayerNode) layers.get(i); |
|
198 |
for (int j = 0; j < layer.getStyles().size(); j++) { |
|
199 |
RemoteWMSStyle sty = (RemoteWMSStyle) layer.getStyles().get(j); |
|
200 |
if ( sty.getName().equals((String) styleNames.get(i))) { |
|
201 |
layer.setSelectedStyleByIndex(j); |
|
202 |
} |
|
203 |
} |
|
204 |
} |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Adds a new branch to this tree. It must be a layer node. |
|
209 |
* @param node |
|
210 |
* @return <b>True</b>, if the added branch actually defines any style. |
|
211 |
* <b>False</b>, if the layer has no styles. |
|
212 |
*/ |
|
213 |
@SuppressWarnings("unchecked") |
|
214 |
public boolean addLayerBranch(WMSLayerNode node) { |
|
215 |
layers.add(node); |
|
216 |
if (node.getStyles()==null || node.getStyles().size()==0){ |
|
217 |
return false; |
|
218 |
} |
|
219 |
for (int i = 0; i < node.getStyles().size(); i++) { |
|
220 |
((RemoteWMSStyle) node.getStyles().get(i)).setParent(node); |
|
221 |
} |
|
222 |
((WMSLayerNode)getRoot()).getChildren().add(node); |
|
223 |
return true; |
|
224 |
} |
|
225 |
|
|
226 |
/** |
|
227 |
* Sets a leaf (an style) selected. |
|
228 |
* @param selectionPath to this leaf. |
|
229 |
*/ |
|
230 |
protected void setSelectedLeaf(TreePath selectionPath) { |
|
231 |
if (selectionPath!=null){ |
|
232 |
Object[] objects = selectionPath.getPath(); |
|
233 |
Object item = objects[objects.length-1]; |
|
234 |
if (isLeaf(item)){ |
|
235 |
RemoteWMSStyle style = (RemoteWMSStyle) item; |
|
236 |
WMSLayerNode layer = style.getParent() ; |
|
237 |
for (int i = 0; i < layer.getStyles().size(); i++) { |
|
238 |
RemoteWMSStyle sty = (RemoteWMSStyle) layer.getStyles().get(i); |
|
239 |
if (sty.getName().equals(style.getName())) { |
|
240 |
layer.setSelectedStyleByIndex(i); |
|
241 |
return; |
|
242 |
} |
|
243 |
} |
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
|
|
248 |
|
|
249 |
/* |
|
250 |
* (non-Javadoc) |
|
251 |
* @see javax.swing.tree.TreeModel#getRoot() |
|
252 |
*/ |
|
253 |
public Object getRoot() { |
|
254 |
if (root == null) { |
|
255 |
root = new WMSLayerNode(); |
|
256 |
root.setParent(null); |
|
257 |
} |
|
258 |
return root; |
|
259 |
} |
|
260 |
|
|
261 |
/* |
|
262 |
* (non-Javadoc) |
|
263 |
* @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object) |
|
264 |
*/ |
|
265 |
public int getChildCount(Object parent) { |
|
266 |
int count=0; |
|
267 |
|
|
268 |
if (parent == root) |
|
269 |
count = ((WMSLayerNode) parent).getChildren().size(); |
|
270 |
else |
|
271 |
count = ((WMSLayerNode) parent).getStyles().size(); |
|
272 |
return count; |
|
273 |
} |
|
274 |
|
|
275 |
/* |
|
276 |
* (non-Javadoc) |
|
277 |
* @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object) |
|
278 |
*/ |
|
279 |
public boolean isLeaf(Object node) { |
|
280 |
return (node instanceof RemoteWMSStyle); |
|
281 |
} |
|
282 |
|
|
283 |
/* |
|
284 |
* (non-Javadoc) |
|
285 |
* @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener) |
|
286 |
*/ |
|
287 |
public void addTreeModelListener(TreeModelListener l) { |
|
288 |
} |
|
289 |
|
|
290 |
/* |
|
291 |
* (non-Javadoc) |
|
292 |
* @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener) |
|
293 |
*/ |
|
294 |
public void removeTreeModelListener(TreeModelListener l) { |
|
295 |
} |
|
296 |
|
|
297 |
/* |
|
298 |
* (non-Javadoc) |
|
299 |
* @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int) |
|
300 |
*/ |
|
301 |
public Object getChild(Object parent, int index) { |
|
302 |
if (parent instanceof RemoteWMSStyle) |
|
303 |
return null; |
|
304 |
if (parent == root) |
|
305 |
return ((WMSLayerNode) parent).getChildren().get(index); |
|
306 |
|
|
307 |
return ((WMSLayerNode) parent).getStyles().get(index); |
|
308 |
} |
|
309 |
|
|
310 |
/* |
|
311 |
* (non-Javadoc) |
|
312 |
* @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object) |
|
313 |
*/ |
|
314 |
public int getIndexOfChild(Object parent, Object child) { |
|
315 |
if (parent instanceof RemoteWMSStyle) { |
|
316 |
return -1; |
|
317 |
} |
|
318 |
|
|
319 |
WMSLayerNode l = (WMSLayerNode)parent; |
|
320 |
if (l.getParent() == null){ |
|
321 |
for (int i = 0; i < l.getChildren().size(); i++) { |
|
322 |
if (l.getChildren().get(i).equals(child)){ |
|
323 |
return i; |
|
324 |
} |
|
325 |
} |
|
326 |
} else { |
|
327 |
for (int i = 0; i < l.getStyles().size(); i++) { |
|
328 |
if (l.getChildren().get(i).equals(child)){ |
|
329 |
return i; |
|
330 |
} |
|
331 |
} |
|
332 |
} |
|
333 |
return -1; |
|
334 |
} |
|
335 |
|
|
336 |
/* |
|
337 |
* (non-Javadoc) |
|
338 |
* @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object) |
|
339 |
*/ |
|
340 |
public void valueForPathChanged(TreePath path, Object newValue) { |
|
341 |
} |
|
342 |
} |
|
0 | 343 |
org.gvsig.raster.wms/tags/org.gvsig.raster.wms-2.2.154/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/gui/panel/WebMapContextSettingsPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.Component; |
|
26 |
import java.awt.Dimension; |
|
27 |
import java.awt.FlowLayout; |
|
28 |
import java.awt.geom.Rectangle2D; |
|
29 |
import java.io.File; |
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.prefs.Preferences; |
|
32 |
|
|
33 |
import javax.swing.ButtonGroup; |
|
34 |
import javax.swing.JButton; |
|
35 |
import javax.swing.JComboBox; |
|
36 |
import javax.swing.JLabel; |
|
37 |
import javax.swing.JOptionPane; |
|
38 |
import javax.swing.JPanel; |
|
39 |
import javax.swing.JRadioButton; |
|
40 |
import javax.swing.JScrollPane; |
|
41 |
import javax.swing.JTextArea; |
|
42 |
import javax.swing.JTextField; |
|
43 |
import javax.swing.SwingConstants; |
|
44 |
import javax.swing.filechooser.FileFilter; |
|
45 |
|
|
46 |
import org.gvsig.andami.PluginServices; |
|
47 |
import org.gvsig.andami.messages.NotificationManager; |
|
48 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
|
49 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
50 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
51 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
52 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
53 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
54 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
55 |
import org.gvsig.gui.beans.swing.JFileChooser; |
|
56 |
import org.gvsig.i18n.Messages; |
|
57 |
import org.gvsig.raster.wms.app.wmsclient.wmc.ExportWebMapContextExtension; |
|
58 |
import org.gvsig.raster.wms.app.wmsclient.wmc.ImportWebMapContextExtension; |
|
59 |
import org.gvsig.raster.wms.app.wmsclient.wmc.WebMapContext; |
|
60 |
import org.gvsig.raster.wms.app.wmsclient.wmc.WebMapContextTags; |
|
61 |
|
|
62 |
/** |
|
63 |
* A graphical form to fill up the customizable information of a destinantion |
|
64 |
* Web Map Context file. |
|
65 |
* |
|
66 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
67 |
* |
|
68 |
*/ |
|
69 |
public class WebMapContextSettingsPanel extends JPanel implements SingletonWindow { |
|
70 |
private static final long serialVersionUID = 1L; |
|
71 |
public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.mapcontext-settingspanel" ); |
|
72 |
private JPanel simplePanel = null; |
|
73 |
private JPanel advancedPanel = null; |
|
74 |
private JPanel buttonsPanel = null; |
|
75 |
private JComboBox cmbVersion = null; |
|
76 |
private JLabel lblTitle = null; |
|
77 |
private JButton btnBrowseFileSystem = null; |
|
78 |
private JTextField txtTitle = null; |
|
79 |
private JLabel lblVersion = null; |
|
80 |
private JLabel lblId = null; |
|
81 |
private JTextField txtId = null; |
|
82 |
private JLabel lblFile = null; |
|
83 |
private JTextField txtFile = null; |
|
84 |
private JButton btnAdvanced = null; |
|
85 |
private JButton btnOk = null; |
|
86 |
private JButton btnCancel = null; |
|
87 |
private JLabel lblAbstract = null; |
|
88 |
private JLabel lblLogoURL = null; |
|
89 |
private JLabel lblDescriptionURL = null; |
|
90 |
private JTextArea txtAbstract = null; |
|
91 |
private JScrollPane scrlAbstract = null; |
|
92 |
private JTextField txtLogoURL = null; |
|
93 |
private JTextField txtDescriptionURL = null; |
|
94 |
private JPanel pnlMapSize = null; |
|
95 |
private JRadioButton rdBtnUseViewSize = null; |
|
96 |
private JRadioButton rdBtnCustomSize = null; |
|
97 |
private JLabel lblWidth = null; |
|
98 |
private JLabel lblHeight = null; |
|
99 |
private JTextField txtWidth = null; |
|
100 |
private JTextField txtHeight = null; |
|
101 |
private JPanel pnlContactInfo = null; |
|
102 |
private JTextField txtKeyWords = null; |
|
103 |
private JLabel lblKeyWords = null; |
|
104 |
private JLabel lblContactPerson = null; |
|
105 |
private JTextField txtContactPerson = null; |
|
106 |
private JLabel lblContactOrganization = null; |
|
107 |
private JTextField txtOrganization = null; |
|
108 |
private JLabel lblContactPosition = null; |
|
109 |
private JTextField txtContactPosition = null; |
|
110 |
private JLabel lblAddress = null; |
|
111 |
private JTextField txtAddress = null; |
|
112 |
private JLabel lblCity = null; |
|
113 |
private JTextField txtCity = null; |
|
114 |
private JLabel lblStateProvince = null; |
|
115 |
private JTextField txtStateOrProvince = null; |
|
116 |
private JLabel lblPostCode = null; |
|
117 |
private JTextField txtPostCode = null; |
|
118 |
private JLabel lblCountry = null; |
|
119 |
private JComboBox cmbCountries = null; |
|
120 |
private JLabel lblPhone = null; |
|
121 |
private JTextField txtTelephone = null; |
|
122 |
private JLabel lblFax = null; |
|
123 |
private JTextField txtFax = null; |
|
124 |
private JLabel lblEMail = null; |
|
125 |
private JTextField txtEMail = null; |
|
126 |
private boolean first = true; |
|
127 |
private boolean advanced = fPrefs.getBoolean("advanced-panel", false); |
|
128 |
private WindowInfo m_viewInfo; |
|
129 |
private String strAdvanced = Messages.getText("advanced"); |
|
130 |
private File targetFile; |
|
131 |
private WebMapContext wmc; |
|
132 |
private DefaultViewDocument[] exportableViews; |
|
133 |
private JLabel lblView = null; |
|
134 |
private JComboBox cmbViews = null; |
|
135 |
private String lastWidth, lastHeight; |
|
136 |
private int defaultWidth = 500; |
|
137 |
private int defaultHeight = 450; |
|
138 |
private JLabel lblExtent = null; |
|
139 |
private JRadioButton rdBtnCurrentViewExtent = null; |
|
140 |
private JRadioButton rdBtnFullExtent = null; |
|
141 |
private static String lastPath = null; |
|
142 |
|
|
143 |
protected boolean useFullExtent = fPrefs.getBoolean("use_full_extent", false); |
|
144 |
|
|
145 |
public WebMapContextSettingsPanel(DefaultViewDocument[] views) { |
|
146 |
super(); |
|
147 |
exportableViews = views; |
|
148 |
initialize(); |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* This method initializes this |
|
153 |
* |
|
154 |
* @return void |
|
155 |
*/ |
|
156 |
private void initialize() { |
|
157 |
this.setLayout(null); |
|
158 |
|
|
159 |
switchPanels(); |
|
160 |
} |
|
161 |
|
|
162 |
private void switchPanels() { |
|
163 |
this.removeAll(); |
|
164 |
Dimension sz; |
|
165 |
this.add(getSimplePanel(), java.awt.BorderLayout.NORTH); |
|
166 |
if (advanced) { |
|
167 |
this.add(getAdvancedPanel(), java.awt.BorderLayout.CENTER); |
|
168 |
sz = new Dimension(535, 640); |
|
169 |
btnAdvanced.setText(strAdvanced+" <<"); |
|
170 |
|
|
171 |
} else { |
|
172 |
sz = new Dimension(535, 260); |
|
173 |
btnAdvanced.setText(strAdvanced+" >>"); |
|
174 |
|
|
175 |
} |
|
176 |
|
|
177 |
this.setSize(sz); |
|
178 |
|
|
179 |
|
|
180 |
this.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH); |
|
181 |
fPrefs.putBoolean("advanced-panel", advanced); |
|
182 |
if (!first) { |
|
183 |
PluginServices.getMDIManager().changeWindowInfo(this, getWindowInfo()); |
|
184 |
|
|
185 |
PluginServices.getMDIManager().closeWindow(this); |
|
186 |
PluginServices.getMDIManager().addWindow(this); |
|
187 |
} |
|
188 |
first = false; |
|
189 |
} |
|
190 |
|
|
191 |
public WindowInfo getWindowInfo() { |
|
192 |
|
|
193 |
m_viewInfo = new WindowInfo(WindowInfo.ICONIFIABLE); |
|
194 |
m_viewInfo.setTitle(Messages.getText("web_map_context_settings")); |
|
195 |
m_viewInfo.setWidth(this.getWidth()+8); |
|
196 |
m_viewInfo.setHeight(getHeight()); |
|
197 |
return m_viewInfo; |
|
198 |
} |
|
199 |
|
|
200 |
/** |
|
201 |
* This method initializes simplePanel |
|
202 |
* |
|
203 |
* @return javax.swing.JPanel |
|
204 |
*/ |
|
205 |
private JPanel getSimplePanel() { |
|
206 |
if (simplePanel == null) { |
|
207 |
ButtonGroup group = new ButtonGroup(); |
|
208 |
lblExtent = new JLabel(); |
|
209 |
lblExtent.setBounds(9, 146, 79, 20); |
|
210 |
lblExtent.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
211 |
lblExtent.setHorizontalAlignment(SwingConstants.RIGHT); |
|
212 |
lblExtent.setText(Messages.getText("map_extent")+":"); |
|
213 |
lblView = new JLabel(); |
|
214 |
lblView.setBounds(9, 24, 79, 20); |
|
215 |
lblView.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
216 |
lblView.setHorizontalAlignment(SwingConstants.RIGHT); |
|
217 |
lblView.setText(Messages.getText(ViewManager.TYPENAME)+":"); |
|
218 |
lblTitle = new JLabel(); |
|
219 |
lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
220 |
lblTitle.setBounds(9, 48, 79, 20); |
|
221 |
lblTitle.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
222 |
lblTitle.setText(Messages.getText("title")+":"); |
|
223 |
lblId = new JLabel(); |
|
224 |
lblId.setBounds(9, 72, 79, 20); |
|
225 |
lblId.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
226 |
lblId.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
227 |
lblId.setText(Messages.getText("id")+":"); |
|
228 |
lblVersion = new JLabel(); |
|
229 |
lblVersion.setBounds(9, 120, 79, 20); |
|
230 |
lblVersion.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
231 |
lblVersion.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
232 |
lblVersion.setText(Messages.getText("version")+":"); |
|
233 |
lblFile = new JLabel(); |
|
234 |
lblFile.setBounds(9, 96, 79, 20); |
|
235 |
lblFile.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
236 |
lblFile.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
237 |
lblFile.setText(Messages.getText("file_name")+":"); |
|
238 |
simplePanel = new JPanel(); |
|
239 |
simplePanel.setLayout(null); |
|
240 |
simplePanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
241 |
null, Messages.getText("options"), |
|
242 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
243 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
244 |
simplePanel.setBounds(new java.awt.Rectangle(0,0,535,196)); |
|
245 |
simplePanel.add(lblView, null); |
|
246 |
simplePanel.add(getCmbViews(), null); |
|
247 |
simplePanel.add(getTxtTitle(), null); |
|
248 |
simplePanel.add(lblTitle, null); |
|
249 |
simplePanel.add(getBtnBrowseFileSystem(), null); |
|
250 |
simplePanel.add(lblVersion, null); |
|
251 |
simplePanel.add(lblId, null); |
|
252 |
simplePanel.add(getTxtId(), null); |
|
253 |
simplePanel.add(lblFile, null); |
|
254 |
simplePanel.add(getTxtFile(), null); |
|
255 |
simplePanel.add(getBtnAdvanced(), null); |
|
256 |
simplePanel.add(getCmbVersion(), null); |
|
257 |
simplePanel.add(lblExtent, null); |
|
258 |
simplePanel.add(getRdBtnCurrentViewExtent(), null); |
|
259 |
simplePanel.add(getRdBtnFullExtent(), null); |
|
260 |
group.add(getRdBtnCurrentViewExtent()); |
|
261 |
group.add(getRdBtnFullExtent()); |
|
262 |
} |
|
263 |
return simplePanel; |
|
264 |
} |
|
265 |
|
|
266 |
/** |
|
267 |
* This method initializes advancedPanel |
|
268 |
* |
|
269 |
* @return javax.swing.JPanel |
|
270 |
*/ |
|
271 |
private JPanel getAdvancedPanel() { |
|
272 |
if (advancedPanel == null) { |
|
273 |
lblKeyWords = new JLabel(); |
|
274 |
lblKeyWords.setBounds(10, 79, 99, 20); |
|
275 |
lblKeyWords.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
276 |
lblKeyWords.setHorizontalAlignment(SwingConstants.RIGHT); |
|
277 |
lblKeyWords.setText(Messages.getText("keywords")+":"); |
|
278 |
lblDescriptionURL = new JLabel(); |
|
279 |
lblDescriptionURL.setBounds(10, 104, 99, 20); |
|
280 |
lblDescriptionURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
281 |
lblDescriptionURL.setText(Messages.getText("description_URL")+":"); |
|
282 |
lblDescriptionURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
283 |
lblLogoURL = new JLabel(); |
|
284 |
lblLogoURL.setBounds(10, 130, 99, 20); |
|
285 |
lblLogoURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
286 |
lblLogoURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
287 |
lblLogoURL.setText(Messages.getText( "logo_URL")+":"); |
|
288 |
lblAbstract = new JLabel(); |
|
289 |
lblAbstract.setText(Messages.getText("abstract")+":"); |
|
290 |
lblAbstract.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
291 |
lblAbstract.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
292 |
lblAbstract.setBounds(10, 27, 99, 20); |
|
293 |
advancedPanel = new JPanel(); |
|
294 |
advancedPanel.setLayout(null); |
|
295 |
advancedPanel.setBounds(0, 194, 535, 386); |
|
296 |
advancedPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
297 |
null, Messages.getText("advanced_settings"), |
|
298 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
299 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
300 |
advancedPanel.add(lblAbstract, null); |
|
301 |
advancedPanel.add(lblKeyWords, null); |
|
302 |
advancedPanel.add(lblLogoURL, null); |
|
303 |
advancedPanel.add(lblDescriptionURL, null); |
|
304 |
advancedPanel.add(getScrlAbstract(), null); |
|
305 |
advancedPanel.add(getTxtLogoURL(), null); |
|
306 |
advancedPanel.add(getTxtDescriptionURL(), null); |
|
307 |
advancedPanel.add(getPnlMapSize(), null); |
|
308 |
advancedPanel.add(getPnlContactInfo(), null); |
|
309 |
advancedPanel.add(getTxtKeyWords(), null); |
|
310 |
} |
|
311 |
return advancedPanel; |
|
312 |
} |
|
313 |
|
|
314 |
/** |
|
315 |
* This method initializes buttonsPanel |
|
316 |
* |
|
317 |
* @return javax.swing.JPanel |
|
318 |
*/ |
|
319 |
private JPanel getButtonsPanel() { |
|
320 |
if (buttonsPanel == null) { |
|
321 |
FlowLayout flowLayout = new FlowLayout(); |
|
322 |
flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); |
|
323 |
flowLayout.setVgap(1); |
|
324 |
buttonsPanel = new JPanel(); |
|
325 |
buttonsPanel.setLayout(flowLayout); |
|
326 |
buttonsPanel.add(getBtnOk(), null); |
|
327 |
buttonsPanel.add(getBtnCancel(), null); |
|
328 |
} |
|
329 |
buttonsPanel.setBounds(0, this.getHeight()-60, 535, 38); |
|
330 |
|
|
331 |
return buttonsPanel; |
|
332 |
} |
|
333 |
|
|
334 |
/** |
|
335 |
* This method initializes cmbVersion |
|
336 |
* |
|
337 |
* @return javax.swing.JComboBox |
|
338 |
*/ |
|
339 |
private JComboBox getCmbVersion() { |
|
340 |
if (cmbVersion == null) { |
|
341 |
cmbVersion = new JComboBox(); |
|
342 |
cmbVersion.setSize(89, 20); |
|
343 |
cmbVersion.setLocation(91, 120); |
|
344 |
for (int i = 0; i < WebMapContext.exportVersions.size(); i++) { |
|
345 |
cmbVersion.addItem(WebMapContext.exportVersions.get(i)); |
|
346 |
} |
|
347 |
|
|
348 |
} |
|
349 |
return cmbVersion; |
|
350 |
} |
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
/** |
|
355 |
* This method initializes btnBrowseFileSystem |
|
356 |
* |
|
357 |
* @return javax.swing.JButton |
|
358 |
*/ |
|
359 |
private JButton getBtnBrowseFileSystem() { |
|
360 |
if (btnBrowseFileSystem == null) { |
|
361 |
btnBrowseFileSystem = new JButton(); |
|
362 |
btnBrowseFileSystem.setBounds(403, 95, 120, 22); |
|
363 |
btnBrowseFileSystem.addActionListener(new java.awt.event.ActionListener() { |
|
364 |
|
|
365 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
366 |
JFileChooser fc = new JFileChooser(ImportWebMapContextExtension.WMC_FILECHOOSER_ID, lastPath); |
|
367 |
fc.setFileFilter(new FileFilter() { |
|
368 |
public boolean accept(File f) { |
|
369 |
return f.isDirectory() || f.getAbsolutePath().toLowerCase().endsWith(WebMapContext.FILE_EXTENSION); |
|
370 |
} |
|
371 |
|
|
372 |
public String getDescription() { |
|
373 |
return Messages.getText("ogc_mapcontext_file")+" (*.cml)"; |
|
374 |
} |
|
375 |
}); |
|
376 |
if (fc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION){ |
|
377 |
|
|
378 |
String fileName = fc.getSelectedFile().getAbsolutePath(); |
|
379 |
if (!fileName.toLowerCase().endsWith(WebMapContext.FILE_EXTENSION)) { |
|
380 |
fileName += WebMapContext.FILE_EXTENSION; |
|
381 |
} |
|
382 |
targetFile = new File(fileName); |
|
383 |
getTxtFile().setText(fileName); |
|
384 |
lastPath = fileName.substring(0, fileName.lastIndexOf(File.separatorChar)); |
|
385 |
} |
|
386 |
|
|
387 |
fc = null; |
|
388 |
} |
|
389 |
}); |
|
390 |
btnBrowseFileSystem.setText(Messages.getText("browse")); |
|
391 |
} |
|
392 |
return btnBrowseFileSystem; |
|
393 |
} |
|
394 |
|
|
395 |
/** |
|
396 |
* This method initializes txtTitle |
|
397 |
* |
|
398 |
* @return javax.swing.JTextField |
|
399 |
*/ |
|
400 |
private JTextField getTxtTitle() { |
|
401 |
if (txtTitle == null) { |
|
402 |
txtTitle = new JTextField(); |
|
403 |
txtTitle.setBounds(91, 48, 432, 20); |
|
404 |
txtTitle.setName(Messages.getText("title")); |
|
405 |
} |
|
406 |
return txtTitle; |
|
407 |
} |
|
408 |
|
|
409 |
/** |
|
410 |
* This method initializes jTextField |
|
411 |
* |
|
412 |
* @return javax.swing.JTextField |
|
413 |
*/ |
|
414 |
private JTextField getTxtId() { |
|
415 |
if (txtId == null) { |
|
416 |
txtId = new JTextField(); |
|
417 |
txtId.setBounds(91, 72, 432, 20); |
|
418 |
txtId.setName(Messages.getText("id")); |
|
419 |
} |
|
420 |
return txtId; |
|
421 |
} |
|
422 |
|
|
423 |
/** |
|
424 |
* This method initializes txtFile |
|
425 |
* |
|
426 |
* @return javax.swing.JTextField |
|
427 |
*/ |
|
428 |
private JTextField getTxtFile() { |
|
429 |
if (txtFile == null) { |
|
430 |
txtFile = new JTextField(); |
|
431 |
txtFile.setBounds(91, 96, 308, 20); |
|
432 |
} |
|
433 |
return txtFile; |
|
434 |
} |
|
435 |
|
|
436 |
/** |
|
437 |
* This method initializes btnAdvanced |
|
438 |
* |
|
439 |
* @return javax.swing.JButton |
|
440 |
*/ |
|
441 |
private JButton getBtnAdvanced() { |
|
442 |
if (btnAdvanced == null) { |
|
443 |
btnAdvanced = new JButton(); |
|
444 |
// btnAdvanced.setBounds(403, 160, 120, 25); |
|
445 |
btnAdvanced.setLocation(403, 160); |
|
446 |
btnAdvanced.addActionListener(new java.awt.event.ActionListener() { |
|
447 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
448 |
advanced = !advanced; |
|
449 |
switchPanels(); |
|
450 |
} |
|
451 |
}); |
|
452 |
} |
|
453 |
return btnAdvanced; |
|
454 |
} |
|
455 |
|
|
456 |
/** |
|
457 |
* This method initializes btnAceptar |
|
458 |
* |
|
459 |
* @return javax.swing.JButton |
|
460 |
*/ |
|
461 |
private JButton getBtnOk() { |
|
462 |
if (btnOk == null) { |
|
463 |
btnOk = new JButton(); |
|
464 |
btnOk.setText(Messages.getText("Ok")); |
|
465 |
btnOk.addActionListener(new java.awt.event.ActionListener() { |
|
466 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
467 |
execute("OK"); |
|
468 |
} |
|
469 |
}); |
|
470 |
} |
|
471 |
return btnOk; |
|
472 |
} |
|
473 |
|
|
474 |
/** |
|
475 |
* This method initializes btnCancel |
|
476 |
* |
|
477 |
* @return javax.swing.JButton |
|
478 |
*/ |
|
479 |
private JButton getBtnCancel() { |
|
480 |
if (btnCancel == null) { |
|
481 |
btnCancel = new JButton(); |
|
482 |
btnCancel.setText(Messages.getText("cancel")); |
|
483 |
btnCancel.addActionListener(new java.awt.event.ActionListener() { |
|
484 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
485 |
execute("CANCEL"); |
|
486 |
} |
|
487 |
}); |
|
488 |
} |
|
489 |
return btnCancel; |
|
490 |
} |
|
491 |
|
|
492 |
/** |
|
493 |
* This method initializes txtAbstract |
|
494 |
* |
|
495 |
* @return javax.swing.JTextArea |
|
496 |
*/ |
|
497 |
private JTextArea getTxtAbstract() { |
|
498 |
if (txtAbstract == null) { |
|
499 |
txtAbstract = new JTextArea(); |
|
500 |
} |
|
501 |
return txtAbstract; |
|
502 |
} |
|
503 |
|
|
504 |
/** |
|
505 |
* This method initializes scrlAbstract |
|
506 |
* |
|
507 |
* @return javax.swing.JScrollPane |
Also available in: Unified diff