svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / toc / TOC.java @ 1103
History | View | Annotate | Download (17.8 KB)
1 |
/*
|
---|---|
2 |
* Created on 13-may-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.cit.gvsig.gui.toc; |
48 |
|
49 |
|
50 |
import java.awt.BorderLayout; |
51 |
import java.awt.Dimension; |
52 |
import java.awt.Point; |
53 |
import java.awt.Rectangle; |
54 |
import java.awt.event.ActionEvent; |
55 |
import java.awt.event.ActionListener; |
56 |
import java.awt.event.ComponentEvent; |
57 |
import java.awt.event.ComponentListener; |
58 |
import java.awt.event.InputEvent; |
59 |
import java.awt.event.MouseAdapter; |
60 |
import java.awt.event.MouseEvent; |
61 |
import java.util.ArrayList; |
62 |
import java.util.Enumeration; |
63 |
import java.util.HashMap; |
64 |
|
65 |
import javax.swing.BorderFactory; |
66 |
import javax.swing.JColorChooser; |
67 |
import javax.swing.JComponent; |
68 |
import javax.swing.JDialog; |
69 |
import javax.swing.JScrollPane; |
70 |
import javax.swing.JTree; |
71 |
import javax.swing.SwingUtilities; |
72 |
import javax.swing.UIManager; |
73 |
import javax.swing.event.TreeExpansionEvent; |
74 |
import javax.swing.event.TreeExpansionListener; |
75 |
import javax.swing.tree.DefaultMutableTreeNode; |
76 |
import javax.swing.tree.DefaultTreeModel; |
77 |
import javax.swing.tree.TreePath; |
78 |
import javax.swing.tree.TreeSelectionModel; |
79 |
|
80 |
import com.iver.andami.PluginServices; |
81 |
import com.iver.cit.gvsig.fmap.AtomicEvent; |
82 |
import com.iver.cit.gvsig.fmap.AtomicEventListener; |
83 |
import com.iver.cit.gvsig.fmap.DriverException; |
84 |
import com.iver.cit.gvsig.fmap.FMap; |
85 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
86 |
import com.iver.cit.gvsig.fmap.layers.CancelationException; |
87 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
88 |
import com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent; |
89 |
import com.iver.cit.gvsig.fmap.layers.LayerCollectionListener; |
90 |
import com.iver.cit.gvsig.fmap.layers.LayerPositionEvent; |
91 |
import com.iver.cit.gvsig.fmap.layers.LegendListener; |
92 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable; |
93 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection; |
94 |
import com.iver.cit.gvsig.fmap.rendering.ClassifiedLegendInfo; |
95 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
96 |
import com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent; |
97 |
|
98 |
/**
|
99 |
* @author fjp
|
100 |
*
|
101 |
* To change the template for this generated type comment go to
|
102 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
103 |
*/
|
104 |
public class TOC extends JComponent implements ITocOrderListener, |
105 |
LegendListener, LayerCollectionListener, |
106 |
TreeExpansionListener, ComponentListener { |
107 |
private FMap mapContext;
|
108 |
private DnDJTree m_Tree;
|
109 |
private DefaultTreeModel m_TreeModel; |
110 |
private DefaultMutableTreeNode m_Root; |
111 |
private TOCRenderer m_TocRenderer;
|
112 |
private JScrollPane m_Scroller; |
113 |
private ArrayList m_Listeners; |
114 |
private HashMap m_ItemsExpanded = new HashMap(); |
115 |
|
116 |
/**
|
117 |
* Clase Listener que reacciona al pulsar sobre el checkbox de un nodo y
|
118 |
* crea un popupmenu al pulsar el bot?n derecho.
|
119 |
*/
|
120 |
class NodeSelectionListener extends MouseAdapter implements ActionListener { |
121 |
JTree tree;
|
122 |
JDialog dlg;
|
123 |
JColorChooser colorChooser;
|
124 |
FPopupMenu popmenu = null;
|
125 |
|
126 |
NodeSelectionListener(JTree tree) {
|
127 |
this.tree = tree;
|
128 |
} |
129 |
|
130 |
public void mouseClicked(MouseEvent e) { |
131 |
int x = e.getX();
|
132 |
int y = e.getY();
|
133 |
int row = tree.getRowForLocation(x, y);
|
134 |
TreePath path = tree.getPathForRow(row);
|
135 |
LayerCollection layers = mapContext.getLayers(); |
136 |
// System.out.println(e.getSource());
|
137 |
|
138 |
if (path != null) { |
139 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); |
140 |
// System.out.println("Evento de rat?n originado por " + e.getSource().getClass().toString());
|
141 |
|
142 |
if (node.getUserObject() instanceof TocItemBranch) { |
143 |
|
144 |
TocItemBranch elTema = (TocItemBranch) node.getUserObject(); |
145 |
FLayer lyr = elTema.getLayer(); |
146 |
lyr.getFMap().beginAtomicEvent(); |
147 |
// Si tenemos may?sculas apretadas es que queremos activar m?s temas.
|
148 |
// Si no, primero desactivamos temas
|
149 |
if (!((e.getModifiers() & InputEvent.SHIFT_MASK) != 0)) |
150 |
{ |
151 |
layers.setAllActives(false);
|
152 |
|
153 |
} |
154 |
|
155 |
lyr.setActive(true);
|
156 |
// Si pertenece a un grupo, lo ponemos activo tambi?n.
|
157 |
FLayer parentLayer = lyr.getParentLayer(); |
158 |
if (parentLayer != null){ |
159 |
parentLayer.setActive(true);
|
160 |
} |
161 |
|
162 |
Point layerNodeLocation = tree.getUI()
|
163 |
.getPathBounds(tree, path) |
164 |
.getLocation(); |
165 |
|
166 |
//Rect?ngulo que representa el checkbox
|
167 |
Rectangle checkBoxBounds = m_TocRenderer.getCheckBoxBounds();
|
168 |
checkBoxBounds.translate((int) layerNodeLocation.getX(),
|
169 |
(int) layerNodeLocation.getY());
|
170 |
|
171 |
if (checkBoxBounds.contains(e.getPoint())) {
|
172 |
lyr.setVisible(!lyr.isVisible()); |
173 |
} |
174 |
|
175 |
//Boton derecho sobre un nodo del arbol
|
176 |
if ((e.getModifiers() & InputEvent.META_MASK) != 0) { |
177 |
popmenu = new FPopupMenu(mapContext, node);
|
178 |
tree.add(popmenu); |
179 |
|
180 |
//System.out.println("boton derecho");
|
181 |
popmenu.show(e.getComponent(), e.getX(), e.getY()); |
182 |
} |
183 |
|
184 |
lyr.getFMap().endAtomicEvent(); |
185 |
|
186 |
} |
187 |
|
188 |
|
189 |
if (node.getUserObject() instanceof TocItemLeaf) |
190 |
{ |
191 |
//Boton derecho sobre un Simbolo
|
192 |
TocItemLeaf auxLeaf = (TocItemLeaf) node.getUserObject(); |
193 |
FSymbol theSym = auxLeaf.getSymbol(); |
194 |
|
195 |
if ((e.getModifiers() & InputEvent.META_MASK) != 0) { |
196 |
popmenu = new FPopupMenu(mapContext, node);
|
197 |
tree.add(popmenu); |
198 |
popmenu.show(e.getComponent(), e.getX(), e.getY()); |
199 |
} |
200 |
} |
201 |
|
202 |
((DefaultTreeModel) tree.getModel()).nodeChanged(node);
|
203 |
|
204 |
if (row == 0) { |
205 |
tree.revalidate(); |
206 |
tree.repaint(); |
207 |
} |
208 |
if (PluginServices.getMainFrame() != null) |
209 |
PluginServices.getMainFrame().enableControls(); |
210 |
} |
211 |
} |
212 |
|
213 |
public void actionPerformed(ActionEvent arg0) { |
214 |
} |
215 |
} |
216 |
|
217 |
|
218 |
public TOC() {
|
219 |
|
220 |
this.setLayout(new BorderLayout()); |
221 |
this.setMinimumSize(new Dimension(100,80)); |
222 |
this.setPreferredSize(new Dimension(100,80)); |
223 |
|
224 |
//Construct the tree.
|
225 |
m_Root = new DefaultMutableTreeNode(java.lang.Object.class); |
226 |
m_TreeModel = new DefaultTreeModel(m_Root); |
227 |
m_Tree = new DnDJTree(m_TreeModel);
|
228 |
|
229 |
m_TocRenderer = new TOCRenderer();
|
230 |
m_Tree.setCellRenderer(m_TocRenderer); |
231 |
|
232 |
m_Tree.setRootVisible(false);
|
233 |
// m_Tree.setExpandsSelectedPaths(true);
|
234 |
// m_Tree.setAutoscrolls(true);
|
235 |
m_Tree.setShowsRootHandles(true);
|
236 |
//Posibilidad de seleccionar de forma aleatoria nodos de la leyenda.
|
237 |
m_Tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
|
238 |
m_Tree.addMouseListener(new NodeSelectionListener(m_Tree));
|
239 |
m_Tree.setBackground(UIManager.getColor("Button.background")); |
240 |
m_Tree.setBorder(BorderFactory.createEtchedBorder());
|
241 |
|
242 |
this.addComponentListener(this); |
243 |
|
244 |
m_Tree.addTreeExpansionListener(this);
|
245 |
|
246 |
m_Tree.addOrderListener(this);
|
247 |
|
248 |
m_Tree.setRowHeight(0); // Para que lo determine el renderer |
249 |
|
250 |
|
251 |
m_Scroller = new JScrollPane(m_Tree); |
252 |
m_Scroller.setBorder(BorderFactory.createEmptyBorder());
|
253 |
|
254 |
// scrollPane.setPreferredSize(new Dimension(80,80));
|
255 |
|
256 |
//Add everything to this panel.
|
257 |
/* GridBagLayout gridbag = new GridBagLayout();
|
258 |
GridBagConstraints c = new GridBagConstraints();
|
259 |
|
260 |
setLayout(gridbag);
|
261 |
|
262 |
c.fill = GridBagConstraints.BOTH;
|
263 |
c.weightx = 1.0;
|
264 |
gridbag.setConstraints(check,c); */
|
265 |
|
266 |
add(m_Scroller); //, BorderLayout.WEST);
|
267 |
|
268 |
// refresh();
|
269 |
|
270 |
} |
271 |
|
272 |
|
273 |
|
274 |
public void setMapContext(FMap mc) { |
275 |
mapContext = mc; |
276 |
mapContext.addAtomicEventListener(new AtomicEventListener() {
|
277 |
/**
|
278 |
* @see com.iver.cit.gvsig.fmap.AtomicEventListener#atomicEvent(com.iver.cit.gvsig.fmap.AtomicEvent)
|
279 |
*/
|
280 |
public void atomicEvent(AtomicEvent e) { |
281 |
if ((e.getLayerCollectionEvents().length > 0) || |
282 |
(e.getLegendEvents().length > 0))
|
283 |
SwingUtilities.invokeLater(new Runnable() { |
284 |
public void run() { |
285 |
refresh(); |
286 |
} |
287 |
}); |
288 |
if (e.getLayerEvents().length > 0) { |
289 |
repaint(); |
290 |
} |
291 |
} |
292 |
}); |
293 |
|
294 |
SwingUtilities.invokeLater(new Runnable() { |
295 |
public void run() { |
296 |
refresh(); |
297 |
} |
298 |
}); |
299 |
} |
300 |
|
301 |
private void setExpandedNodes() |
302 |
{ |
303 |
int i = 0; |
304 |
// Las claves sobrantes de m_ItemsExpanded (provocadas
|
305 |
// por layerRemove, se quitan en el evento layerRemoved
|
306 |
// de este TOC
|
307 |
DefaultMutableTreeNode n;
|
308 |
Enumeration enum = m_Root.children(); |
309 |
while (enum.hasMoreElements()) |
310 |
{ |
311 |
n = (DefaultMutableTreeNode) enum.nextElement(); |
312 |
TreePath path = new TreePath(m_TreeModel.getPathToRoot(n)); |
313 |
ITocItem item = (ITocItem) n.getUserObject(); |
314 |
Boolean b = (Boolean) m_ItemsExpanded.get(item.getLabel()); |
315 |
if (b == null) // No estaba en el hash todav?a: valor por defecto |
316 |
{ |
317 |
// System.out.println("Primera expansi?n de " + item.getLabel());
|
318 |
m_Tree.expandPath(path); |
319 |
return;
|
320 |
} |
321 |
if (b.booleanValue())
|
322 |
{ |
323 |
// System.out.println("Expansi?n de " + item.getLabel());
|
324 |
m_Tree.expandPath(path); |
325 |
} |
326 |
else
|
327 |
{ |
328 |
// System.out.println("Colapso de " + item.getLabel());
|
329 |
m_Tree.collapsePath(path); |
330 |
} |
331 |
} |
332 |
|
333 |
} |
334 |
|
335 |
/* (non-Javadoc)
|
336 |
* @see com.iver.cit.opensig.gui.IToc#refresh()
|
337 |
*/
|
338 |
public void refresh() { |
339 |
LayerCollection theLayers = mapContext.getLayers(); |
340 |
m_Root.removeAllChildren(); |
341 |
m_Root.setAllowsChildren(true);
|
342 |
System.out.println("Refresh del toc"); |
343 |
doRefresh(theLayers, m_Root); |
344 |
|
345 |
m_TreeModel.reload(); |
346 |
|
347 |
setExpandedNodes(); |
348 |
} |
349 |
private void doRefresh(LayerCollection theLayers, DefaultMutableTreeNode parentNode) |
350 |
{ |
351 |
Dimension sizeLeaf = new Dimension(m_Tree.getWidth(), 15); |
352 |
Dimension sizeBranch = new Dimension(m_Tree.getWidth(), 25); |
353 |
for (int i=theLayers.getLayersCount()-1;i>=0; i--) |
354 |
{ |
355 |
FLayer lyr = theLayers.getLayer(i); |
356 |
TocItemBranch elTema = new TocItemBranch(lyr);
|
357 |
elTema.setSize(sizeBranch); |
358 |
DefaultMutableTreeNode nodeLayer = new DefaultMutableTreeNode(elTema); |
359 |
|
360 |
m_TreeModel.insertNodeInto(nodeLayer, parentNode, parentNode.getChildCount()); |
361 |
TreePath path = new TreePath(m_TreeModel.getPathToRoot(nodeLayer)); |
362 |
// m_Tree.makeVisible(path);
|
363 |
if (lyr instanceof LayerCollection) |
364 |
{ |
365 |
LayerCollection group = (LayerCollection) lyr; |
366 |
doRefresh(group, nodeLayer); |
367 |
} |
368 |
else
|
369 |
{ |
370 |
if (lyr instanceof Classifiable) |
371 |
{ |
372 |
Classifiable aux = (Classifiable) lyr; |
373 |
Legend legendInfo = aux.getLegend(); |
374 |
try {
|
375 |
if (legendInfo instanceof ClassifiedLegendInfo) |
376 |
{ |
377 |
ClassifiedLegendInfo cl = (ClassifiedLegendInfo) legendInfo; |
378 |
String[] descriptions = cl.getDescriptions(); |
379 |
FSymbol[] symbols = cl.getSymbols();
|
380 |
for (int j=0; j<descriptions.length;j++) |
381 |
{ |
382 |
TocItemLeaf itemLeaf; |
383 |
itemLeaf = new TocItemLeaf(symbols[j],descriptions[j], aux.getShapeType());
|
384 |
itemLeaf.setSize(sizeLeaf); |
385 |
DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(itemLeaf); |
386 |
m_TreeModel.insertNodeInto(nodeValue, nodeLayer, nodeLayer.getChildCount()); |
387 |
TreePath pathSymbol = new TreePath(m_TreeModel.getPathToRoot(nodeValue)); |
388 |
// m_Tree.makeVisible(pathSymbol);
|
389 |
} |
390 |
} |
391 |
if (legendInfo.getDefaultSymbol() != null) |
392 |
{ |
393 |
TocItemLeaf itemLeaf; |
394 |
itemLeaf = new TocItemLeaf(legendInfo.getDefaultSymbol(),"Default", aux.getShapeType()); |
395 |
itemLeaf.setSize(sizeLeaf); |
396 |
DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(itemLeaf); |
397 |
m_TreeModel.insertNodeInto(nodeValue, nodeLayer, nodeLayer.getChildCount()); |
398 |
TreePath pathSymbol = new TreePath(m_TreeModel.getPathToRoot(nodeValue)); |
399 |
// m_Tree.makeVisible(pathSymbol);
|
400 |
} |
401 |
} catch (DriverException e) {
|
402 |
// TODO Auto-generated catch block
|
403 |
e.printStackTrace(); |
404 |
} |
405 |
} |
406 |
|
407 |
} // if instanceof layers
|
408 |
|
409 |
} |
410 |
|
411 |
} |
412 |
|
413 |
/**
|
414 |
* @see com.iver.cit.opensig.gui.toc.ITocOrderListener#orderChanged(int, int)
|
415 |
*/
|
416 |
public void orderChanged(int oldPos, int newPos) { |
417 |
LayerCollection layers = mapContext.getLayers(); |
418 |
// El orden es el contrario, hay que traducir.
|
419 |
// El orden es el contrario, hay que traducir.
|
420 |
oldPos = layers.getLayersCount() -1 - oldPos;
|
421 |
newPos = layers.getLayersCount() -1 - newPos;
|
422 |
try {
|
423 |
layers.moveTo(oldPos, newPos); |
424 |
} catch (CancelationException e) {
|
425 |
// TODO Auto-generated catch block
|
426 |
e.printStackTrace(); |
427 |
} |
428 |
// No hace falta un refresh, lo hace mediante eventos.
|
429 |
// refresh();
|
430 |
} |
431 |
|
432 |
|
433 |
|
434 |
/* (non-Javadoc)
|
435 |
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
436 |
*/
|
437 |
public void componentHidden(ComponentEvent e) { |
438 |
|
439 |
|
440 |
} |
441 |
|
442 |
|
443 |
|
444 |
/* (non-Javadoc)
|
445 |
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
446 |
*/
|
447 |
public void componentMoved(ComponentEvent e) { |
448 |
|
449 |
|
450 |
} |
451 |
|
452 |
|
453 |
|
454 |
/* (non-Javadoc)
|
455 |
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
456 |
*/
|
457 |
public void componentResized(ComponentEvent e) { |
458 |
System.out.println("Cambiando tama?o."); |
459 |
|
460 |
int i = 0; |
461 |
DefaultMutableTreeNode n;
|
462 |
Enumeration enum = m_Root.children(); |
463 |
while (enum.hasMoreElements()) |
464 |
{ |
465 |
n = (DefaultMutableTreeNode) enum.nextElement(); |
466 |
if (n.getUserObject() instanceof TocItemBranch) |
467 |
{ |
468 |
|
469 |
ITocItem item = (ITocItem) n.getUserObject(); |
470 |
Dimension szAnt = item.getSize();
|
471 |
item.setSize(new Dimension(this.getWidth()-40,szAnt.height)); |
472 |
} |
473 |
System.out.println("i=" + i++); |
474 |
} |
475 |
// m_Tree.setSize(this.getSize());
|
476 |
|
477 |
System.out.println("Ancho del tree=" + m_Tree.getWidth() + " " + m_Tree.getComponentCount()); |
478 |
System.out.println("Ancho del TOC=" + this.getWidth()); |
479 |
// m_Tree.repaint();
|
480 |
|
481 |
|
482 |
} |
483 |
|
484 |
|
485 |
|
486 |
/* (non-Javadoc)
|
487 |
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
488 |
*/
|
489 |
public void componentShown(ComponentEvent e) { |
490 |
|
491 |
|
492 |
} |
493 |
|
494 |
|
495 |
|
496 |
/* (non-Javadoc)
|
497 |
* @see com.iver.cit.gvsig.fmap.layers.LayerListener#legendChanged(com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent)
|
498 |
*/
|
499 |
public void legendChanged(LegendChangedEvent e) { |
500 |
System.out.println("Refrescando TOC"); |
501 |
refresh(); |
502 |
} |
503 |
|
504 |
|
505 |
|
506 |
/* (non-Javadoc)
|
507 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdded(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
508 |
*/
|
509 |
public void layerAdded(LayerCollectionEvent e) { |
510 |
refresh(); |
511 |
|
512 |
} |
513 |
|
514 |
|
515 |
|
516 |
/* (non-Javadoc)
|
517 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
|
518 |
*/
|
519 |
public void layerMoved(LayerPositionEvent e) { |
520 |
refresh(); |
521 |
} |
522 |
|
523 |
|
524 |
|
525 |
/* (non-Javadoc)
|
526 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoved(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
527 |
*/
|
528 |
public void layerRemoved(LayerCollectionEvent e) { |
529 |
m_ItemsExpanded.remove(e.getAffectedLayer().getName()); |
530 |
refresh(); |
531 |
|
532 |
} |
533 |
|
534 |
|
535 |
|
536 |
/* (non-Javadoc)
|
537 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdding(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
538 |
*/
|
539 |
public void layerAdding(LayerCollectionEvent e) throws CancelationException { |
540 |
|
541 |
} |
542 |
|
543 |
|
544 |
|
545 |
/* (non-Javadoc)
|
546 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoving(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
|
547 |
*/
|
548 |
public void layerMoving(LayerPositionEvent e) throws CancelationException { |
549 |
|
550 |
} |
551 |
|
552 |
|
553 |
|
554 |
/* (non-Javadoc)
|
555 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoving(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
556 |
*/
|
557 |
public void layerRemoving(LayerCollectionEvent e) throws CancelationException { |
558 |
|
559 |
} |
560 |
|
561 |
|
562 |
|
563 |
/* (non-Javadoc)
|
564 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#activationChanged(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
565 |
*/
|
566 |
public void activationChanged(LayerCollectionEvent e) throws CancelationException { |
567 |
repaint(); |
568 |
|
569 |
} |
570 |
|
571 |
|
572 |
|
573 |
/* (non-Javadoc)
|
574 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
575 |
*/
|
576 |
public void visibilityChanged(LayerCollectionEvent e) throws CancelationException { |
577 |
repaint(); |
578 |
|
579 |
} |
580 |
|
581 |
|
582 |
|
583 |
/* (non-Javadoc)
|
584 |
* @see javax.swing.event.TreeExpansionListener#treeCollapsed(javax.swing.event.TreeExpansionEvent)
|
585 |
*/
|
586 |
public void treeCollapsed(TreeExpansionEvent event) { |
587 |
TreePath path = event.getPath();
|
588 |
DefaultMutableTreeNode n = (DefaultMutableTreeNode)path.getLastPathComponent(); |
589 |
if (n.getUserObject() instanceof ITocItem) |
590 |
{ |
591 |
ITocItem item = (ITocItem) n.getUserObject(); |
592 |
Boolean b = Boolean.FALSE; |
593 |
// System.out.println("Collapsed: " + item.getLabel());
|
594 |
m_ItemsExpanded.put(item.getLabel(), b); |
595 |
} |
596 |
} |
597 |
|
598 |
|
599 |
|
600 |
/* (non-Javadoc)
|
601 |
* @see javax.swing.event.TreeExpansionListener#treeExpanded(javax.swing.event.TreeExpansionEvent)
|
602 |
*/
|
603 |
public void treeExpanded(TreeExpansionEvent event) { |
604 |
TreePath path = event.getPath();
|
605 |
DefaultMutableTreeNode n = (DefaultMutableTreeNode)path.getLastPathComponent(); |
606 |
if (n.getUserObject() instanceof ITocItem) |
607 |
{ |
608 |
ITocItem item = (ITocItem) n.getUserObject(); |
609 |
Boolean b = Boolean.TRUE; |
610 |
// System.out.println("Expanded: " + item.getLabel());
|
611 |
m_ItemsExpanded.put(item.getLabel(), b); |
612 |
} |
613 |
|
614 |
} |
615 |
|
616 |
|
617 |
} |