Hi there,

I'm getting an exception when I try removing the last layer from a map using the Legend. It's saying there are no children left. When I traced through the calls the problem seems to be in the contextChanged() method of the Legend class. It calls setSelectedLayer(). Why would it do this when the layer is being removed? Here's the relevant part of the exception:

java.util.NoSuchElementException: node has no children
at javax.swing.tree.DefaultMutableTreeNode.getFirstChild(DefaultMutableTreeNode.java:864)
        at org.geotools.gui.swing.Legend.setSelectedLayer(Legend.java:387)
        at org.geotools.gui.swing.Legend.contextChanged(Legend.java:376)
        at org.geotools.gui.swing.Legend.layerRemoved(Legend.java:423)
at org.geotools.map.DefaultMapContext.fireMapLayerListListenerLayerRemoved(DefaultMapContext.java:864) at org.geotools.map.DefaultMapContext.removeLayer(DefaultMapContext.java:331) at org.geotools.map.DefaultMapContext.removeLayer(DefaultMapContext.java:314)

Thanks,
Sean




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to