Revision 7319
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/buildNumber.properties | ||
---|---|---|
1 |
#Fri Jun 23 02:24:31 CEST 2017 |
|
2 |
buildNumber=105 |
|
0 | 3 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.wcs.io:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.wcs.remoteclient:jar</include> |
|
34 |
</includes> |
|
35 |
</dependencySet> |
|
36 |
</dependencySets> |
|
37 |
</assembly> |
|
0 | 38 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/dialog/WCSPropsDialog.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.wcs.app.wcsclient.gui.dialog; |
|
24 |
|
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
import java.util.HashMap; |
|
28 |
|
|
29 |
import javax.swing.JButton; |
|
30 |
import javax.swing.JDialog; |
|
31 |
import javax.swing.JOptionPane; |
|
32 |
import javax.swing.JPanel; |
|
33 |
|
|
34 |
import org.gvsig.andami.PluginServices; |
|
35 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
36 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
37 |
import org.gvsig.app.gui.wizards.WizardListener; |
|
38 |
import org.gvsig.app.gui.wizards.WizardListenerSupport; |
|
39 |
import org.gvsig.fmap.dal.coverage.exception.ConnectException; |
|
40 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
42 |
import org.gvsig.fmap.mapcontext.exceptions.ConnectionErrorLayerException; |
|
43 |
import org.gvsig.fmap.mapcontext.exceptions.DriverLayerException; |
|
44 |
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException; |
|
45 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
46 |
import org.gvsig.fmap.mapcontext.exceptions.NameLayerException; |
|
47 |
import org.gvsig.fmap.mapcontext.exceptions.ProjectionLayerException; |
|
48 |
import org.gvsig.fmap.mapcontext.exceptions.TypeLayerException; |
|
49 |
import org.gvsig.fmap.mapcontext.exceptions.URLLayerException; |
|
50 |
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException; |
|
51 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
52 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
53 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
54 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
55 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
56 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
57 |
import org.gvsig.raster.wcs.app.wcsclient.gui.panel.WCSParamsPanel; |
|
58 |
import org.gvsig.raster.wcs.app.wcsclient.layer.FLyrWCS; |
|
59 |
import org.gvsig.raster.wcs.io.WCSServerExplorer; |
|
60 |
import org.slf4j.Logger; |
|
61 |
import org.slf4j.LoggerFactory; |
|
62 |
|
|
63 |
|
|
64 |
/** |
|
65 |
* The TOC WCS properties panel container. |
|
66 |
* |
|
67 |
* @author jaume - jaume.dominguez@iver.es |
|
68 |
* |
|
69 |
*/ |
|
70 |
public class WCSPropsDialog extends JPanel implements IWindow { |
|
71 |
|
|
72 |
private static final long serialVersionUID = 1L; |
|
73 |
JDialog dlg = null; |
|
74 |
private JPanel buttonsPanel = null; |
|
75 |
private FLyrRaster fLayer = null; |
|
76 |
boolean applied = false;; |
|
77 |
private WindowInfo m_ViewInfo = null; |
|
78 |
|
|
79 |
private JButton btnApply = null; |
|
80 |
private JButton btnOk = null; |
|
81 |
private JButton btnCancel = null; |
|
82 |
private WCSParamsPanel wcsParamsTabbedPane; |
|
83 |
private CommandListener m_actionListener; |
|
84 |
private WCSServerExplorer explorer = null; |
|
85 |
private Logger logger = LoggerFactory.getLogger(WCSPropsDialog.class); |
|
86 |
|
|
87 |
public WCSPropsDialog(FLayer layer) { |
|
88 |
super(); |
|
89 |
if(layer instanceof FLyrRaster) |
|
90 |
initialize((FLyrRaster)layer); |
|
91 |
} |
|
92 |
|
|
93 |
|
|
94 |
private void initialize(FLyrRaster layer) { |
|
95 |
setLayout(null); |
|
96 |
|
|
97 |
setFLayer(layer); |
|
98 |
wcsParamsTabbedPane = getParamsPanel(((FLyrWCS) layer).getProperties()); |
|
99 |
wcsParamsTabbedPane.addWizardListener(new WizardListener() { |
|
100 |
public void wizardStateChanged(boolean finishable) { |
|
101 |
getBtnOk().setEnabled(finishable); |
|
102 |
getBtnApply().setEnabled(finishable); |
|
103 |
} |
|
104 |
|
|
105 |
public void error(Exception e) { |
|
106 |
} |
|
107 |
|
|
108 |
}) ; |
|
109 |
this.add(wcsParamsTabbedPane); |
|
110 |
this.add(getButtonsPanel(), null); |
|
111 |
|
|
112 |
} |
|
113 |
|
|
114 |
|
|
115 |
public void setFLayer(FLyrRaster f) { |
|
116 |
fLayer = f; |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* With getParamsPanel we have access to the map config TabbedPane. |
|
121 |
* If this panel doesn't exist yet (which can occur when an existing project is |
|
122 |
* recovered) it is been automatically constructed by connecting to the server, |
|
123 |
* reloading the necessary data, filling up the content and setting the selected |
|
124 |
* values that were selected when the projet was saved. |
|
125 |
* |
|
126 |
* |
|
127 |
* Since a connection to the server is needed when rebuiliding the panel, this |
|
128 |
* causes a delay for the panel's showing up or a nullPointer error if there is |
|
129 |
* no path to the server. |
|
130 |
* |
|
131 |
* |
|
132 |
* Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n |
|
133 |
* del mapa. Si este panel todav?a no existe (como puede ser cuando |
|
134 |
* recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando |
|
135 |
* al servidor, recuperando los datos necesarios, rellenando el contenido y |
|
136 |
* dejando seleccionados los valores que estaban seleccionados cuando se |
|
137 |
* guarda el proyecto. |
|
138 |
* |
|
139 |
* |
|
140 |
* Como para reconstruirse requiere una conexi?n con el servidor esto causa |
|
141 |
* un retardo en la aparici?n en el toc o un error de nullPointer si no |
|
142 |
* hay conexi?n hasta el servidor. |
|
143 |
* |
|
144 |
* |
|
145 |
* @return WCSParamsPanel |
|
146 |
*/ |
|
147 |
public WCSParamsPanel getParamsPanel(HashMap info) { |
|
148 |
if (info != null) { |
|
149 |
try { |
|
150 |
if(explorer == null) { |
|
151 |
explorer = ((FLyrWCS)fLayer).getExplorer(); |
|
152 |
|
|
153 |
try { |
|
154 |
explorer.connect(new CancelTaskImpl()); |
|
155 |
} catch (ConnectException e) { |
|
156 |
RasterSwingLibrary.messageBoxError("The connection cannot be established", this, e); |
|
157 |
return null; |
|
158 |
} |
|
159 |
} |
|
160 |
} catch (Exception e) { |
|
161 |
explorer = null; |
|
162 |
JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE); |
|
163 |
} |
|
164 |
try { |
|
165 |
|
|
166 |
WCSParamsPanel toc = new WCSParamsPanel(); |
|
167 |
toc.setVisible(true); |
|
168 |
toc.setListenerSupport(new WizardListenerSupport()); |
|
169 |
toc.setWizardData(explorer); |
|
170 |
|
|
171 |
toc.getLayerPanel().getLstCoverages().setListData(explorer.getCoverageList()); |
|
172 |
|
|
173 |
String coverageName = (String) info.get("name"); |
|
174 |
int index = toc.getLayerPanel().getCoverageIndex( coverageName ); |
|
175 |
if (index != -1) { |
|
176 |
toc.getLayerPanel().getLstCoverages().setSelectedIndex(index); |
|
177 |
} |
|
178 |
|
|
179 |
toc.refreshData(((FLyrWCS)fLayer).getParameters()); |
|
180 |
|
|
181 |
index = toc.getFormatsPanel().getSRSIndex((String) info.get("crs") ); |
|
182 |
if (index != -1) { |
|
183 |
toc.getFormatsPanel().getLstCRSs().setSelectedIndex(index); |
|
184 |
} |
|
185 |
index = toc.getFormatsPanel().getFormatIndex((String) info.get("format")); |
|
186 |
if (index != -1) { |
|
187 |
toc.getFormatsPanel().getLstFormats().setSelectedIndex(index); |
|
188 |
} |
|
189 |
String time = (String) info.get("time"); |
|
190 |
if (time != null && !time.equals("")) { |
|
191 |
toc.getTimePanel().getLstSelectedTimes().setListData(time.split(",")); |
|
192 |
} |
|
193 |
String parameter = (String) info.get("parameter"); |
|
194 |
if (parameter != null && !parameter.equals("")){ |
|
195 |
String[] s = parameter.split("="); |
|
196 |
String pName = s[0]; |
|
197 |
|
|
198 |
String regexDouble = "-?[0-9]+(\\.[0-9]+)?"; |
|
199 |
String regexInterval = regexDouble+"/"+regexDouble; |
|
200 |
String regexIntervalList = regexInterval+"(,"+regexInterval+")*"; |
|
201 |
if (s[1].matches(regexInterval)){ |
|
202 |
// Single Interval |
|
203 |
toc.getParameterPanel().getJScrollPane5().setVisible(false); |
|
204 |
toc.getParameterPanel().getSingleParamValuesList().setEnabled(false); |
|
205 |
|
|
206 |
|
|
207 |
} else if (s[1].matches(regexIntervalList)){ |
|
208 |
// Multiple Interval |
|
209 |
|
|
210 |
} else { |
|
211 |
// Single values |
|
212 |
toc.getParameterPanel().getJScrollPane5().setVisible(true); |
|
213 |
toc.getParameterPanel().getSingleParamValuesList().setEnabled(true); |
|
214 |
|
|
215 |
String[] pVals = s[1].split(","); |
|
216 |
index = toc.getParameterPanel().getParamIndex(pName); |
|
217 |
toc.getParameterPanel().getCmbParam().setSelectedIndex(index); |
|
218 |
//toc.refreshParamValues( coverageName ); |
|
219 |
int[] indexes = new int[pVals.length]; |
|
220 |
for (int i = 0; i < pVals.length; i++) { |
|
221 |
indexes[i] = toc.getParameterPanel().getValueIndex(pVals[i]); |
|
222 |
} |
|
223 |
|
|
224 |
toc.getParameterPanel().getSingleParamValuesList().setSelectedIndices(indexes); |
|
225 |
} |
|
226 |
} |
|
227 |
toc.refreshInfo(); |
|
228 |
return toc; |
|
229 |
} catch (Exception e) { |
|
230 |
JOptionPane.showMessageDialog(null, "servidor_wcs_no_responde", "Error", JOptionPane.ERROR_MESSAGE); |
|
231 |
e.printStackTrace(); |
|
232 |
} |
|
233 |
} |
|
234 |
return null; |
|
235 |
} |
|
236 |
|
|
237 |
public JPanel getButtonsPanel() { |
|
238 |
if (buttonsPanel == null) { |
|
239 |
m_actionListener = new CommandListener(this); |
|
240 |
buttonsPanel = new JPanel(); |
|
241 |
buttonsPanel.setBounds(5, wcsParamsTabbedPane.getHeight(), 471, 40); |
|
242 |
buttonsPanel.setLayout(null); |
|
243 |
buttonsPanel.setName("buttonPanel"); |
|
244 |
|
|
245 |
buttonsPanel.add(getBtnOk(), null); |
|
246 |
buttonsPanel.add(getBtnApply(), null); |
|
247 |
buttonsPanel.add(getBtnCancel(), null); |
|
248 |
} |
|
249 |
return buttonsPanel; |
|
250 |
} |
|
251 |
|
|
252 |
public JButton getBtnOk() { |
|
253 |
if (btnOk == null) { |
|
254 |
btnOk = new JButton("ok"); |
|
255 |
btnOk.setText(PluginServices.getText(this,"ok")); |
|
256 |
btnOk.setActionCommand("OK"); |
|
257 |
btnOk.addActionListener(m_actionListener); |
|
258 |
btnOk.setBounds(367, 9, 90, 25); |
|
259 |
} |
|
260 |
return btnOk; |
|
261 |
} |
|
262 |
|
|
263 |
public JButton getBtnApply() { |
|
264 |
if (btnApply == null) { |
|
265 |
btnApply = new JButton("apply"); |
|
266 |
btnApply.setText(PluginServices.getText(this,"apply")); |
|
267 |
btnApply.setEnabled(false); |
|
268 |
btnApply.setActionCommand("APPLY"); |
|
269 |
btnApply.addActionListener(m_actionListener); |
|
270 |
btnApply.setBounds(267, 9, 90, 25); |
|
271 |
} |
|
272 |
return btnApply; |
|
273 |
} |
|
274 |
|
|
275 |
public JButton getBtnCancel() { |
|
276 |
if (btnCancel == null) { |
|
277 |
btnCancel = new JButton("cancel"); |
|
278 |
btnCancel.setText(PluginServices.getText(this,"cancel")); |
|
279 |
btnCancel.setActionCommand("CANCEL"); |
|
280 |
btnCancel.addActionListener(m_actionListener); |
|
281 |
btnCancel.setBounds(137, 9, 90, 25); |
|
282 |
} |
|
283 |
return btnCancel; |
|
284 |
} |
|
285 |
|
|
286 |
private class CommandListener implements ActionListener { |
|
287 |
|
|
288 |
/** |
|
289 |
* Creates a new ComandosListener object. |
|
290 |
* |
|
291 |
* @param lg DOCUMENT ME! |
|
292 |
*/ |
|
293 |
public CommandListener(WCSPropsDialog tp) { |
|
294 |
//m_tp = tp; |
|
295 |
} |
|
296 |
|
|
297 |
/* (non-Javadoc) |
|
298 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
299 |
*/ |
|
300 |
public void actionPerformed(ActionEvent e) { |
|
301 |
if (e.getActionCommand() == "CANCEL") { |
|
302 |
close(); |
|
303 |
} else { |
|
304 |
((FLyrWCS) fLayer).getParameters().setFormat(wcsParamsTabbedPane.getFormat()); |
|
305 |
try { |
|
306 |
((FLyrWCS) fLayer).getParameters().setSRS(wcsParamsTabbedPane.getSRS()); |
|
307 |
((FLyrWCS) fLayer).getParameters().setCoverageName(wcsParamsTabbedPane.getLayerPanel().getSelectedCoverageName()); |
|
308 |
|
|
309 |
//fLayer = wcsParamsTabbedPane.getLayer(); |
|
310 |
FLayers parent = ((FLayer)fLayer).getParentLayer(); |
|
311 |
|
|
312 |
MapControl mapCtrl = null; |
|
313 |
|
|
314 |
IWindow[] w = PluginServices.getMDIManager().getAllWindows(); |
|
315 |
for (int i = 0; i < w.length; i++) { |
|
316 |
if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) { |
|
317 |
MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext(); |
|
318 |
if(mapContext == fLayer.getMapContext()) |
|
319 |
mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl(); |
|
320 |
} |
|
321 |
} |
|
322 |
|
|
323 |
if (parent != null) { |
|
324 |
FLayer layer = wcsParamsTabbedPane.getLayer(); |
|
325 |
if(layer == null) |
|
326 |
return; |
|
327 |
mapCtrl.getMapContext().getLayers(). |
|
328 |
replaceLayer(fLayer.getName(), layer); |
|
329 |
} else { |
|
330 |
mapCtrl.getMapContext().getLayers().replaceLayer(fLayer.getName(), wcsParamsTabbedPane.getLayer()); |
|
331 |
} |
|
332 |
//mapCtrl.getMapContext().getLayers().addLayer( fLayer ); |
|
333 |
mapCtrl.getMapContext().invalidate(); |
|
334 |
applied = true; |
|
335 |
getBtnApply().setEnabled(!applied); |
|
336 |
|
|
337 |
if (e.getActionCommand() == "OK") { |
|
338 |
close(); |
|
339 |
} |
|
340 |
} catch (ConnectionErrorLayerException e1) { |
|
341 |
logger.info("", e1); |
|
342 |
} catch (DriverLayerException e1) { |
|
343 |
logger.info("", e1); |
|
344 |
} catch (LegendLayerException e1) { |
|
345 |
logger.info("", e1); |
|
346 |
} catch (NameLayerException e1) { |
|
347 |
logger.info("", e1); |
|
348 |
} catch (ProjectionLayerException e1) { |
|
349 |
logger.info("", e1); |
|
350 |
} catch (TypeLayerException e1) { |
|
351 |
logger.info("", e1); |
|
352 |
} catch (UnsupportedVersionLayerException e1) { |
|
353 |
logger.info("", e1); |
|
354 |
} catch (URLLayerException e1) { |
|
355 |
logger.info("", e1); |
|
356 |
} catch (LoadLayerException e1) { |
|
357 |
logger.info("", e1); |
|
358 |
} catch (InitializeException e1) { |
|
359 |
logger.info("", e1); |
|
360 |
} |
|
361 |
} |
|
362 |
} |
|
363 |
} |
|
364 |
/** |
|
365 |
* Merge two FLayers in one |
|
366 |
* @param group1 |
|
367 |
* @param group2 |
|
368 |
* @return |
|
369 |
*/ |
|
370 |
@SuppressWarnings("unused") |
|
371 |
private FLayers mergeFLayers(FLayers group1, FLayers group2) { |
|
372 |
//FLayers agrupation = new FLayers(group1.getFMap(), group1.getParentLayer()); |
|
373 |
FLayer layer; |
|
374 |
for(int i = 0; i < group2.getLayersCount(); i++) { |
|
375 |
layer = group2.getLayer( i ); |
|
376 |
if(group1.getLayer( layer.getName()) == null ) { |
|
377 |
group1.addLayer( layer ); |
|
378 |
} |
|
379 |
} |
|
380 |
|
|
381 |
return group1; |
|
382 |
} |
|
383 |
|
|
384 |
|
|
385 |
|
|
386 |
public WindowInfo getWindowInfo() { |
|
387 |
if (m_ViewInfo==null){ |
|
388 |
m_ViewInfo=new WindowInfo(WindowInfo.MODALDIALOG); |
|
389 |
m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WCS_layer")); |
|
390 |
m_ViewInfo.setWidth(wcsParamsTabbedPane.getWidth()+10); |
|
391 |
m_ViewInfo.setHeight(wcsParamsTabbedPane.getHeight()+40); |
|
392 |
|
|
393 |
} |
|
394 |
return m_ViewInfo; |
|
395 |
} |
|
396 |
|
|
397 |
public void close() { |
|
398 |
PluginServices.getMDIManager().closeWindow(this); |
|
399 |
} |
|
400 |
|
|
401 |
|
|
402 |
public Object getWindowProfile() { |
|
403 |
return WindowInfo.DIALOG_PROFILE; |
|
404 |
} |
|
405 |
|
|
406 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 407 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/panel/FormatPanel.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.wcs.app.wcsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
28 |
|
|
29 |
import javax.swing.JCheckBox; |
|
30 |
import javax.swing.JComboBox; |
|
31 |
import javax.swing.JList; |
|
32 |
import javax.swing.JPanel; |
|
33 |
import javax.swing.JScrollPane; |
|
34 |
|
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* Format Panel |
|
40 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
41 |
*/ |
|
42 |
public class FormatPanel extends JPanel { |
|
43 |
private static final long serialVersionUID = 1L; |
|
44 |
private JPanel jPanel2 = null; |
|
45 |
private JPanel jPanel3 = null; |
|
46 |
private JPanel jPanel4 = null; |
|
47 |
private JScrollPane jScrollPane1 = null; |
|
48 |
private JScrollPane jScrollPane2 = null; |
|
49 |
private JList lstCRSs = null; |
|
50 |
private JList lstFormats = null; |
|
51 |
private JComboBox cmbInterpolationMethods = null; |
|
52 |
private JCheckBox chkUseInterpolationMethod = null; |
|
53 |
private WCSParamsPanel parent = null; |
|
54 |
|
|
55 |
public FormatPanel() { |
|
56 |
init(); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Sets the parent panel |
|
61 |
* @param parent |
|
62 |
*/ |
|
63 |
public void setWCSParamsPanel(WCSParamsPanel parent) { |
|
64 |
this.parent = parent; |
|
65 |
} |
|
66 |
|
|
67 |
public void init() { |
|
68 |
setLayout(new GridBagLayout()); |
|
69 |
|
|
70 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
71 |
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
|
72 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER; |
|
73 |
gridBagConstraints1.weightx = 1.0; |
|
74 |
gridBagConstraints1.weighty = 1.0; |
|
75 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
|
76 |
gridBagConstraints1.gridy = 1; |
|
77 |
add(getJPanel2(), gridBagConstraints1); |
|
78 |
|
|
79 |
gridBagConstraints1.gridy = 0; |
|
80 |
add(getJPanel3(), gridBagConstraints1); |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* This method initializes jScrollPane2 |
|
85 |
* |
|
86 |
* @return javax.swing.JScrollPane |
|
87 |
*/ |
|
88 |
private JScrollPane getJScrollPane2() { |
|
89 |
if (jScrollPane2 == null) { |
|
90 |
jScrollPane2 = new JScrollPane(); |
|
91 |
jScrollPane2.setViewportView(getLstCRSs()); |
|
92 |
} |
|
93 |
return jScrollPane2; |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* This method initializes lstCRSs |
|
98 |
* |
|
99 |
* @return javax.swing.JList |
|
100 |
*/ |
|
101 |
public JList getLstCRSs() { |
|
102 |
if (lstCRSs == null) { |
|
103 |
lstCRSs = new JList(); |
|
104 |
lstCRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
105 |
lstCRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
106 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
|
107 |
parent.fireWizardComplete(parent.isCorrectlyConfigured()); |
|
108 |
} |
|
109 |
}); |
|
110 |
} |
|
111 |
return lstCRSs; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* This method initializes jPanel2 |
|
116 |
* |
|
117 |
* @return javax.swing.JPanel |
|
118 |
*/ |
|
119 |
private JPanel getJPanel2() { |
|
120 |
if (jPanel2 == null) { |
|
121 |
jPanel2 = new JPanel(new BorderLayout()); |
|
122 |
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
123 |
null, PluginServices.getText(this, "seleccionar_CRS"), |
|
124 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
125 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
126 |
jPanel2.add(getJScrollPane2(), BorderLayout.CENTER); |
|
127 |
} |
|
128 |
return jPanel2; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* This method initializes jScrollPane1 |
|
133 |
* |
|
134 |
* @return javax.swing.JScrollPane |
|
135 |
*/ |
|
136 |
private JScrollPane getJScrollPane1() { |
|
137 |
if (jScrollPane1 == null) { |
|
138 |
jScrollPane1 = new JScrollPane(); |
|
139 |
jScrollPane1.setViewportView(getLstFormats()); |
|
140 |
} |
|
141 |
return jScrollPane1; |
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* This method initializes lstFormats |
|
146 |
* |
|
147 |
* @return javax.swing.JList |
|
148 |
*/ |
|
149 |
public JList getLstFormats() { |
|
150 |
if (lstFormats == null) { |
|
151 |
lstFormats = new JList(); |
|
152 |
lstFormats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
153 |
lstFormats.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
154 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
|
155 |
parent.fireWizardComplete(parent.isCorrectlyConfigured()); |
|
156 |
} |
|
157 |
}); |
|
158 |
} |
|
159 |
return lstFormats; |
|
160 |
} |
|
161 |
|
|
162 |
/** |
|
163 |
* This method initializes jPanel3 |
|
164 |
* |
|
165 |
* @return javax.swing.JPanel |
|
166 |
*/ |
|
167 |
private JPanel getJPanel3() { |
|
168 |
if (jPanel3 == null) { |
|
169 |
|
|
170 |
jPanel3 = new JPanel(new GridBagLayout()); |
|
171 |
|
|
172 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
173 |
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
|
174 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER; |
|
175 |
gridBagConstraints1.weightx = 1.0; |
|
176 |
gridBagConstraints1.weighty = 1.0; |
|
177 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
|
178 |
|
|
179 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
180 |
null, PluginServices.getText(this, "seleccionar_formato"), |
|
181 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
182 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
183 |
jPanel3.add(getJScrollPane1(), gridBagConstraints1); |
|
184 |
|
|
185 |
gridBagConstraints1.gridx = 1; |
|
186 |
jPanel3.add(getJPanel4(), gridBagConstraints1); |
|
187 |
} |
|
188 |
return jPanel3; |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* This method initializes jPanel3 |
|
193 |
* |
|
194 |
* @return javax.swing.JPanel |
|
195 |
*/ |
|
196 |
private JPanel getJPanel4() { |
|
197 |
if (jPanel4 == null) { |
|
198 |
jPanel4 = new JPanel(new GridBagLayout()); |
|
199 |
|
|
200 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
201 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL; |
|
202 |
gridBagConstraints1.weightx = 1.0; |
|
203 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
|
204 |
|
|
205 |
jPanel4.add(getCmbInterpolationMethods(), gridBagConstraints1); |
|
206 |
gridBagConstraints1.gridy = 1; |
|
207 |
jPanel4.add(getChkUseInterpolationMethod(), gridBagConstraints1); |
|
208 |
|
|
209 |
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
|
210 |
gridBagConstraints1.weighty = 1.0; |
|
211 |
gridBagConstraints1.gridy = 2; |
|
212 |
jPanel4.add(new JPanel(), gridBagConstraints1); |
|
213 |
} |
|
214 |
return jPanel4; |
|
215 |
} |
|
216 |
|
|
217 |
/** |
|
218 |
* This method initializes jComboBox |
|
219 |
* |
|
220 |
* @return javax.swing.JComboBox |
|
221 |
*/ |
|
222 |
public JComboBox getCmbInterpolationMethods() { |
|
223 |
if (cmbInterpolationMethods == null) { |
|
224 |
cmbInterpolationMethods = new JComboBox(); |
|
225 |
cmbInterpolationMethods.setEnabled(false); |
|
226 |
cmbInterpolationMethods.setEditable(false); |
|
227 |
} |
|
228 |
return cmbInterpolationMethods; |
|
229 |
} |
|
230 |
|
|
231 |
/** |
|
232 |
* This method initializes jCheckBox |
|
233 |
* |
|
234 |
* @return javax.swing.JCheckBox |
|
235 |
*/ |
|
236 |
public JCheckBox getChkUseInterpolationMethod() { |
|
237 |
if (chkUseInterpolationMethod == null) { |
|
238 |
chkUseInterpolationMethod = new JCheckBox(); |
|
239 |
chkUseInterpolationMethod.setText(PluginServices.getText(this, "use_interpolation_method")); |
|
240 |
chkUseInterpolationMethod.setSelected(false); |
|
241 |
chkUseInterpolationMethod.setEnabled(false); |
|
242 |
chkUseInterpolationMethod.addItemListener(new java.awt.event.ItemListener() { |
|
243 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
244 |
cmbInterpolationMethods.setEnabled(chkUseInterpolationMethod.isSelected()); |
|
245 |
} |
|
246 |
}); |
|
247 |
} |
|
248 |
return chkUseInterpolationMethod; |
|
249 |
} |
|
250 |
|
|
251 |
/** |
|
252 |
* Returns the index of the CRS within the CRS list. |
|
253 |
* @param crs |
|
254 |
* @return The CRS's index if it exists, -1 if it not exists. |
|
255 |
*/ |
|
256 |
public int getSRSIndex(String crs) { |
|
257 |
for (int i = 0; i < getLstCRSs().getModel().getSize(); i++){ |
|
258 |
if (crs.equals(getLstCRSs().getModel().getElementAt(i))) { |
|
259 |
return i; |
|
260 |
} |
|
261 |
} |
|
262 |
return -1; |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* Returns the index of the format within the formats list. |
|
267 |
* @return The format's index if it exists, -1 if it not exists. |
|
268 |
*/ |
|
269 |
public int getFormatIndex(String format) { |
|
270 |
for (int i = 0; i < getLstFormats().getModel().getSize(); i++){ |
|
271 |
if (format.equals(getLstFormats().getModel().getElementAt(i))) { |
|
272 |
return i; |
|
273 |
} |
|
274 |
} |
|
275 |
return -1; |
|
276 |
} |
|
277 |
} |
|
278 |
|
|
0 | 279 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/panel/LayerList.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.wcs.app.wcsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.Component; |
|
26 |
import java.awt.Dimension; |
|
27 |
|
|
28 |
import javax.swing.DefaultListCellRenderer; |
|
29 |
import javax.swing.JList; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.controls.dnd.JDnDList; |
|
32 |
import org.gvsig.raster.wcs.io.WCSLayerNode; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* Class implementing a JList component adapted to the WCSLayerNode |
|
37 |
* needs (use it as a JList with drag'n'drop capabilities). |
|
38 |
* |
|
39 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class LayerList extends JDnDList { |
|
43 |
private static final long serialVersionUID = 1L; |
|
44 |
public boolean showLayerNames = false; |
|
45 |
private int count = 0; |
|
46 |
|
|
47 |
public LayerList() { |
|
48 |
super(); |
|
49 |
setCellRenderer(new MyRenderer()); |
|
50 |
} |
|
51 |
|
|
52 |
private class MyRenderer extends DefaultListCellRenderer { |
|
53 |
private static final long serialVersionUID = 1L; |
|
54 |
|
|
55 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
56 |
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
57 |
if (value instanceof WCSLayerNode){ |
|
58 |
WCSLayerNode layer = (WCSLayerNode) value; |
|
59 |
|
|
60 |
if (!showLayerNames) { |
|
61 |
if (layer.getName() != null || layer.getName() == "") { |
|
62 |
String text = layer.toString(); |
|
63 |
text = text.substring(text.indexOf(']')+2, text.length()); |
|
64 |
setText(text); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
Dimension sz = getPreferredSize(); |
|
69 |
sz.setSize((sz.getWidth()+50) - (50*count), sz.getHeight()); |
|
70 |
setPreferredSize(sz); |
|
71 |
count++; |
|
72 |
} |
|
73 |
return this; |
|
74 |
} |
|
75 |
} |
|
76 |
} |
|
0 | 77 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/panel/InfoPanel.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.wcs.app.wcsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
|
|
27 |
import javax.swing.JEditorPane; |
|
28 |
import javax.swing.JPanel; |
|
29 |
import javax.swing.JScrollPane; |
|
30 |
|
|
31 |
import org.gvsig.andami.PluginServices; |
|
32 |
import org.gvsig.raster.wcs.io.WCSLayerNode; |
|
33 |
import org.gvsig.raster.wcs.io.WCSServerExplorer; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* Service Information Panel |
|
38 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
39 |
*/ |
|
40 |
public class InfoPanel extends JPanel { |
|
41 |
private static final long serialVersionUID = 1L; |
|
42 |
private final String bgColor0 = "\"#FEEDD6\""; // light salmon |
|
43 |
private final String bgColor1 = "\"#EAEAEA\""; // light grey |
|
44 |
//private final String bgColor2 = "\"#F2FEFF\""; // light blue |
|
45 |
private final String bgColor3 = "\"#FBFFE1\""; // light yellow |
|
46 |
|
|
47 |
private final String service_title = PluginServices.getText(this, "service_info"); |
|
48 |
private final String server = PluginServices.getText(this, "server"); |
|
49 |
private final String server_type = PluginServices.getText(this, "server_type"); |
|
50 |
private final String server_abstract = PluginServices.getText(this, "server_abstract"); |
|
51 |
private final String server_title = PluginServices.getText(this, "server_title"); |
|
52 |
private final String layers_title = PluginServices.getText(this, "selected_layers"); |
|
53 |
private final String layer_title = PluginServices.getText(this, "layer_title"); |
|
54 |
private final String layer_abstract = PluginServices.getText(this, "layer_abstract"); |
|
55 |
private final String selected_parameters = PluginServices.getText(this, "selected_parameters"); |
|
56 |
private final String time_title = PluginServices.getText(this, "time"); |
|
57 |
private final String format_title = PluginServices.getText(this, "format"); |
|
58 |
private final String srs_title = "CRS"; |
|
59 |
private final String properties = PluginServices.getText(this, "properties"); |
|
60 |
private final String layer_name = PluginServices.getText(this, "name"); |
|
61 |
private JEditorPane editor = null; |
|
62 |
|
|
63 |
|
|
64 |
/** |
|
65 |
* Creates a new instance of InfoPanel with double buffer and null layout |
|
66 |
* |
|
67 |
*/ |
|
68 |
public InfoPanel() { |
|
69 |
setLayout(new BorderLayout()); |
|
70 |
JScrollPane src = new JScrollPane(); |
|
71 |
src.setViewportView(getEditor()); |
|
72 |
add(src, BorderLayout.CENTER); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* This method initializes tblInfo |
|
77 |
* |
|
78 |
* @return javax.swing.JTable |
|
79 |
*/ |
|
80 |
private JEditorPane getEditor() { |
|
81 |
if (editor == null) { |
|
82 |
editor = new JEditorPane(); |
|
83 |
editor.setEditable(false); |
|
84 |
} |
|
85 |
return editor; |
|
86 |
} |
|
87 |
|
|
88 |
|
|
89 |
/** |
|
90 |
* Fills the text pane with a data table describing the service and the |
|
91 |
* selected settings. |
|
92 |
* |
|
93 |
* @param WCSWizardData dataSource: connection info |
|
94 |
* @param WCSLayer layer: the selected layer |
|
95 |
* @param String time: the time value. |
|
96 |
* @param String format: the format value |
|
97 |
* @param String crs: the CRS value |
|
98 |
* @param String parameters: comma-separated key-value string containing the values for the parameters |
|
99 |
*/ |
|
100 |
|
|
101 |
public void refresh(WCSServerExplorer dataSource, WCSLayerNode layer, String time, String format, String crs, String parameters) { |
|
102 |
|
|
103 |
String server_text = dataSource.getHost(); |
|
104 |
String server_type_text = dataSource.getServerType(); |
|
105 |
String server_title_text = dataSource.getTitle(); |
|
106 |
String server_abstract_text = dataSource.getAbstract(); |
|
107 |
String font = "Arial"; |
|
108 |
|
|
109 |
if (server_text == null) |
|
110 |
server_text = "-"; |
|
111 |
if (server_type_text == null) |
|
112 |
server_type_text = "-"; |
|
113 |
if (server_title_text == null) |
|
114 |
server_title_text = "-"; |
|
115 |
if (server_abstract_text == null) |
|
116 |
server_abstract_text = "-"; |
|
117 |
|
|
118 |
if (format == null) |
|
119 |
format = PluginServices.getText(this, "none_selected"); |
|
120 |
if (crs == null) |
|
121 |
crs = PluginServices.getText(this, "none_selected"); |
|
122 |
|
|
123 |
String layers_html = ""; |
|
124 |
if (layer!=null) { |
|
125 |
String layer_name_text = layer.getName(); |
|
126 |
String time_text = (time==null) ? PluginServices.getText(this, "not_available") : time;//((FMapWCSStyle) selectedStyles.get(i)).title; |
|
127 |
String layer_abstract_text = layer.getDescription(); |
|
128 |
String layer_title_text = layer.getTitle(); |
|
129 |
|
|
130 |
if (layer_name_text ==null) |
|
131 |
layer_name_text = "-"; |
|
132 |
if (time_text==null) |
|
133 |
time_text = "-"; |
|
134 |
if (layer_abstract_text==null) |
|
135 |
layer_abstract_text = "-"; |
|
136 |
if (layer_title_text == null) |
|
137 |
layer_title_text = "-"; |
|
138 |
String layer_html = |
|
139 |
" <tr valign=\"top\">" + |
|
140 |
" <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_name+"</b></font></td>" + |
|
141 |
" <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_name_text+"</font></td>" + |
|
142 |
" </tr>" + |
|
143 |
" <tr valign=\"top\">" + |
|
144 |
" <td width=\"119\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\"><b>"+layer_title+"</b></font></td>" + |
|
145 |
" <td width=\"322\" height=\"18\" bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+layer_title_text+"</font></td>" + |
|
146 |
" </tr>" + |
|
147 |
" <tr valign=\"top\">" + |
|
148 |
" <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+layer_abstract+"</b></font></td>" + |
|
149 |
" <td bgcolor="+bgColor0+"><font face=\"Arial\" size=\"3\">"+layer_abstract_text+"</font></td>" + |
|
150 |
" </tr>" + |
|
151 |
" <tr valign=\"top\">" + |
|
152 |
" <td bgcolor=\"#D6D6D6\" align=\"right\"><font face=\"Arial\" size=\"3\" align=\"right\"><b>"+time_title+"</b></font></td>" + |
|
153 |
" <td bgcolor="+bgColor1+"><font face=\"Arial\" size=\"3\">"+time_text+"</font></td>" + |
|
154 |
" </tr>" + |
|
155 |
" <tr>" + |
|
156 |
" </tr>"; |
|
157 |
layers_html += layer_html; |
|
158 |
} |
|
159 |
if (!layers_html.equals("")) |
|
160 |
layers_html = |
|
161 |
" <tr valign=\"top\" bgcolor=\"#FFFFFF\">" + |
|
162 |
" <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+layers_title+"</font></b></td>" + |
|
163 |
" </tr>" + layers_html; |
|
164 |
String parameter_html = ""; |
|
165 |
if (parameters!=null) { |
|
166 |
boolean swap = false; |
|
167 |
String[] myParameters = parameters.split("&"); |
|
168 |
for (int i = 0; i < myParameters.length; i++) { |
|
169 |
String color = swap ? bgColor0 : bgColor1; |
|
170 |
String[] parameter = myParameters[i].split("="); |
|
171 |
parameter_html += |
|
172 |
" <tr valign=\"top\" bgcolor="+color+">" + |
|
173 |
" <td width=\"120\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><b>"+parameter[0]+"</b></td>" + |
|
174 |
" <td width=\"322\" height=\"18\">"+parameter[1]+"</td>" + |
|
175 |
" </tr>"; |
|
176 |
swap = !swap; |
|
177 |
} |
|
178 |
parameter_html += |
|
179 |
" <tr>" + |
|
180 |
" </tr>"; |
|
181 |
} |
|
182 |
if (!parameter_html.equals("")) |
|
183 |
parameter_html = |
|
184 |
" <tr valign=\"top\">" + |
|
185 |
" <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+selected_parameters+"</font></b></td>" + |
|
186 |
" </tr>" + parameter_html; |
|
187 |
|
|
188 |
String format_html = |
|
189 |
" <tr valign=\"top\" bgcolor=\"#FFFFFF\">" + |
|
190 |
" <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+properties+"</font></b></td>" + |
|
191 |
" </tr>" + |
|
192 |
" <tr valign=\"top\" bgcolor="+bgColor0+">" + |
|
193 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+format_title+"</b></font></td>" + |
|
194 |
" <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+format+"</font></td>" + |
|
195 |
" </tr>" + |
|
196 |
" <tr valign=\"top\" bgcolor="+bgColor1+">" + |
|
197 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+srs_title+"</font></b></td>" + |
|
198 |
" <td><font face=\""+font+"\" size=\"3\">"+crs+"</font></td>" + |
|
199 |
" </tr>"; |
|
200 |
|
|
201 |
String html = |
|
202 |
|
|
203 |
"<html>" + |
|
204 |
"<body>" + |
|
205 |
"<table align=\"center\" width=\"437\" height=\"156\" border=\"0\" cellpadding=\"4\" cellspacing=\"4\">" + |
|
206 |
" <tr valign=\"top\" bgcolor=\"#FFFFFF\">" + |
|
207 |
" <td width=\"92\" height=\"18\" bgcolor="+bgColor3+" colspan=\"2\"><font face=\""+font+"\" size=\"4\"><b>"+service_title+"</font></b></td>" + |
|
208 |
" </tr>" + |
|
209 |
" <tr valign=\"top\" bgcolor="+bgColor0+">" + |
|
210 |
" <td width=\"92\" height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server+"</font></b></td>" + |
|
211 |
" <td width=\"268\"><font face=\""+font+"\" size=\"3\">"+server_text+"</font></td>" + |
|
212 |
" </tr>" + |
|
213 |
" <tr valign=\"top\" bgcolor="+bgColor1+">" + |
|
214 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_type+"</b></font></td>" + |
|
215 |
" <td><font face=\""+font+"\" size=\"3\">"+server_type_text+"</font></td>" + |
|
216 |
" </tr>" + |
|
217 |
" <tr valign=\"top\" bgcolor="+bgColor0+">" + |
|
218 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_title+"</b></font></td>" + |
|
219 |
" <td><font face=\""+font+"\" size=\"3\"><font face=\""+font+"\" size=\"3\">"+server_title_text+"</font></td>" + |
|
220 |
" </tr>" + |
|
221 |
" <tr valign=\"top\" bgcolor="+bgColor1+">" + |
|
222 |
" <td height=\"18\" bgcolor=\"#D6D6D6\" align=\"right\"><font face=\""+font+"\" size=\"3\"><b>"+server_abstract+"</font></b></td>" + |
|
223 |
" <td><font face=\""+font+"\" size=\"3\">"+server_abstract_text+"</font></td>" + |
|
224 |
" </tr>" + |
|
225 |
|
|
226 |
" <tr>" + |
|
227 |
" </tr>" + |
|
228 |
layers_html + |
|
229 |
parameter_html + |
|
230 |
format_html + |
|
231 |
"</table>" + |
|
232 |
"</body>" + |
|
233 |
"</html>"; |
|
234 |
|
|
235 |
getEditor().setContentType("text/html"); |
|
236 |
getEditor().setText(html); |
|
237 |
} |
|
238 |
} |
|
239 |
|
|
0 | 240 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/panel/LayerPanel.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.wcs.app.wcsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
28 |
import java.util.prefs.Preferences; |
|
29 |
|
|
30 |
import javax.swing.JCheckBox; |
|
31 |
import javax.swing.JPanel; |
|
32 |
import javax.swing.JScrollPane; |
|
33 |
import javax.swing.JTextField; |
|
34 |
|
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
import org.gvsig.raster.wcs.io.WCSLayerNode; |
|
37 |
|
|
38 |
|
|
39 |
/** |
|
40 |
* Layer Panel |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
42 |
*/ |
|
43 |
public class LayerPanel extends JPanel { |
|
44 |
private static final long serialVersionUID = 1L; |
|
45 |
public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wcs-wizard" ); |
|
46 |
private JPanel jPanel4 = null; |
|
47 |
private JPanel pnlName = null; |
|
48 |
private LayerList lstCoverages = null; |
|
49 |
private JScrollPane jScrollPane = null; |
|
50 |
private JTextField txtName = null; |
|
51 |
private JCheckBox chkExtendedNames = null; |
|
52 |
private WCSParamsPanel parent = null; |
|
53 |
|
|
54 |
public LayerPanel() { |
|
55 |
init(); |
|
56 |
} |
|
57 |
|
|
58 |
public void init() { |
|
59 |
setLayout(new GridBagLayout()); |
|
60 |
|
|
61 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
62 |
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
|
63 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER; |
|
64 |
gridBagConstraints1.weightx = 1.0; |
|
65 |
gridBagConstraints1.weighty = 1.0; |
|
66 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
|
67 |
gridBagConstraints1.gridy = 1; |
|
68 |
add(getJPanel4(), gridBagConstraints1); |
|
69 |
|
|
70 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL; |
|
71 |
gridBagConstraints1.anchor = GridBagConstraints.CENTER; |
|
72 |
gridBagConstraints1.weightx = 1.0; |
|
73 |
gridBagConstraints1.weighty = 0; |
|
74 |
gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); |
|
75 |
gridBagConstraints1.gridy = 0; |
|
76 |
add(getPnlName(), gridBagConstraints1); |
|
77 |
|
|
78 |
gridBagConstraints1.gridy = 2; |
|
79 |
add(getChkExtendedNames(), gridBagConstraints1); |
|
80 |
} |
|
81 |
|
|
82 |
public void setWCSParamsPanel(WCSParamsPanel parent) { |
|
83 |
this.parent = parent; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* This method initializes chkExtendedNames |
|
88 |
* |
|
89 |
* @return javax.swing.JCheckBox |
|
90 |
*/ |
|
91 |
private JCheckBox getChkExtendedNames() { |
|
92 |
if (chkExtendedNames == null) { |
|
93 |
chkExtendedNames = new JCheckBox(); |
|
94 |
chkExtendedNames.setText(PluginServices.getText(this, "show_layer_names")); |
|
95 |
chkExtendedNames.addItemListener(new java.awt.event.ItemListener() { |
|
96 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
97 |
boolean b = chkExtendedNames.isSelected(); |
|
98 |
getLstCoverages().showLayerNames = b; |
|
99 |
getLstCoverages().repaint(); |
|
100 |
} |
|
101 |
}); |
|
102 |
chkExtendedNames.addActionListener(new java.awt.event.ActionListener() { |
|
103 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
104 |
fPrefs.putBoolean("show_layer_names", chkExtendedNames.isSelected()); |
|
105 |
} |
|
106 |
}); |
|
107 |
chkExtendedNames.setSelected(fPrefs.getBoolean("show_layer_names", false)); |
|
108 |
|
|
109 |
} |
|
110 |
return chkExtendedNames; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* This method initializes pnlName |
|
115 |
* |
|
116 |
* @return javax.swing.JPanel |
|
117 |
*/ |
|
118 |
private JPanel getPnlName() { |
|
119 |
if (pnlName == null) { |
|
120 |
pnlName = new JPanel(new BorderLayout()); |
|
121 |
pnlName.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
122 |
null, PluginServices.getText(this, "nombre_cobertura"), |
|
123 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
124 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
125 |
pnlName.add(getTxtName(), BorderLayout.CENTER); |
|
126 |
} |
|
127 |
return pnlName; |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* This method initializes jTextField |
|
132 |
* |
|
133 |
* @return javax.swing.JTextField |
|
134 |
*/ |
|
135 |
public JTextField getTxtName() { |
|
136 |
if (txtName == null) { |
|
137 |
txtName = new JTextField(); |
|
138 |
} |
|
139 |
return txtName; |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* This method initializes jList1 |
|
144 |
* |
|
145 |
* @return javax.swing.JList |
|
146 |
*/ |
|
147 |
public LayerList getLstCoverages() { |
|
148 |
if (lstCoverages == null) { |
|
149 |
lstCoverages = new LayerList(); |
|
150 |
lstCoverages.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
151 |
lstCoverages.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
152 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
|
153 |
parent.refreshData(null); |
|
154 |
} |
|
155 |
}); |
|
156 |
} |
|
157 |
return lstCoverages; |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* This method initializes jScrollPane |
|
162 |
* |
|
163 |
* @return javax.swing.JScrollPane |
|
164 |
*/ |
|
165 |
private JScrollPane getJScrollPane() { |
|
166 |
if (jScrollPane == null) { |
|
167 |
jScrollPane = new JScrollPane(); |
|
168 |
jScrollPane.setViewportView(getLstCoverages()); |
|
169 |
} |
|
170 |
return jScrollPane; |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 |
* This method initializes jPanel4 |
|
175 |
* |
|
176 |
* @return javax.swing.JPanel |
|
177 |
*/ |
|
178 |
private JPanel getJPanel4() { |
|
179 |
if (jPanel4 == null) { |
|
180 |
jPanel4 = new JPanel(new BorderLayout()); |
|
181 |
jPanel4.add(getJScrollPane(), BorderLayout.CENTER); |
|
182 |
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
183 |
null, PluginServices.getText(this, "seleccionar_coberturas"), |
|
184 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
185 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
186 |
} |
|
187 |
return jPanel4; |
|
188 |
} |
|
189 |
|
|
190 |
/** |
|
191 |
* Returns the index of the coverage within the coverages list |
|
192 |
* |
|
193 |
* @param coverageName |
|
194 |
* @return The coverage's index if it exists, -1 if it not exists. |
|
195 |
*/ |
|
196 |
public int getCoverageIndex(String coverageName) { |
|
197 |
for (int i = 0; i < getLstCoverages().getModel().getSize(); i++){ |
|
198 |
if (coverageName.equals(((WCSLayerNode)getLstCoverages().getModel().getElementAt(i)).getName())) { |
|
199 |
return i; |
|
200 |
} |
|
201 |
} |
|
202 |
return -1; |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* Returns the selected coverage name at the server. This is the value to use |
|
207 |
* in a GetCoverage request |
|
208 |
* |
|
209 |
* @return String |
|
210 |
*/ |
|
211 |
public String getSelectedInListCoverageName() { |
|
212 |
if (getLstCoverages().getSelectedValue() == null) { |
|
213 |
return null; |
|
214 |
} |
|
215 |
/*if(getTxtName().getText().compareTo("") == 0) |
|
216 |
return null; |
|
217 |
|
|
218 |
for (int i = 0; i < getLstCoverages().getModel().getSize(); i++) { |
|
219 |
RemoteWCSLayerNode node = (RemoteWCSLayerNode)getLstCoverages().getModel().getElementAt(i); |
|
220 |
if(node.getTitle().compareTo(getTxtName().getText()) == 0) |
|
221 |
return node.getName(); |
|
222 |
} |
|
223 |
return null; |
|
224 |
*/ |
|
225 |
return ((WCSLayerNode) getLstCoverages().getSelectedValue()).getName(); |
|
226 |
} |
|
227 |
|
|
228 |
/** |
|
229 |
* Returns the selected coverage name at the server. This is the value to use |
|
230 |
* in a GetCoverage request |
|
231 |
* |
|
232 |
* @return String |
|
233 |
*/ |
|
234 |
public String getSelectedCoverageName() { |
|
235 |
if(getTxtName().getText().compareTo("") == 0) |
|
236 |
return null; |
|
237 |
|
|
238 |
for (int i = 0; i < getLstCoverages().getModel().getSize(); i++) { |
|
239 |
WCSLayerNode node = (WCSLayerNode)getLstCoverages().getModel().getElementAt(i); |
|
240 |
if(node.getTitle().compareTo(getTxtName().getText()) == 0) |
|
241 |
return node.getName(); |
|
242 |
} |
|
243 |
return null; |
|
244 |
} |
|
245 |
|
|
246 |
public String getNameByTitle(String title) { |
|
247 |
for (int i = 0; i < getLstCoverages().getModel().getSize(); i++) { |
|
248 |
WCSLayerNode node = (WCSLayerNode)getLstCoverages().getModel().getElementAt(i); |
|
249 |
if(node.getTitle().compareTo(title) == 0) |
|
250 |
return node.getName(); |
|
251 |
} |
|
252 |
return null; |
|
253 |
} |
|
254 |
|
|
255 |
public String getTitleByName(String name) { |
|
256 |
for (int i = 0; i < getLstCoverages().getModel().getSize(); i++) { |
|
257 |
WCSLayerNode node = (WCSLayerNode)getLstCoverages().getModel().getElementAt(i); |
|
258 |
if(node.getName().compareTo(name) == 0) |
|
259 |
return node.getTitle(); |
|
260 |
} |
|
261 |
return null; |
|
262 |
} |
|
263 |
|
|
264 |
} |
|
265 |
|
|
0 | 266 |
org.gvsig.raster.wcs/tags/org.gvsig.raster.wcs-2.2.53/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/gui/panel/LayerTree.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.wcs.app.wcsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.Component; |
|
26 |
|
|
27 |
import javax.swing.JToolTip; |
|
28 |
import javax.swing.JTree; |
|
29 |
import javax.swing.ToolTipManager; |
|
30 |
import javax.swing.tree.DefaultTreeCellRenderer; |
|
31 |
|
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.gui.beans.controls.MultiLineToolTip; |
|
34 |
import org.gvsig.raster.wcs.io.WCSLayerNode; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* LayerTree extends the standard JTree class to allow use custom tooltips. |
|
39 |
* It is just JTree containing RemoteLayerNode at its nodes. |
|
40 |
* |
|
41 |
* @author jaume |
|
42 |
* |
|
43 |
*/ |
|
44 |
public class LayerTree extends JTree { |
|
45 |
private static final long serialVersionUID = 1L; |
|
46 |
public boolean showLayerNames = false; |
|
47 |
|
|
48 |
public LayerTree(){ |
|
49 |
super(); |
|
50 |
ToolTipManager.sharedInstance().registerComponent(this); |
|
51 |
ToolTipManager.sharedInstance().setDismissDelay(60*1000); |
|
52 |
setCellRenderer(new MyRenderer()); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* Layer tree specific renderer allowing to show multiple line |
|
57 |
* tooltips |
|
58 |
* @author jaume |
|
59 |
* |
|
60 |
*/ |
|
61 |
private class MyRenderer extends DefaultTreeCellRenderer { |
|
62 |
private static final long serialVersionUID = 1L; |
|
63 |
|
|
64 |
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
65 |
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
|
66 |
if (value instanceof WCSLayerNode){ |
|
67 |
WCSLayerNode layer = (WCSLayerNode) value; |
|
68 |
|
|
69 |
String myLatLonTxt = layer.getLatLonBox(); |
|
70 |
if (myLatLonTxt == null) |
|
71 |
myLatLonTxt = "-"; |
|
72 |
|
|
73 |
String myAbstract = layer.getAbstract(); |
|
74 |
|
|
75 |
if (myAbstract == null) |
|
76 |
myAbstract = "-"; |
|
77 |
else |
|
78 |
myAbstract = format(myAbstract.trim(), 100); |
|
79 |
|
|
80 |
String text = |
|
81 |
PluginServices.getText(this, "abstract") + ":\n" + myAbstract + |
|
82 |
"\n\n" + |
|
83 |
PluginServices.getText(this, "covered_extension") + ":\n" + myLatLonTxt; |
|
84 |
|
|
85 |
setToolTipText(text); |
|
86 |
|
|
87 |
if (!showLayerNames) { |
|
88 |
if (layer.getName() != null || layer.getName() == "") { |
|
89 |
text = layer.toString(); |
|
90 |
text = text.substring(text.indexOf(']')+2, text.length()); |
|
91 |
setText(text); |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
// Dimension sz = getPreferredSize(); |
|
96 |
// sz.setSize((sz.getWidth()+50) - (3*count), sz.getHeight()); |
|
97 |
// setPreferredSize(sz); |
|
98 |
// count++; |
|
99 |
|
|
100 |
} else { |
|
101 |
setToolTipText(null); |
|
102 |
} |
|
103 |
return this; |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
|
|
108 |
/** |
|
109 |
* Cuts the message text to force its lines to be shorter or equal to |
|
110 |
* lineLength. |
|
111 |
* @param message, the message. |
|
112 |
* @param lineLength, the max line length in number of characters. |
|
113 |
* @return the formated message. |
|
114 |
*/ |
|
115 |
public static String format(String message, int lineLength){ |
|
116 |
if (message.length() <= lineLength) return message; |
Also available in: Unified diff