22 |
22 |
package com.iver.cit.gvsig.project.documents.view.toc.impl;
|
23 |
23 |
|
24 |
24 |
import java.awt.BorderLayout;
|
|
25 |
import java.awt.Dialog.ModalityType;
|
25 |
26 |
import java.awt.Dimension;
|
|
27 |
import java.awt.Frame;
|
26 |
28 |
import java.awt.Image;
|
|
29 |
import java.awt.MouseInfo;
|
27 |
30 |
import java.awt.Point;
|
|
31 |
import java.awt.PointerInfo;
|
28 |
32 |
import java.awt.Rectangle;
|
29 |
33 |
import java.awt.event.ActionEvent;
|
30 |
34 |
import java.awt.event.ActionListener;
|
... | ... | |
33 |
37 |
import java.awt.event.InputEvent;
|
34 |
38 |
import java.awt.event.MouseAdapter;
|
35 |
39 |
import java.awt.event.MouseEvent;
|
|
40 |
import java.lang.reflect.InvocationTargetException;
|
36 |
41 |
import java.util.ArrayList;
|
37 |
42 |
import java.util.Enumeration;
|
38 |
43 |
import java.util.HashMap;
|
... | ... | |
44 |
49 |
import javax.swing.JColorChooser;
|
45 |
50 |
import javax.swing.JComponent;
|
46 |
51 |
import javax.swing.JDialog;
|
|
52 |
import javax.swing.JMenuItem;
|
|
53 |
import javax.swing.JPopupMenu;
|
47 |
54 |
import javax.swing.JScrollBar;
|
48 |
55 |
import javax.swing.JScrollPane;
|
49 |
56 |
import javax.swing.JTree;
|
... | ... | |
56 |
63 |
import javax.swing.tree.TreePath;
|
57 |
64 |
import javax.swing.tree.TreeSelectionModel;
|
58 |
65 |
|
|
66 |
import org.apache.log4j.Logger;
|
|
67 |
import org.gvsig.fmap.swing.toc.TOC;
|
|
68 |
import org.gvsig.fmap.swing.toc.TOCFactory;
|
|
69 |
import org.gvsig.fmap.swing.toc.TOCLocator;
|
|
70 |
import org.gvsig.fmap.swing.toc.action.TOCAction;
|
|
71 |
import org.gvsig.fmap.swing.toc.event.ActiveLayerChangeEvent;
|
|
72 |
import org.gvsig.fmap.swing.toc.event.ActiveLayerChangeEventListener;
|
|
73 |
import org.gvsig.fmap.swing.toc.event.LayerActionEvent;
|
|
74 |
import org.gvsig.fmap.swing.toc.event.LayerActionEventListener;
|
|
75 |
import org.gvsig.fmap.swing.toc.event.LegendActionEvent;
|
|
76 |
import org.gvsig.fmap.swing.toc.event.LegendActionEventListener;
|
|
77 |
import org.gvsig.tools.dynobject.DynObject;
|
|
78 |
import org.gvsig.tools.service.Manager;
|
|
79 |
import org.gvsig.tools.service.ServiceException;
|
|
80 |
|
59 |
81 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
|
60 |
82 |
import com.iver.andami.PluginServices;
|
61 |
83 |
import com.iver.andami.messages.NotificationManager;
|
... | ... | |
86 |
108 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocOrderListener;
|
87 |
109 |
import com.iver.cit.gvsig.project.documents.view.toc.TocItemBranch;
|
88 |
110 |
import com.iver.cit.gvsig.project.documents.view.toc.TocItemLeaf;
|
|
111 |
import com.iver.cit.gvsig.project.documents.view.toc.actions.MyMoveListener;
|
89 |
112 |
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu;
|
90 |
113 |
import com.iver.cit.gvsig.project.documents.view.toc.util.EventUtil;
|
91 |
114 |
|
92 |
|
import org.apache.log4j.Logger;
|
93 |
|
|
94 |
|
import org.gvsig.fmap.swing.toc.TOC;
|
95 |
|
import org.gvsig.fmap.swing.toc.TOCFactory;
|
96 |
|
import org.gvsig.fmap.swing.toc.TOCLocator;
|
97 |
|
import org.gvsig.fmap.swing.toc.action.TOCAction;
|
98 |
|
import org.gvsig.fmap.swing.toc.event.ActiveLayerChangeEvent;
|
99 |
|
import org.gvsig.fmap.swing.toc.event.ActiveLayerChangeEventListener;
|
100 |
|
import org.gvsig.fmap.swing.toc.event.LayerActionEvent;
|
101 |
|
import org.gvsig.fmap.swing.toc.event.LayerActionEventListener;
|
102 |
|
import org.gvsig.fmap.swing.toc.event.LegendActionEvent;
|
103 |
|
import org.gvsig.fmap.swing.toc.event.LegendActionEventListener;
|
104 |
|
import org.gvsig.tools.dynobject.DynObject;
|
105 |
|
import org.gvsig.tools.service.Manager;
|
106 |
|
import org.gvsig.tools.service.ServiceException;
|
107 |
|
|
108 |
115 |
/**
|
109 |
|
* Default implementation of the TOC. It's the original gvSIG "TOC.java"
|
110 |
|
* with little changes to make it implement the new TOC interface
|
|
116 |
* Default implementation of the TOC. It's the original gvSIG "TOC.java" with
|
|
117 |
* little changes to make it implement the new TOC interface
|
111 |
118 |
*
|
112 |
119 |
* @author gvSIG Team
|
113 |
120 |
* @author Juan Lucas Dominguez jldominguez prodevelop es
|
114 |
121 |
* @version $Id$
|
115 |
|
*
|
|
122 |
*
|
116 |
123 |
*/
|
117 |
124 |
public class DefaultToc extends JComponent implements TOC,
|
118 |
|
TreeExpansionListener, ComponentListener, ITocOrderListener,
|
119 |
|
LegendListener, LayerCollectionListener {
|
|
125 |
TreeExpansionListener, ComponentListener, ITocOrderListener,
|
|
126 |
LegendListener, LayerCollectionListener {
|
120 |
127 |
|
121 |
|
/**
|
|
128 |
/**
|
122 |
129 |
*
|
123 |
130 |
*/
|
124 |
|
private static final long serialVersionUID = 8704106636809906947L;
|
|
131 |
private static final long serialVersionUID = 8704106636809906947L;
|
125 |
132 |
|
126 |
|
private static Logger logger = Logger.getLogger(DefaultToc.class);
|
|
133 |
private static Logger logger = Logger.getLogger(DefaultToc.class);
|
127 |
134 |
|
|
135 |
/**
|
|
136 |
* String key to be used in persisted properties
|
|
137 |
*/
|
|
138 |
public static final String TOC_CURRENT_TOC_KEY = "TOC_CURRENT_TOC";
|
128 |
139 |
|
129 |
|
/**
|
130 |
|
* String key to be used in persisted properties
|
131 |
|
*/
|
132 |
|
public static final String TOC_CURRENT_TOC_KEY = "TOC_CURRENT_TOC";
|
|
140 |
// =======================================
|
133 |
141 |
|
134 |
|
// =======================================
|
|
142 |
private MapContext mapContext;
|
|
143 |
private DnDJTree m_Tree;
|
|
144 |
private DefaultTreeModel m_TreeModel;
|
|
145 |
private DefaultMutableTreeNode m_Root;
|
|
146 |
private TOCRenderer m_TocRenderer;
|
|
147 |
private JScrollPane m_Scroller;
|
135 |
148 |
|
136 |
|
private MapContext mapContext;
|
137 |
|
private DnDJTree m_Tree;
|
138 |
|
private DefaultTreeModel m_TreeModel;
|
139 |
|
private DefaultMutableTreeNode m_Root;
|
140 |
|
private TOCRenderer m_TocRenderer;
|
141 |
|
private JScrollPane m_Scroller;
|
|
149 |
// private ArrayList m_Listeners;
|
|
150 |
private HashMap m_ItemsExpanded = new HashMap();
|
|
151 |
private NodeSelectionListener nodeSelectionListener = null;
|
142 |
152 |
|
143 |
|
// private ArrayList m_Listeners;
|
144 |
|
private HashMap m_ItemsExpanded = new HashMap();
|
145 |
|
private NodeSelectionListener nodeSelectionListener = null;
|
|
153 |
private TOCFactory tocFactory = null;
|
146 |
154 |
|
147 |
|
private TOCFactory tocFactory = null;
|
|
155 |
private ArrayList activeLayerChangeListeners = new ArrayList();
|
|
156 |
private ArrayList legendActionListeners = new ArrayList();
|
|
157 |
private ArrayList layerActionListeners = new ArrayList();
|
148 |
158 |
|
149 |
|
private ArrayList activeLayerChangeListeners = new ArrayList();
|
150 |
|
private ArrayList legendActionListeners = new ArrayList();
|
151 |
|
private ArrayList layerActionListeners = new ArrayList();
|
|
159 |
public DefaultToc(TOCFactory tf) {
|
152 |
160 |
|
153 |
|
public DefaultToc(TOCFactory tf) {
|
|
161 |
tocFactory = tf;
|
154 |
162 |
|
155 |
|
tocFactory = tf;
|
|
163 |
this.setLayout(new BorderLayout());
|
|
164 |
this.setMinimumSize(new Dimension(100, 80));
|
|
165 |
this.setPreferredSize(new Dimension(100, 80));
|
156 |
166 |
|
157 |
|
this.setLayout(new BorderLayout());
|
158 |
|
this.setMinimumSize(new Dimension(100, 80));
|
159 |
|
this.setPreferredSize(new Dimension(100, 80));
|
|
167 |
// Construct the tree.
|
|
168 |
m_Root = new DefaultMutableTreeNode(java.lang.Object.class);
|
|
169 |
m_TreeModel = new DefaultTreeModel(m_Root);
|
|
170 |
m_Tree = new DnDJTree(m_TreeModel);
|
160 |
171 |
|
161 |
|
// Construct the tree.
|
162 |
|
m_Root = new DefaultMutableTreeNode(java.lang.Object.class);
|
163 |
|
m_TreeModel = new DefaultTreeModel(m_Root);
|
164 |
|
m_Tree = new DnDJTree(m_TreeModel);
|
|
172 |
m_TocRenderer = new TOCRenderer();
|
|
173 |
m_Tree.setCellRenderer(m_TocRenderer);
|
165 |
174 |
|
166 |
|
m_TocRenderer = new TOCRenderer();
|
167 |
|
m_Tree.setCellRenderer(m_TocRenderer);
|
|
175 |
m_Tree.setRootVisible(false);
|
168 |
176 |
|
169 |
|
m_Tree.setRootVisible(false);
|
|
177 |
m_Tree.setShowsRootHandles(true);
|
170 |
178 |
|
171 |
|
m_Tree.setShowsRootHandles(true);
|
|
179 |
// Posibilidad de seleccionar de forma aleatoria nodos de la leyenda.
|
|
180 |
m_Tree.getSelectionModel().setSelectionMode(
|
|
181 |
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
|
|
182 |
nodeSelectionListener = new NodeSelectionListener(m_Tree, this);
|
|
183 |
m_Tree.addMouseListener(nodeSelectionListener);
|
|
184 |
m_Tree.setBackground(UIManager.getColor("Button.background"));
|
|
185 |
m_Tree.setBorder(BorderFactory.createEtchedBorder());
|
172 |
186 |
|
173 |
|
// Posibilidad de seleccionar de forma aleatoria nodos de la leyenda.
|
174 |
|
m_Tree.getSelectionModel().setSelectionMode(
|
175 |
|
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
|
176 |
|
nodeSelectionListener = new NodeSelectionListener(m_Tree, this);
|
177 |
|
m_Tree.addMouseListener(nodeSelectionListener);
|
178 |
|
m_Tree.setBackground(UIManager.getColor("Button.background"));
|
179 |
|
m_Tree.setBorder(BorderFactory.createEtchedBorder());
|
|
187 |
this.addComponentListener(this);
|
180 |
188 |
|
181 |
|
this.addComponentListener(this);
|
|
189 |
m_Tree.addTreeExpansionListener(this);
|
182 |
190 |
|
183 |
|
m_Tree.addTreeExpansionListener(this);
|
|
191 |
m_Tree.addOrderListener(this); // listenerx
|
184 |
192 |
|
185 |
|
m_Tree.addOrderListener(this); // listenerx
|
|
193 |
m_Tree.setRowHeight(0); // Para que lo determine el renderer
|
186 |
194 |
|
187 |
|
m_Tree.setRowHeight(0); // Para que lo determine el renderer
|
|
195 |
m_Scroller = new JScrollPane(m_Tree);
|
|
196 |
m_Scroller.setBorder(BorderFactory.createEmptyBorder());
|
188 |
197 |
|
189 |
|
m_Scroller = new JScrollPane(m_Tree);
|
190 |
|
m_Scroller.setBorder(BorderFactory.createEmptyBorder());
|
|
198 |
add(m_Scroller);
|
|
199 |
}
|
191 |
200 |
|
192 |
|
add(m_Scroller);
|
193 |
|
}
|
|
201 |
public JComponent getComponent() {
|
|
202 |
return this;
|
|
203 |
}
|
194 |
204 |
|
195 |
|
public JComponent getComponent() {
|
196 |
|
return this;
|
197 |
|
}
|
|
205 |
public MapContext getMapContext() {
|
|
206 |
return mapContext;
|
|
207 |
}
|
198 |
208 |
|
199 |
|
public MapContext getMapContext() {
|
200 |
|
return mapContext;
|
201 |
|
}
|
|
209 |
public void makeTocVisibleAreaIncludeLayer(FLayer lyr) {
|
202 |
210 |
|
203 |
|
public void makeTocVisibleAreaIncludeLayer(FLayer lyr) {
|
|
211 |
int pos = 0;
|
|
212 |
FLayers plyr = lyr.getParentLayer();
|
|
213 |
if (plyr != null) {
|
|
214 |
try {
|
|
215 |
pos = getIndexForChild(plyr, lyr);
|
|
216 |
} catch (Exception e) {
|
|
217 |
logger.error("While proving layer is listed in TOC. ", e);
|
|
218 |
}
|
|
219 |
}
|
204 |
220 |
|
205 |
|
int pos = 0;
|
206 |
|
FLayers plyr = lyr.getParentLayer();
|
207 |
|
if (plyr != null) {
|
208 |
|
try {
|
209 |
|
pos = getIndexForChild(plyr, lyr);
|
210 |
|
} catch (Exception e) {
|
211 |
|
logger.error("While proving layer is listed in TOC. ", e);
|
212 |
|
}
|
213 |
|
}
|
|
221 |
JScrollBar verticalBar = m_Scroller.getVerticalScrollBar();
|
|
222 |
double widthPerEntry = verticalBar.getMaximum()
|
|
223 |
/ lyr.getMapContext().getLayers().getLayersCount();
|
|
224 |
verticalBar.setValue((int) widthPerEntry
|
|
225 |
* (lyr.getMapContext().getLayers().getLayersCount() - pos - 1));
|
|
226 |
}
|
214 |
227 |
|
215 |
|
JScrollBar verticalBar = m_Scroller.getVerticalScrollBar();
|
216 |
|
double widthPerEntry =
|
217 |
|
verticalBar.getMaximum()
|
218 |
|
/ lyr.getMapContext().getLayers().getLayersCount();
|
219 |
|
verticalBar.setValue((int) widthPerEntry
|
220 |
|
* (lyr.getMapContext().getLayers().getLayersCount() - pos - 1));
|
221 |
|
}
|
|
228 |
private int getIndexForChild(FLayers _lyrs, FLayer _lyr) throws Exception {
|
222 |
229 |
|
223 |
|
private int getIndexForChild(FLayers _lyrs, FLayer _lyr) throws Exception {
|
|
230 |
int cnt = _lyrs.getLayersCount();
|
|
231 |
for (int i = 0; i < cnt; i++) {
|
|
232 |
if (_lyr == _lyrs.getLayer(i)) {
|
|
233 |
return i;
|
|
234 |
}
|
|
235 |
}
|
|
236 |
throw new Exception("Layer not found in FLayers");
|
|
237 |
}
|
224 |
238 |
|
225 |
|
int cnt = _lyrs.getLayersCount();
|
226 |
|
for (int i = 0; i < cnt; i++) {
|
227 |
|
if (_lyr == _lyrs.getLayer(i)) {
|
228 |
|
return i;
|
229 |
|
}
|
230 |
|
}
|
231 |
|
throw new Exception("Layer not found in FLayers");
|
232 |
|
}
|
|
239 |
public void refresh(FLayer lyr) {
|
|
240 |
// needs to be improved
|
|
241 |
refresh();
|
|
242 |
}
|
233 |
243 |
|
234 |
|
public void refresh(FLayer lyr) {
|
235 |
|
// needs to be improved
|
236 |
|
refresh();
|
237 |
|
}
|
|
244 |
// =============================================
|
238 |
245 |
|
239 |
|
// =============================================
|
|
246 |
/**
|
|
247 |
* Set the FMap. Not part of the API. Used only by DefaultTOCFactory
|
|
248 |
*
|
|
249 |
* @param mc
|
|
250 |
* FMap.
|
|
251 |
*/
|
|
252 |
public void setMapContext(MapContext mc) {
|
240 |
253 |
|
241 |
|
/**
|
242 |
|
* Set the FMap. Not part of the API. Used only by DefaultTOCFactory
|
243 |
|
*
|
244 |
|
* @param mc
|
245 |
|
* FMap.
|
246 |
|
*/
|
247 |
|
public void setMapContext(MapContext mc) {
|
|
254 |
if (mapContext == mc) {
|
|
255 |
return;
|
|
256 |
}
|
248 |
257 |
|
249 |
|
if (mapContext == mc) {
|
250 |
|
return;
|
251 |
|
}
|
|
258 |
mapContext = mc;
|
252 |
259 |
|
253 |
|
mapContext = mc;
|
|
260 |
mapContext.getLayers().addLegendListener(this);
|
254 |
261 |
|
255 |
|
mapContext.getLayers().addLegendListener(this);
|
|
262 |
mapContext.addAtomicEventListener(new AtomicEventListener() {
|
256 |
263 |
|
257 |
|
mapContext.addAtomicEventListener(new AtomicEventListener() {
|
|
264 |
/**
|
|
265 |
* @see com.iver.cit.gvsig.fmap.AtomicEventListener#atomicEvent(com.iver.cit.gvsig.fmap.AtomicEvent)
|
|
266 |
*/
|
|
267 |
public void atomicEvent(AtomicEvent e) {
|
|
268 |
if ((e.getLayerCollectionEvents().length > 0)
|
|
269 |
|| (e.getLegendEvents().length > 0)) {
|
|
270 |
// for (LayerCollectionEvent ev : e.getLayerCollectionEvents()) {
|
|
271 |
// System.out.println("Evento: " + ev.getEventType() + " " + ev.getAffectedLayer().getName());
|
|
272 |
// }
|
|
273 |
SwingUtilities.invokeLater(new Runnable() {
|
258 |
274 |
|
259 |
|
/**
|
260 |
|
* @see com.iver.cit.gvsig.fmap.AtomicEventListener#atomicEvent(com.iver.cit.gvsig.fmap.AtomicEvent)
|
261 |
|
*/
|
262 |
|
public void atomicEvent(AtomicEvent e) {
|
263 |
|
if ((e.getLayerCollectionEvents().length > 0)
|
264 |
|
|| (e.getLegendEvents().length > 0)) {
|
265 |
|
SwingUtilities.invokeLater(new Runnable() {
|
|
275 |
public void run() {
|
|
276 |
refresh();
|
|
277 |
}
|
|
278 |
});
|
|
279 |
}
|
266 |
280 |
|
267 |
|
public void run() {
|
268 |
|
refresh();
|
269 |
|
}
|
270 |
|
});
|
271 |
|
}
|
|
281 |
if (e.getLayerEvents().length > 0) {
|
|
282 |
repaint();
|
|
283 |
}
|
272 |
284 |
|
273 |
|
if (e.getLayerEvents().length > 0) {
|
274 |
|
repaint();
|
275 |
|
}
|
|
285 |
if (e.getExtentEvents().length > 0) {
|
|
286 |
repaint();
|
|
287 |
}
|
|
288 |
}
|
|
289 |
});
|
276 |
290 |
|
277 |
|
if (e.getExtentEvents().length > 0) {
|
278 |
|
repaint();
|
279 |
|
}
|
280 |
|
}
|
281 |
|
});
|
|
291 |
SwingUtilities.invokeLater(new Runnable() {
|
282 |
292 |
|
283 |
|
SwingUtilities.invokeLater(new Runnable() {
|
|
293 |
public void run() {
|
|
294 |
refresh();
|
|
295 |
}
|
|
296 |
});
|
|
297 |
}
|
284 |
298 |
|
285 |
|
public void run() {
|
286 |
|
refresh();
|
287 |
|
}
|
288 |
|
});
|
289 |
|
}
|
|
299 |
/**
|
|
300 |
* DOCUMENT ME!
|
|
301 |
*/
|
|
302 |
private void setExpandedNodes(DefaultMutableTreeNode node) {
|
|
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 enumeration = node.children();
|
290 |
309 |
|
291 |
|
/**
|
292 |
|
* DOCUMENT ME!
|
293 |
|
*/
|
294 |
|
private void setExpandedNodes(DefaultMutableTreeNode node) {
|
295 |
|
// int i = 0;
|
296 |
|
// Las claves sobrantes de m_ItemsExpanded (provocadas
|
297 |
|
// por layerRemove, se quitan en el evento layerRemoved
|
298 |
|
// de este TOC
|
299 |
|
DefaultMutableTreeNode n;
|
300 |
|
Enumeration enumeration = node.children();
|
|
310 |
// Si el padre no est? expandido, no sigas.
|
|
311 |
TreePath pathParent = new TreePath(node);
|
|
312 |
if (node.getUserObject() instanceof ITocItem) {
|
|
313 |
ITocItem itemP = (ITocItem) node.getUserObject();
|
|
314 |
if (itemP != null) {
|
|
315 |
Boolean b = (Boolean) m_ItemsExpanded.get(itemP.getLabel());
|
|
316 |
if ((b!=null) && (b.booleanValue()==false)) {
|
|
317 |
// m_Tree.collapsePath(pathParent);
|
|
318 |
return;
|
|
319 |
}
|
|
320 |
}
|
|
321 |
}
|
|
322 |
// System.out.println("Expandiendo el nodo " + node.getUserObject());
|
|
323 |
|
|
324 |
while (enumeration.hasMoreElements()) {
|
|
325 |
|
|
326 |
n = (DefaultMutableTreeNode) enumeration.nextElement();
|
|
327 |
if (n.getChildCount() > 0) {
|
|
328 |
setExpandedNodes(n); // Problem: if we call setExpand on a leaf, there will be a TreeExpansionEvent and
|
|
329 |
// treeExpanded method is called, where a TRUE is used for the branch (layers group).
|
|
330 |
// To avoid this problem, we will use a boolean variable to indicate we should not update
|
|
331 |
// m_ItmesExpanded while we are in these method (something like a "synchronized" method (sem?mforo)
|
|
332 |
}
|
|
333 |
TreePath path = new TreePath(m_TreeModel.getPathToRoot(n));
|
|
334 |
ITocItem item = (ITocItem) n.getUserObject();
|
|
335 |
Boolean b = (Boolean) m_ItemsExpanded.get(item.getLabel());
|
301 |
336 |
|
302 |
|
while (enumeration.hasMoreElements()) {
|
303 |
|
n = (DefaultMutableTreeNode) enumeration.nextElement();
|
304 |
|
if (n.getChildCount() > 0) {
|
305 |
|
setExpandedNodes(n);
|
306 |
|
}
|
307 |
|
TreePath path = new TreePath(m_TreeModel.getPathToRoot(n));
|
308 |
|
ITocItem item = (ITocItem) n.getUserObject();
|
309 |
|
Boolean b = (Boolean) m_ItemsExpanded.get(item.getLabel());
|
|
337 |
if (b == null) // No estaba en el hash todav?a: valor por defecto
|
|
338 |
{
|
|
339 |
// System.out.println("Primera expansi?n de " +
|
|
340 |
// item.getLabel());
|
|
341 |
// m_Tree.expandPath(path);
|
|
342 |
// return;
|
|
343 |
continue;
|
|
344 |
}
|
310 |
345 |
|
311 |
|
if (b == null) // No estaba en el hash todav?a: valor por defecto
|
312 |
|
{
|
313 |
|
// System.out.println("Primera expansi?n de " +
|
314 |
|
// item.getLabel());
|
315 |
|
m_Tree.expandPath(path);
|
|
346 |
if (b.booleanValue()) {
|
|
347 |
// System.out.println("Expansi?n de " + item.getLabel());
|
|
348 |
m_Tree.expandPath(path);
|
|
349 |
} else {
|
|
350 |
// System.out.println("Colapso de " + item.getLabel());
|
|
351 |
m_Tree.collapsePath(path);
|
|
352 |
}
|
|
353 |
}
|
|
354 |
}
|
316 |
355 |
|
317 |
|
return;
|
318 |
|
}
|
|
356 |
/*
|
|
357 |
* (non-Javadoc)
|
|
358 |
*
|
|
359 |
* @see com.iver.cit.opensig.gui.IToc#refresh()
|
|
360 |
*/
|
|
361 |
public void refresh() {
|
|
362 |
LayerCollection theLayers = mapContext.getLayers();
|
|
363 |
m_Root.removeAllChildren();
|
|
364 |
m_Root.setAllowsChildren(true);
|
|
365 |
System.out.println("Refresh del toc");
|
|
366 |
doRefresh(theLayers, m_Root);
|
319 |
367 |
|
320 |
|
if (b.booleanValue()) {
|
321 |
|
// System.out.println("Expansi?n de " + item.getLabel());
|
322 |
|
m_Tree.expandPath(path);
|
323 |
|
} else {
|
324 |
|
// System.out.println("Colapso de " + item.getLabel());
|
325 |
|
m_Tree.collapsePath(path);
|
326 |
|
}
|
327 |
|
}
|
328 |
|
}
|
|
368 |
m_TreeModel.reload();
|
|
369 |
setExpandedNodes(m_Root);
|
|
370 |
}
|
329 |
371 |
|
330 |
|
/*
|
331 |
|
* (non-Javadoc)
|
332 |
|
*
|
333 |
|
* @see com.iver.cit.opensig.gui.IToc#refresh()
|
334 |
|
*/
|
335 |
|
public void refresh() {
|
336 |
|
LayerCollection theLayers = mapContext.getLayers();
|
337 |
|
m_Root.removeAllChildren();
|
338 |
|
m_Root.setAllowsChildren(true);
|
339 |
|
// System.out.println("Refresh del toc");
|
340 |
|
doRefresh(theLayers, m_Root);
|
|
372 |
/**
|
|
373 |
* DOCUMENT ME!
|
|
374 |
*
|
|
375 |
* @param theLayers
|
|
376 |
* DOCUMENT ME!
|
|
377 |
* @param parentNode
|
|
378 |
* DOCUMENT ME!
|
|
379 |
*/
|
|
380 |
private void doRefresh(LayerCollection theLayers,
|
|
381 |
DefaultMutableTreeNode parentNode) {
|
|
382 |
Dimension sizeLeaf = new Dimension(m_Tree.getWidth(), 15);
|
|
383 |
Dimension sizeBranch = new Dimension(m_Tree.getWidth(), 25);
|
341 |
384 |
|
342 |
|
m_TreeModel.reload();
|
|
385 |
for (int i = theLayers.getLayersCount() - 1; i >= 0; i--) {
|
|
386 |
FLayer lyr = theLayers.getLayer(i);
|
|
387 |
if (!lyr.isInTOC()) {
|
|
388 |
continue;
|
|
389 |
}
|
|
390 |
TocItemBranch elTema = new TocItemBranch(lyr);
|
|
391 |
elTema.setSize(sizeBranch);
|
343 |
392 |
|
344 |
|
setExpandedNodes(m_Root);
|
345 |
|
}
|
|
393 |
DefaultMutableTreeNode nodeLayer = new DefaultMutableTreeNode(
|
|
394 |
elTema);
|
346 |
395 |
|
347 |
|
/**
|
348 |
|
* DOCUMENT ME!
|
349 |
|
*
|
350 |
|
* @param theLayers
|
351 |
|
* DOCUMENT ME!
|
352 |
|
* @param parentNode
|
353 |
|
* DOCUMENT ME!
|
354 |
|
*/
|
355 |
|
private void doRefresh(LayerCollection theLayers,
|
356 |
|
DefaultMutableTreeNode parentNode) {
|
357 |
|
Dimension sizeLeaf = new Dimension(m_Tree.getWidth(), 15);
|
358 |
|
Dimension sizeBranch = new Dimension(m_Tree.getWidth(), 25);
|
|
396 |
m_TreeModel.insertNodeInto(nodeLayer, parentNode,
|
|
397 |
parentNode.getChildCount());
|
359 |
398 |
|
360 |
|
for (int i = theLayers.getLayersCount() - 1; i >= 0; i--) {
|
361 |
|
FLayer lyr = theLayers.getLayer(i);
|
362 |
|
if (!lyr.isInTOC()) {
|
363 |
|
continue;
|
364 |
|
}
|
365 |
|
TocItemBranch elTema = new TocItemBranch(lyr);
|
366 |
|
elTema.setSize(sizeBranch);
|
|
399 |
// TreePath path = new
|
|
400 |
// TreePath(m_TreeModel.getPathToRoot(nodeLayer));
|
|
401 |
// m_Tree.makeVisible(path);
|
|
402 |
if (lyr instanceof LayerCollection) {
|
|
403 |
LayerCollection group = (LayerCollection) lyr;
|
|
404 |
doRefresh(group, nodeLayer);
|
|
405 |
} else {
|
|
406 |
if ((lyr instanceof Classifiable)
|
|
407 |
&& !(lyr instanceof FLyrAnnotation)) {
|
367 |
408 |
|
368 |
|
DefaultMutableTreeNode nodeLayer =
|
369 |
|
new DefaultMutableTreeNode(elTema);
|
|
409 |
Classifiable aux = (Classifiable) lyr;
|
|
410 |
ILegend legendInfo = aux.getLegend();
|
370 |
411 |
|
371 |
|
m_TreeModel.insertNodeInto(nodeLayer, parentNode, parentNode
|
372 |
|
.getChildCount());
|
|
412 |
try {
|
|
413 |
if (legendInfo instanceof IClassifiedLegend) {
|
|
414 |
IClassifiedLegend cl = (IClassifiedLegend) legendInfo;
|
|
415 |
String[] descriptions = cl.getDescriptions();
|
|
416 |
ISymbol[] symbols = cl.getSymbols();
|
373 |
417 |
|
374 |
|
// TreePath path = new
|
375 |
|
// TreePath(m_TreeModel.getPathToRoot(nodeLayer));
|
376 |
|
// m_Tree.makeVisible(path);
|
377 |
|
if (lyr instanceof LayerCollection) {
|
378 |
|
LayerCollection group = (LayerCollection) lyr;
|
379 |
|
doRefresh(group, nodeLayer);
|
380 |
|
} else {
|
381 |
|
if ((lyr instanceof Classifiable)
|
382 |
|
&& !(lyr instanceof FLyrAnnotation)) {
|
|
418 |
for (int j = 0; j < descriptions.length; j++) {
|
|
419 |
TocItemLeaf itemLeaf;
|
|
420 |
itemLeaf = new TocItemLeaf(symbols[j],
|
|
421 |
descriptions[j], aux.getShapeType());
|
|
422 |
itemLeaf.setSize(sizeLeaf);
|
383 |
423 |
|
384 |
|
Classifiable aux = (Classifiable) lyr;
|
385 |
|
ILegend legendInfo = aux.getLegend();
|
|
424 |
DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(
|
|
425 |
itemLeaf);
|
|
426 |
m_TreeModel.insertNodeInto(nodeValue,
|
|
427 |
nodeLayer, nodeLayer.getChildCount());
|
386 |
428 |
|
387 |
|
try {
|
388 |
|
if (legendInfo instanceof IClassifiedLegend) {
|
389 |
|
IClassifiedLegend cl =
|
390 |
|
(IClassifiedLegend) legendInfo;
|
391 |
|
String[] descriptions = cl.getDescriptions();
|
392 |
|
ISymbol[] symbols = cl.getSymbols();
|
|
429 |
// TreePath pathSymbol = new
|
|
430 |
// TreePath(m_TreeModel.getPathToRoot(
|
|
431 |
// nodeValue));
|
|
432 |
// m_Tree.makeVisible(pathSymbol);
|
|
433 |
}
|
|
434 |
}
|
393 |
435 |
|
394 |
|
for (int j = 0; j < descriptions.length; j++) {
|
395 |
|
TocItemLeaf itemLeaf;
|
396 |
|
itemLeaf =
|
397 |
|
new TocItemLeaf(symbols[j],
|
398 |
|
descriptions[j], aux.getShapeType());
|
399 |
|
itemLeaf.setSize(sizeLeaf);
|
|
436 |
if ((legendInfo instanceof SingleSymbolLegend)
|
|
437 |
&& (legendInfo.getDefaultSymbol() != null)) {
|
|
438 |
TocItemLeaf itemLeaf;
|
|
439 |
itemLeaf = new TocItemLeaf(
|
|
440 |
legendInfo.getDefaultSymbol(), legendInfo
|
|
441 |
.getDefaultSymbol()
|
|
442 |
.getDescription(),
|
|
443 |
aux.getShapeType());
|
|
444 |
itemLeaf.setSize(sizeLeaf);
|
400 |
445 |
|
401 |
|
DefaultMutableTreeNode nodeValue =
|
402 |
|
new DefaultMutableTreeNode(itemLeaf);
|
403 |
|
m_TreeModel.insertNodeInto(nodeValue,
|
404 |
|
nodeLayer, nodeLayer.getChildCount());
|
|
446 |
DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(
|
|
447 |
itemLeaf);
|
|
448 |
m_TreeModel.insertNodeInto(nodeValue, nodeLayer,
|
|
449 |
nodeLayer.getChildCount());
|
405 |
450 |
|
406 |
|
// TreePath pathSymbol = new
|
407 |
|
// TreePath(m_TreeModel.getPathToRoot(
|
408 |
|
// nodeValue));
|
409 |
|
// m_Tree.makeVisible(pathSymbol);
|
410 |
|
}
|
411 |
|
}
|
|
451 |
// TreePath pathSymbol = new
|
|
452 |
// TreePath(m_TreeModel.getPathToRoot(
|
|
453 |
// nodeValue));
|
|
454 |
// m_Tree.makeVisible(pathSymbol);
|
|
455 |
}
|
412 |
456 |
|
413 |
|
if ((legendInfo instanceof SingleSymbolLegend)
|
414 |
|
&& (legendInfo.getDefaultSymbol() != null)) {
|
415 |
|
TocItemLeaf itemLeaf;
|
416 |
|
itemLeaf =
|
417 |
|
new TocItemLeaf(legendInfo.getDefaultSymbol(),
|
418 |
|
legendInfo.getDefaultSymbol()
|
419 |
|
.getDescription(), aux.getShapeType());
|
420 |
|
itemLeaf.setSize(sizeLeaf);
|
|
457 |
if (lyr instanceof IHasImageLegend) {
|
|
458 |
TocItemLeaf itemLeaf;
|
|
459 |
IHasImageLegend auxLayer = (IHasImageLegend) lyr;
|
|
460 |
Image image = auxLayer.getImageLegend();
|
421 |
461 |
|
422 |
|
DefaultMutableTreeNode nodeValue =
|
423 |
|
new DefaultMutableTreeNode(itemLeaf);
|
424 |
|
m_TreeModel.insertNodeInto(nodeValue, nodeLayer,
|
425 |
|
nodeLayer.getChildCount());
|
|
462 |
if (image != null) {
|
|
463 |
itemLeaf = new TocItemLeaf();
|
|
464 |
itemLeaf.setImageLegend(image, "",
|
|
465 |
new Dimension(image.getWidth(null),
|
|
466 |
image.getHeight(null)));// new
|
|
467 |
// Dimension(150,200));
|
426 |
468 |
|
427 |
|
// TreePath pathSymbol = new
|
428 |
|
// TreePath(m_TreeModel.getPathToRoot(
|
429 |
|
// nodeValue));
|
430 |
|
// m_Tree.makeVisible(pathSymbol);
|
431 |
|
}
|
|
469 |
DefaultMutableTreeNode nodeValue = new DefaultMutableTreeNode(
|
|
470 |
itemLeaf);
|
|
471 |
m_TreeModel.insertNodeInto(nodeValue,
|
|
472 |
nodeLayer, nodeLayer.getChildCount());
|
|
473 |
}
|
|
474 |
}
|
|
475 |
} catch (ReadDriverException e) {
|
|
476 |
e.printStackTrace();
|
|
477 |
}
|
|
478 |
}
|
|
479 |
} // if instanceof layers
|
|
480 |
}
|
|
481 |
}
|
432 |
482 |
|
433 |
|
if (lyr instanceof IHasImageLegend) {
|
434 |
|
TocItemLeaf itemLeaf;
|
435 |
|
IHasImageLegend auxLayer = (IHasImageLegend) lyr;
|
436 |
|
Image image = auxLayer.getImageLegend();
|
|
483 |
/**
|
|
484 |
* @see com.iver.cit.opensig.gui.toc.ITocOrderListener#orderChanged(int,
|
|
485 |
* int)
|
|
486 |
*/
|
|
487 |
public void orderChanged(int oldPos, int newPos, FLayers lpd) {
|
|
488 |
// LayerCollection layers = mapContext.getLayers();
|
|
489 |
// El orden es el contrario, hay que traducir.
|
|
490 |
// El orden es el contrario, hay que traducir.
|
|
491 |
// /oldPos = layers.getLayersCount() - 1 - oldPos;
|
|
492 |
// /newPos = layers.getLayersCount() - 1 - newPos;
|
|
493 |
try {
|
|
494 |
// Si lpd es un grupo de capas, el usuario tiene m?s opciones: Mover
|
|
495 |
// la capa arriba o abajo del grupo de capas, o a?adir la capa a
|
|
496 |
// ese grupo de capas
|
437 |
497 |
|
438 |
|
if (image != null) {
|
439 |
|
itemLeaf = new TocItemLeaf();
|
440 |
|
itemLeaf.setImageLegend(image, "",
|
441 |
|
new Dimension(image.getWidth(null), image
|
442 |
|
.getHeight(null)));// new
|
443 |
|
// Dimension(150,200));
|
|
498 |
int newto = lpd.getLayersCount() - newPos - 1;
|
|
499 |
String layerName = lpd.getLayer(newto).getName();
|
|
500 |
System.out.println("NewPos = " + layerName);
|
|
501 |
final JPopupMenu pop = new JPopupMenu(PluginServices.getText(this,
|
|
502 |
"Move"));
|
|
503 |
JMenuItem itUp = new JMenuItem(PluginServices.getText(this,
|
|
504 |
"Move_above_layer") + " " + layerName);
|
|
505 |
JMenuItem itDown = new JMenuItem(PluginServices.getText(this,
|
|
506 |
"Move_below_layer") + " " + layerName);
|
|
507 |
JMenuItem itGroup = new JMenuItem(PluginServices.getText(this,
|
|
508 |
"Group_with_layer") + " " + layerName);
|
444 |
509 |
|
445 |
|
DefaultMutableTreeNode nodeValue =
|
446 |
|
new DefaultMutableTreeNode(itemLeaf);
|
447 |
|
m_TreeModel.insertNodeInto(nodeValue,
|
448 |
|
nodeLayer, nodeLayer.getChildCount());
|
449 |
|
}
|
450 |
|
}
|
451 |
|
} catch (ReadDriverException e) {
|
452 |
|
e.printStackTrace();
|
453 |
|
}
|
454 |
|
}
|
455 |
|
} // if instanceof layers
|
456 |
|
}
|
457 |
|
}
|
|
510 |
itUp.setActionCommand("UP");
|
|
511 |
itDown.setActionCommand("DOWN");
|
|
512 |
itGroup.setActionCommand("GROUP");
|
458 |
513 |
|
459 |
|
/**
|
460 |
|
* @see com.iver.cit.opensig.gui.toc.ITocOrderListener#orderChanged(int,
|
461 |
|
* int)
|
462 |
|
*/
|
463 |
|
public void orderChanged(int oldPos, int newPos, FLayers lpd) {
|
464 |
|
// LayerCollection layers = mapContext.getLayers();
|
465 |
|
// El orden es el contrario, hay que traducir.
|
466 |
|
// El orden es el contrario, hay que traducir.
|
467 |
|
// /oldPos = layers.getLayersCount() - 1 - oldPos;
|
468 |
|
// /newPos = layers.getLayersCount() - 1 - newPos;
|
469 |
|
try {
|
470 |
|
lpd.moveTo(oldPos, newPos);
|
471 |
|
} catch (CancelationException e) {
|
472 |
|
// TODO Auto-generated catch block
|
473 |
|
e.printStackTrace();
|
474 |
|
}
|
|
514 |
JDialog dlgPop = new JDialog((Frame) null);
|
|
515 |
dlgPop.setUndecorated(true);
|
|
516 |
dlgPop.getContentPane().add(pop);
|
|
517 |
dlgPop.setModal(true);
|
475 |
518 |
|
476 |
|
// No hace falta un refresh, lo hace mediante eventos.
|
477 |
|
// refresh();
|
478 |
|
mapContext.invalidate();
|
479 |
|
}
|
|
519 |
MyMoveListener lis = new MyMoveListener(lpd, newto, oldPos,
|
|
520 |
getMapContext(), dlgPop);
|
480 |
521 |
|
481 |
|
/**
|
482 |
|
* DOCUMENT ME!
|
483 |
|
*
|
484 |
|
* @param lpo
|
485 |
|
* DOCUMENT ME!
|
486 |
|
* @param lpd
|
487 |
|
* DOCUMENT ME!
|
488 |
|
* @param ls
|
489 |
|
* DOCUMENT ME!
|
490 |
|
*/
|
491 |
|
public void parentChanged(FLayers lpo, FLayers lpd, FLayer ls) {
|
492 |
|
lpo.removeLayer(ls);
|
493 |
|
lpd.addLayer(ls);
|
494 |
|
PluginServices.getMainFrame().enableControls();
|
495 |
|
/*
|
496 |
|
* if (lpo.getLayersCount()==0){ lpo.getParentLayer().removeLayer(lpo); }
|
497 |
|
*/
|
498 |
|
mapContext.invalidate();
|
|
522 |
itUp.addActionListener(lis);
|
|
523 |
itDown.addActionListener(lis);
|
|
524 |
itGroup.addActionListener(lis);
|
499 |
525 |
|
500 |
|
}
|
|
526 |
pop.add(itUp);
|
|
527 |
pop.add(itDown);
|
|
528 |
pop.add(itGroup);
|
501 |
529 |
|
502 |
|
/*
|
503 |
|
* (non-Javadoc)
|
504 |
|
*
|
505 |
|
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
506 |
|
*/
|
507 |
|
public void componentHidden(ComponentEvent e) {
|
508 |
|
}
|
|
530 |
PointerInfo pi = MouseInfo.getPointerInfo();
|
|
531 |
final Point p = pi.getLocation();
|
|
532 |
//SwingUtilities.convertPointToScreen(p, this);
|
|
533 |
// pop.show(this, p.x, p.y);
|
|
534 |
pop.setInvoker(dlgPop);
|
|
535 |
pop.setLocation(p.x, p.y);
|
|
536 |
pop.setVisible(true);
|
|
537 |
dlgPop.pack();
|
|
538 |
|
|
539 |
dlgPop.setVisible(true);
|
|
540 |
|
|
541 |
} catch (CancelationException e) {
|
|
542 |
// TODO Auto-generated catch block
|
|
543 |
e.printStackTrace();
|
|
544 |
}
|
509 |
545 |
|
510 |
|
/*
|
511 |
|
* (non-Javadoc)
|
512 |
|
*
|
513 |
|
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
514 |
|
*/
|
515 |
|
public void componentMoved(ComponentEvent e) {
|
516 |
|
}
|
|
546 |
// No hace falta un refresh, lo hace mediante eventos.
|
|
547 |
// refresh();
|
|
548 |
mapContext.invalidate();
|
|
549 |
}
|
517 |
550 |
|
518 |
|
/*
|
519 |
|
* (non-Javadoc)
|
520 |
|
*
|
521 |
|
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
522 |
|
*/
|
523 |
|
public void componentResized(ComponentEvent e) {
|
524 |
|
System.out.println("Cambiando tama?o.");
|
|
551 |
/**
|
|
552 |
* DOCUMENT ME!
|
|
553 |
*
|
|
554 |
* @param lpo
|
|
555 |
* DOCUMENT ME!
|
|
556 |
* @param lpd
|
|
557 |
* DOCUMENT ME!
|
|
558 |
* @param ls
|
|
559 |
* DOCUMENT ME!
|
|
560 |
*/
|
|
561 |
public void parentChanged(FLayers lpo, FLayers lpd, FLayer ls) {
|
|
562 |
lpo.removeLayer(ls);
|
|
563 |
if (lpo.getLayersCount() == 0)
|
|
564 |
lpo.getParentLayer().removeLayer(lpo);
|
|
565 |
Integer drop_pos = (Integer) ls.getProperty("DROP_POS");
|
|
566 |
lpd.addLayer(lpd.getLayersCount() - drop_pos - 1, ls);
|
|
567 |
ls.getExtendedProperties().remove("DROP_POS");
|
|
568 |
PluginServices.getMainFrame().enableControls();
|
|
569 |
/*
|
|
570 |
* if (lpo.getLayersCount()==0){ lpo.getParentLayer().removeLayer(lpo);
|
|
571 |
* }
|
|
572 |
*/
|
|
573 |
mapContext.invalidate();
|
525 |
574 |
|
526 |
|
int i = 0;
|
527 |
|
DefaultMutableTreeNode n;
|
528 |
|
Enumeration enumeration = m_Root.children();
|
|
575 |
}
|
529 |
576 |
|
530 |
|
while (enumeration.hasMoreElements()) {
|
531 |
|
n = (DefaultMutableTreeNode) enumeration.nextElement();
|
|
577 |
/*
|
|
578 |
* (non-Javadoc)
|
|
579 |
*
|
|
580 |
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.
|
|
581 |
* ComponentEvent)
|
|
582 |
*/
|
|
583 |
public void componentHidden(ComponentEvent e) {
|
|
584 |
}
|
532 |
585 |
|
533 |
|
if (n.getUserObject() instanceof TocItemBranch) {
|
534 |
|
ITocItem item = (ITocItem) n.getUserObject();
|
535 |
|
Dimension szAnt = item.getSize();
|
536 |
|
item.setSize(new Dimension(this.getWidth() - 40, szAnt.height));
|
537 |
|
}
|
|
586 |
/*
|
|
587 |
* (non-Javadoc)
|
|
588 |
*
|
|
589 |
* @see
|
|
590 |
* java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent
|
|
591 |
* )
|
|
592 |
*/
|
|
593 |
public void componentMoved(ComponentEvent e) {
|
|
594 |
}
|
538 |
595 |
|
539 |
|
}
|
|
596 |
/*
|
|
597 |
* (non-Javadoc)
|
|
598 |
*
|
|
599 |
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.
|
|
600 |
* ComponentEvent)
|
|
601 |
*/
|
|
602 |
public void componentResized(ComponentEvent e) {
|
|
603 |
System.out.println("Cambiando tama?o.");
|
540 |
604 |
|
541 |
|
// m_Tree.setSize(this.getSize());
|
542 |
|
System.out.println("Ancho del tree=" + m_Tree.getWidth() + " "
|
543 |
|
+ m_Tree.getComponentCount());
|
544 |
|
System.out.println("Ancho del TOC=" + this.getWidth());
|
|
605 |
int i = 0;
|
|
606 |
DefaultMutableTreeNode n;
|
|
607 |
Enumeration enumeration = m_Root.children();
|
545 |
608 |
|
546 |
|
// m_Tree.repaint();
|
547 |
|
}
|
|
609 |
while (enumeration.hasMoreElements()) {
|
|
610 |
n = (DefaultMutableTreeNode) enumeration.nextElement();
|
548 |
611 |
|
549 |
|
/*
|
550 |
|
* (non-Javadoc)
|
551 |
|
*
|
552 |
|
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
553 |
|
*/
|
554 |
|
public void componentShown(ComponentEvent e) {
|
555 |
|
}
|
|
612 |
if (n.getUserObject() instanceof TocItemBranch) {
|
|
613 |
ITocItem item = (ITocItem) n.getUserObject();
|
|
614 |
Dimension szAnt = item.getSize();
|
|
615 |
item.setSize(new Dimension(this.getWidth() - 40, szAnt.height));
|
|
616 |
}
|
556 |
617 |
|
557 |
|
/*
|
558 |
|
* (non-Javadoc)
|
559 |
|
*
|
560 |
|
* @see com.iver.cit.gvsig.fmap.layers.LayerListener#legendChanged(com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent)
|
561 |
|
*/
|
562 |
|
public void legendChanged(LegendChangedEvent e) {
|
563 |
|
System.out.println("Refrescando TOC");
|
564 |
|
refresh();
|
565 |
|
}
|
|
618 |
}
|
566 |
619 |
|
567 |
|
/*
|
568 |
|
* (non-Javadoc)
|
569 |
|
*
|
570 |
|
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdded(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
571 |
|
*/
|
572 |
|
public void layerAdded(LayerCollectionEvent e) {
|
573 |
|
refresh();
|
574 |
|
}
|
|
620 |
// m_Tree.setSize(this.getSize());
|
|
621 |
System.out.println("Ancho del tree=" + m_Tree.getWidth() + " "
|
|
622 |
+ m_Tree.getComponentCount());
|
|
623 |
System.out.println("Ancho del TOC=" + this.getWidth());
|
575 |
624 |
|
576 |
|
/*
|
577 |
|
* (non-Javadoc)
|
578 |
|
*
|
579 |
|
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
|
580 |
|
*/
|
581 |
|
public void layerMoved(LayerPositionEvent e) {
|
582 |
|
refresh();
|
583 |
|
}
|
|
625 |
// m_Tree.repaint();
|
|
626 |
}
|
584 |
627 |
|
585 |
|
/*
|
586 |
|
* (non-Javadoc)
|
587 |
|
*
|
588 |
|
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoved(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
589 |
|
*/
|
590 |
|
public void layerRemoved(LayerCollectionEvent e) {
|
591 |
|
m_ItemsExpanded.remove(e.getAffectedLayer().getName());
|
592 |
|
refresh();
|
593 |
|
}
|
|
628 |
/*
|
|
629 |
* (non-Javadoc)
|
|
630 |
*
|
|
631 |
* @see
|
|
632 |
* java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent
|
|
633 |
* )
|
|
634 |
*/
|
|
635 |
public void componentShown(ComponentEvent e) {
|
|
636 |
}
|
594 |
637 |
|
595 |
|
/*
|
596 |
|
* (non-Javadoc)
|
597 |
|
*
|
598 |
|
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdding(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
|
599 |
|
*/
|
600 |
|
public void layerAdding(LayerCollectionEvent e) throws CancelationException {
|
601 |
|
}
|
|
638 |
/*
|
|
639 |
* (non-Javadoc)
|
|
640 |
*
|
|
641 |
* @see
|
|
642 |
* com.iver.cit.gvsig.fmap.layers.LayerListener#legendChanged(com.iver.cit
|
|
643 |
* .gvsig.fmap.rendering.LegendChangedEvent)
|
|
644 |
*/
|
|
645 |
public void legendChanged(LegendChangedEvent e) {
|
|
646 |
System.out.println("Refrescando TOC");
|
|
647 |
refresh();
|
|
648 |
}
|
602 |
649 |
|
603 |
|
/*
|
604 |
|
* (non-Javadoc)
|
605 |
|
*
|
606 |
|
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoving(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
|
607 |
|
*/
|