svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / thememanager / FThemeManagerWindow.java @ 4226
History | View | Annotate | Download (19.8 KB)
1 |
/*
|
---|---|
2 |
* Created on 24-ene-2005
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
package com.iver.cit.gvsig.gui.thememanager; |
45 |
|
46 |
import java.awt.BorderLayout; |
47 |
import java.awt.Component; |
48 |
import java.awt.event.ActionEvent; |
49 |
import java.awt.event.ActionListener; |
50 |
import java.io.File; |
51 |
import java.io.FileNotFoundException; |
52 |
import java.io.FileReader; |
53 |
import java.io.FileWriter; |
54 |
import java.text.NumberFormat; |
55 |
import java.text.ParseException; |
56 |
|
57 |
import javax.swing.JButton; |
58 |
import javax.swing.JDialog; |
59 |
import javax.swing.JFileChooser; |
60 |
import javax.swing.JPanel; |
61 |
import javax.swing.JTabbedPane; |
62 |
|
63 |
import org.exolab.castor.xml.MarshalException; |
64 |
import org.exolab.castor.xml.Marshaller; |
65 |
import org.exolab.castor.xml.ValidationException; |
66 |
|
67 |
import com.hardcode.gdbms.engine.data.DataSource; |
68 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
69 |
import com.iver.andami.PluginServices; |
70 |
import com.iver.andami.messages.NotificationManager; |
71 |
import com.iver.andami.ui.mdiManager.View; |
72 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
73 |
import com.iver.cit.gvsig.fmap.DriverException; |
74 |
import com.iver.cit.gvsig.fmap.FMap; |
75 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
76 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
77 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
78 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
79 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
80 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial; |
81 |
import com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend; |
82 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
83 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
84 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
85 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
86 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
87 |
import com.iver.cit.gvsig.gui.Panels.LinkPanel; |
88 |
import com.iver.cit.gvsig.gui.thememanager.legendmanager.FPanelLegendManager; |
89 |
import com.iver.cit.gvsig.gui.thememanager.legendmanager.panels.AbstractPanel; |
90 |
import com.iver.cit.gvsig.gui.thememanager.scalemanager.FPanelScaleManager; |
91 |
import com.iver.cit.gvsig.project.ProjectView; |
92 |
import com.iver.utiles.GenericFileFilter; |
93 |
import com.iver.utiles.XMLEntity; |
94 |
import com.iver.utiles.xmlEntity.generate.XmlTag; |
95 |
|
96 |
/**
|
97 |
* @author jmorell (jose.morell@gmail.com)
|
98 |
* @version 24-ene-2005
|
99 |
*/
|
100 |
public final class FThemeManagerWindow extends AbstractPanel implements View { |
101 |
private FMap mapContext;
|
102 |
private FLayer layer;
|
103 |
private Legend renderer; // Le asignaremos la leyenda del primer tema activo. |
104 |
private FPanelScaleManager fPanelScaleManager;
|
105 |
private FPanelLegendManager fPanelLegendManager;
|
106 |
private LinkPanel linkPanel;
|
107 |
private JTabbedPane organizador = new JTabbedPane(); // @jve:decl-index=0: |
108 |
private ComandosListener m_actionListener = new ComandosListener(this); |
109 |
//private ProjectView view;
|
110 |
private NumberFormat nf = NumberFormat.getInstance(); |
111 |
|
112 |
/**
|
113 |
* Creates new form JPanel
|
114 |
*/
|
115 |
public FThemeManagerWindow() {
|
116 |
initialize(); |
117 |
this.setSize(650, 420); |
118 |
} |
119 |
|
120 |
/**
|
121 |
* Sobrecarga del constructor. Este se utiliza cuando se llama a este
|
122 |
* di?logo desde la barra de comandos.
|
123 |
*
|
124 |
*/
|
125 |
public FThemeManagerWindow(FLayer l, FMap fMap) {
|
126 |
initialize(); |
127 |
layer = l; |
128 |
mapContext = fMap; |
129 |
try {
|
130 |
ClassifiableVectorial aux = (ClassifiableVectorial) layer; |
131 |
renderer = (Legend) aux.getLegend().cloneLegend(); |
132 |
fPanelScaleManager.setMapContext(mapContext); |
133 |
fPanelLegendManager.setMapContext(mapContext); |
134 |
} catch (XMLException e) {
|
135 |
// TODO Auto-generated catch block
|
136 |
e.printStackTrace(); |
137 |
} catch (DriverException e1) {
|
138 |
// TODO Auto-generated catch block
|
139 |
e1.printStackTrace(); |
140 |
} |
141 |
|
142 |
fPanelScaleManager.setLayer(layer, renderer); |
143 |
fPanelLegendManager.setLayer(layer, renderer); |
144 |
|
145 |
organizador.setSelectedIndex(0);
|
146 |
|
147 |
this.setSize(650, 420); |
148 |
} |
149 |
|
150 |
/**
|
151 |
* This method initializes this
|
152 |
*
|
153 |
* @return void
|
154 |
*/
|
155 |
private void initialize() { |
156 |
|
157 |
fPanelScaleManager = new FPanelScaleManager();
|
158 |
fPanelLegendManager = new FPanelLegendManager();
|
159 |
|
160 |
organizador.addTab(PluginServices.getText(this,"General"), fPanelScaleManager); |
161 |
organizador.addTab(PluginServices.getText(this,"Simbologia"), fPanelLegendManager); |
162 |
|
163 |
JPanel panelButtons = new JPanel(); |
164 |
|
165 |
JButton btnAceptar = new JButton(PluginServices.getText(this,"Aceptar")); |
166 |
btnAceptar.setActionCommand("OK");
|
167 |
btnAceptar.addActionListener(m_actionListener); |
168 |
|
169 |
JButton btnApply = new JButton(PluginServices.getText(this,"Aplicar")); |
170 |
btnApply.setActionCommand("APPLY");
|
171 |
btnApply.addActionListener(m_actionListener); |
172 |
|
173 |
JButton btnSaveLegend = new JButton(PluginServices.getText(this,"Guardar_leyenda")+"..."); |
174 |
btnSaveLegend.setActionCommand("SAVE_LEGEND");
|
175 |
btnSaveLegend.addActionListener(m_actionListener); |
176 |
|
177 |
JButton btnLoadLegend = new JButton(PluginServices.getText(this,"Recuperar_leyenda")+"..."); |
178 |
btnLoadLegend.setActionCommand("LOAD_LEGEND");
|
179 |
btnLoadLegend.addActionListener(m_actionListener); |
180 |
|
181 |
JButton btnCancelar = new JButton(PluginServices.getText(this,"Cerrar")); |
182 |
btnCancelar.setActionCommand("CANCEL");
|
183 |
btnCancelar.addActionListener(m_actionListener); |
184 |
|
185 |
panelButtons.add(btnApply, null);
|
186 |
|
187 |
setLayout(new BorderLayout()); |
188 |
panelButtons.setLayout(null);
|
189 |
organizador.setPreferredSize(new java.awt.Dimension(640,390)); |
190 |
btnAceptar.setBounds(9, 5, 89, 23); |
191 |
btnApply.setBounds(107, 5, 89, 23); |
192 |
btnSaveLegend.setBounds(205, 5, 159, 23); |
193 |
btnLoadLegend.setBounds(373, 5, 159, 23); |
194 |
btnCancelar.setBounds(541, 5, 89, 23); |
195 |
panelButtons.setPreferredSize(new java.awt.Dimension(493,33)); |
196 |
add(organizador, java.awt.BorderLayout.NORTH); |
197 |
panelButtons.add(btnAceptar, null);
|
198 |
add(panelButtons, java.awt.BorderLayout.SOUTH); |
199 |
panelButtons.add(btnSaveLegend, null);
|
200 |
panelButtons.add(btnLoadLegend, null);
|
201 |
panelButtons.add(btnCancelar, null);
|
202 |
} |
203 |
|
204 |
|
205 |
|
206 |
/**
|
207 |
* En esta funci?n se coge el primer tema activo del TOC y se usa su
|
208 |
* renderer para inicializar. Hay que llamarla SIEMPRE que se abra el
|
209 |
* cuadro de di?logo, en el openLegendManager() de la vista.
|
210 |
*
|
211 |
* @param mapContext TOC que abre este cuadro de di?logo.
|
212 |
* @throws DriverException
|
213 |
*/
|
214 |
public void setMapContext(FMap mapContext) throws DriverException { |
215 |
this.mapContext = mapContext;
|
216 |
layer = getFirstActiveLayerVect(mapContext.getLayers()); |
217 |
try {
|
218 |
ClassifiableVectorial aux = (ClassifiableVectorial) layer; |
219 |
renderer = (Legend) aux.getLegend().cloneLegend(); |
220 |
} catch (XMLException e) {
|
221 |
// TODO Auto-generated catch block
|
222 |
e.printStackTrace(); |
223 |
} |
224 |
fPanelScaleManager.setMapContext(mapContext); |
225 |
fPanelLegendManager.setMapContext(mapContext); |
226 |
actualizar(); |
227 |
} |
228 |
|
229 |
/**
|
230 |
* DOCUMENT ME!
|
231 |
*/
|
232 |
private void actualizar() { |
233 |
FLayer lyrSelected = getFirstActiveLayerVect(mapContext.getLayers()); |
234 |
|
235 |
fPanelScaleManager.setLayer(lyrSelected, renderer); |
236 |
fPanelLegendManager.setLayer(lyrSelected, renderer); |
237 |
|
238 |
organizador.setSelectedIndex(0);
|
239 |
} |
240 |
|
241 |
private void btnApply_actionPerformed(ActionEvent evt) { |
242 |
// ClassifiableVectorial aux = (ClassifiableVectorial) layer;
|
243 |
|
244 |
switch (fPanelLegendManager.getVisibleCard()) {
|
245 |
case 0: // default symbol |
246 |
renderer = fPanelLegendManager.getM_defaultLegendPanel().getLegend(); |
247 |
fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + PluginServices.getText(this,"_(Simbolo_unico)")); |
248 |
break;
|
249 |
case 1: // Unique Values |
250 |
renderer = fPanelLegendManager.getM_valuesLegendPanel().getLegend(); |
251 |
fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + "_(Valores_unicos)");
|
252 |
break;
|
253 |
case 2:// break values |
254 |
renderer = fPanelLegendManager.getM_breaksLegendPanel().getLegend(); |
255 |
fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + "_(Intervalos)");
|
256 |
break;
|
257 |
case 3://text |
258 |
fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + "_(Etiquetas_estandar)");
|
259 |
} |
260 |
// System.out.println("Color punto 1 " + renderer.getDefaultSymbol().getColor().toString());
|
261 |
fPanelLegendManager.getM_labelsLegendPanel().updateValuesFromControls((VectorialLegend)renderer); |
262 |
// System.out.println("Color punto 2 " + renderer.getDefaultSymbol().getColor().toString());
|
263 |
try {
|
264 |
// Intentamos aplicar la leyenda a todas
|
265 |
// las capas activas a las que se les pueda aplicar
|
266 |
FLayer[] activeLyrs = mapContext.getLayers().getActives();
|
267 |
for (int i=0; i < activeLyrs.length; i++) |
268 |
{ |
269 |
FLayer laux=activeLyrs[i]; |
270 |
if (activeLyrs[i] instanceof FLayers){ |
271 |
laux=getFirstActiveLayerVect((FLayers)activeLyrs[i]); |
272 |
} |
273 |
if (laux instanceof ClassifiableVectorial) |
274 |
{ |
275 |
ClassifiableVectorial aux2 = (ClassifiableVectorial) laux; |
276 |
if (renderer instanceof ClassifiedLegend) |
277 |
{ |
278 |
// Es una leyenda que necesita un recordset con un
|
279 |
// nombre de campo. Comprobamos que ese recordset
|
280 |
// tiene ese nombre de campo y es del tipo esperado
|
281 |
ClassifiedLegend cl = (ClassifiedLegend) renderer; |
282 |
if (aux2 instanceof AlphanumericData) |
283 |
{ |
284 |
DataSource rs = ((AlphanumericData) aux2).getRecordset();
|
285 |
int idField = rs.getFieldIndexByName(cl.getFieldName());
|
286 |
if (idField != -1) |
287 |
{ |
288 |
//TODO: Aqu? deber?amos comprobar si el tipo de campo
|
289 |
// es el tipo de campo esperado.
|
290 |
if (renderer instanceof VectorialUniqueValueLegend){ |
291 |
((VectorialUniqueValueLegend)renderer).setLabelHeightField(null);
|
292 |
((VectorialUniqueValueLegend)renderer).setLabelRotationField(null);
|
293 |
} |
294 |
|
295 |
aux2.setLegend((VectorialLegend) renderer); |
296 |
} |
297 |
|
298 |
} |
299 |
} |
300 |
else if (renderer instanceof SingleSymbolLegend) |
301 |
aux2.setLegend((VectorialLegend) renderer); |
302 |
} |
303 |
|
304 |
} |
305 |
// aux.setLegend((VectorialLegend) m_Renderer);
|
306 |
|
307 |
} catch (FieldNotFoundException e) {
|
308 |
// TODO Auto-generated catch block
|
309 |
e.printStackTrace(); |
310 |
} catch (DriverException e) {
|
311 |
// TODO Auto-generated catch block
|
312 |
e.printStackTrace(); |
313 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
|
314 |
// TODO Auto-generated catch block
|
315 |
e.printStackTrace(); |
316 |
} |
317 |
|
318 |
if (fPanelScaleManager.getJRadioButton1().isSelected()) {
|
319 |
try
|
320 |
{ |
321 |
layer.setMinScale((nf.parse(fPanelScaleManager.getJTextField1().getText())).doubleValue()); |
322 |
} |
323 |
catch (ParseException ex) |
324 |
{ |
325 |
if (fPanelScaleManager.getJTextField1().getText().compareTo("") == 0) |
326 |
layer.setMinScale(-1);
|
327 |
else
|
328 |
System.err.print(ex.getLocalizedMessage());
|
329 |
} |
330 |
try
|
331 |
{ |
332 |
layer.setMaxScale((nf.parse(fPanelScaleManager.getJTextField2().getText())).doubleValue()); |
333 |
} |
334 |
catch (ParseException ex) |
335 |
{ |
336 |
if (fPanelScaleManager.getJTextField2().getText().compareTo("") == 0) |
337 |
layer.setMaxScale(-1);
|
338 |
else
|
339 |
System.err.print(ex.getLocalizedMessage());
|
340 |
} |
341 |
|
342 |
} else {
|
343 |
layer.setMinScale(-1);
|
344 |
layer.setMaxScale(-1);
|
345 |
} |
346 |
if (!fPanelScaleManager.getLayerName().equals(layer.getName())){
|
347 |
layer.setName(fPanelScaleManager.getLayerName()); |
348 |
} |
349 |
if (layer instanceof FLyrVect) |
350 |
{ |
351 |
FLyrVect lyrVect = (FLyrVect) layer; |
352 |
if (fPanelScaleManager.isSpatialIndexSelected())
|
353 |
{ |
354 |
if (lyrVect.getSpatialIndex() == null) |
355 |
{ |
356 |
lyrVect.createSpatialIndex(); |
357 |
} |
358 |
} |
359 |
else
|
360 |
lyrVect.deleteSpatialIndex(); |
361 |
|
362 |
|
363 |
} |
364 |
//layer.getFMap().invalidate();
|
365 |
layer.getFMap().callLegendChanged(); |
366 |
} |
367 |
|
368 |
/**
|
369 |
* DOCUMENT ME!
|
370 |
*
|
371 |
* @author Fernando Gonz?lez Cort?s
|
372 |
*/
|
373 |
private class ComandosListener implements ActionListener { |
374 |
private FThemeManagerWindow fLayerPropertiesWindow;
|
375 |
|
376 |
/**
|
377 |
* Creates a new ComandosListener object.
|
378 |
*
|
379 |
* @param lg DOCUMENT ME!
|
380 |
*/
|
381 |
public ComandosListener(FThemeManagerWindow fLayerPropertiesWindow) {
|
382 |
this.fLayerPropertiesWindow = fLayerPropertiesWindow;
|
383 |
} |
384 |
|
385 |
/* (non-Javadoc)
|
386 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
387 |
*/
|
388 |
public void actionPerformed(ActionEvent e) { |
389 |
if (e.getActionCommand() == "OK") { |
390 |
// Implementaci?n para hacer funcionar el hyperlink ...
|
391 |
//com.iver.cit.gvsig.gui.View theView = (com.iver.cit.gvsig.gui.View)PluginServices.getMDIManager().getActiveView();
|
392 |
//ProjectView view = theView.getModel();
|
393 |
ProjectView view = fPanelScaleManager.getView(); |
394 |
view.setTypeLink(fPanelScaleManager.getLinkType()); |
395 |
if (fPanelScaleManager.getSelectedLinkField()!=null) |
396 |
{ |
397 |
view.setSelectedField(fPanelScaleManager.getSelectedLinkField().toString().trim()); |
398 |
view.setExtLink(fPanelScaleManager.getExtensionLink()); |
399 |
} |
400 |
//
|
401 |
fLayerPropertiesWindow.btnApply_actionPerformed(e); |
402 |
if (PluginServices.getMainFrame() == null) |
403 |
((JDialog) (getParent().getParent().getParent().getParent())).dispose();
|
404 |
else
|
405 |
PluginServices.getMDIManager().closeView(FThemeManagerWindow.this); |
406 |
System.out.println("Ok"); |
407 |
} else if (e.getActionCommand() == "CANCEL") { |
408 |
if (PluginServices.getMainFrame() == null) |
409 |
((JDialog) (getParent().getParent().getParent().getParent())).dispose();
|
410 |
else
|
411 |
PluginServices.getMDIManager().closeView(FThemeManagerWindow.this); |
412 |
System.out.println("CANCEL"); |
413 |
} else if (e.getActionCommand() == "APPLY") { |
414 |
fLayerPropertiesWindow.btnApply_actionPerformed(e); |
415 |
System.out.println("APPLY"); |
416 |
} else if (e.getActionCommand() == "LOAD_LEGEND") { |
417 |
JFileChooser jfc = new JFileChooser(); |
418 |
jfc.addChoosableFileFilter(new GenericFileFilter("gvl", |
419 |
PluginServices.getText(this, "tipo_de_leyenda"))); |
420 |
jfc.addChoosableFileFilter(new GenericFileFilter("sld","sld")); |
421 |
|
422 |
if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) { |
423 |
File file=jfc.getSelectedFile();
|
424 |
|
425 |
if (!(file.getPath().endsWith(".gvl") || file.getPath().endsWith(".GVL"))) |
426 |
{ |
427 |
file=new File(file.getPath()+".gvl"); |
428 |
} |
429 |
readLegend(file); |
430 |
fPanelLegendManager.setRenderer(renderer); |
431 |
fPanelLegendManager.actualizar(); |
432 |
} |
433 |
} else if (e.getActionCommand() == "SAVE_LEGEND") { |
434 |
fLayerPropertiesWindow.btnApply_actionPerformed(e); |
435 |
JFileChooser jfc = new JFileChooser(); |
436 |
jfc.addChoosableFileFilter(new GenericFileFilter("gvl", |
437 |
PluginServices.getText(this, "tipo_de_leyenda"))); |
438 |
jfc.addChoosableFileFilter(new GenericFileFilter("sld","*.sld")); |
439 |
|
440 |
if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) |
441 |
{ |
442 |
File file=jfc.getSelectedFile();
|
443 |
if (jfc.getFileFilter().accept(new File("dummy.sld"))) |
444 |
{ |
445 |
if (!(file.getPath().toLowerCase().endsWith(".sld"))){ |
446 |
file=new File(file.getPath()+".sld"); |
447 |
} |
448 |
export2SLD(file); |
449 |
} |
450 |
else{
|
451 |
if (!(file.getPath().toLowerCase().endsWith(".gvl"))){ |
452 |
file=new File(file.getPath()+".gvl"); |
453 |
} |
454 |
writeLegend(file); |
455 |
} |
456 |
} |
457 |
} else {}
|
458 |
} |
459 |
} |
460 |
|
461 |
private void export2SLD(File file) { |
462 |
try {
|
463 |
FileWriter writer = new FileWriter(file.getAbsolutePath()); |
464 |
Marshaller m = new Marshaller(writer);
|
465 |
m.setEncoding("ISO-8859-1");
|
466 |
m.marshal(renderer.getSLDString()); |
467 |
} catch (Exception e) { |
468 |
NotificationManager.addError(PluginServices.getText(this, "Error_exportando_SLD"), e); |
469 |
} |
470 |
} |
471 |
|
472 |
private void writeLegend(File file) { |
473 |
try {
|
474 |
FileWriter writer = new FileWriter(file.getAbsolutePath()); |
475 |
Marshaller m = new Marshaller(writer);
|
476 |
m.setEncoding("ISO-8859-1");
|
477 |
m.marshal(renderer.getXMLEntity().getXmlTag()); |
478 |
} catch (Exception e) { |
479 |
NotificationManager.addError(PluginServices.getText(this, "Error_guardando_la_leyenda"), e); |
480 |
} |
481 |
} |
482 |
|
483 |
public void readLegend(File file) { |
484 |
try {
|
485 |
File xmlFile = new File(file.getAbsolutePath()); |
486 |
FileReader reader;
|
487 |
reader = new FileReader(xmlFile); |
488 |
|
489 |
XmlTag tag = (XmlTag) XmlTag.unmarshal(reader); |
490 |
renderer = LegendFactory.createFromXML(new XMLEntity(tag));
|
491 |
//fPanelLegendManager.setRenderer(LegendFactory.createFromXML(new XMLEntity(tag)));
|
492 |
} catch (FileNotFoundException e) { |
493 |
NotificationManager.addError(PluginServices.getText(this, "Al_leer_la_leyenda"), e); |
494 |
} catch (MarshalException e) { |
495 |
NotificationManager.addError(PluginServices.getText(this, "Al leer la leyenda"), e); |
496 |
} catch (ValidationException e) {
|
497 |
NotificationManager.addError(PluginServices.getText(this, "Al leer la leyenda"), e); |
498 |
} catch (XMLException e) {
|
499 |
NotificationManager.addError(PluginServices.getText(this, "Al leer la leyenda"), e); |
500 |
} |
501 |
} |
502 |
|
503 |
/* (non-Javadoc)
|
504 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
505 |
*/
|
506 |
public ViewInfo getViewInfo() {
|
507 |
// Solo se llama una vez
|
508 |
ViewInfo viewInfo = new ViewInfo(ViewInfo.MODELESSDIALOG);
|
509 |
viewInfo.setWidth(650);
|
510 |
viewInfo.setHeight(420);
|
511 |
viewInfo.setTitle(PluginServices.getText(this,"propiedades_del_tema")); |
512 |
return viewInfo;
|
513 |
} |
514 |
|
515 |
/**
|
516 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
517 |
*/
|
518 |
/*public void viewActivated() {
|
519 |
}
|
520 |
|
521 |
public FMap getMapContext() {
|
522 |
return mapContext;
|
523 |
}
|
524 |
public FLayer getLayer() {
|
525 |
return layer;
|
526 |
}
|
527 |
public Legend getRenderer() {
|
528 |
return renderer;
|
529 |
}*/
|
530 |
|
531 |
/**
|
532 |
* @return Returns the organizador.
|
533 |
*/
|
534 |
public JTabbedPane getOrganizador() { |
535 |
return organizador;
|
536 |
} |
537 |
/**
|
538 |
* @param organizador The organizador to set.
|
539 |
*/
|
540 |
public void setOrganizador(JTabbedPane organizador) { |
541 |
this.organizador = organizador;
|
542 |
} |
543 |
} |