Interface ILcdLayerTreeNode
- All Superinterfaces:
ILcdLayer,ILcdLayered,ILcdPropertyChangeSource,ILcdSelection<Object>,Serializable
- All Known Implementing Classes:
TLcdGXYAsynchronousEditableLabelsLayerTreeNodeWrapper,TLcdGXYAsynchronousLayerTreeNodeWrapper,TLcdGXYLayerTreeNode,TLcdGXYLspAsynchronousLayerTreeNodeWrapper,TLspGXYLayerTreeNodeAdapter,TLspLayerTreeNode
An ILcdLayerTreeNode is an ILcdLayer which can
also have child layers. This allows to create a hierarchical layer structure.

This interface extends ILcdLayered since it can have child layers.
Therefore, all methods inherited from ILcdLayered only apply on the child layers. An
example is layerCount() which will return the number of child layers of this layer node.
This does not include the node itself.
It also extends ILcdLayer since every layer node is a layer
itself. Therefore, all methods inherited from ILcdLayer only apply on the node, and
not on its child layers. For example calling ILcdLayer.setVisible(boolean) will only change the
visibility of the node and not of its child layers.
It is possible to attach listeners which will be notified of changes in the whole hierarchical
structure (see addHierarchyLayeredListener(ILcdLayeredListener), addHierarchySelectionListener(com.luciad.util.ILcdSelectionListener) and addHierarchyPropertyChangeListener(java.beans.PropertyChangeListener)) or which will only be
notified of changes in the node (see addLayeredListener(ILcdLayeredListener), ILcdSelection.addSelectionListener(com.luciad.util.ILcdSelectionListener) and addPropertyChangeListener(java.beans.PropertyChangeListener)).
- Since:
- 9.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddHierarchyLayeredListener(ILcdLayeredListener aListener) Registers the givenILcdLayeredListenerto receiveTLcdLayeredEvents from all theILcdLayerTreeNodes contained in the tree with this node as root node.voidRegisters the givenPropertyChangeListenerto receivePropertyChangeEvents from all theILcdLayers contained in the tree with this node as root node.voidRegisters the givenILcdSelectionListenerto receiveTLcdSelectionChangedEvents from all theILcdLayers contained in the tree with this node as root node.booleanAdds a new node to the tree as a child of this node.booleanAdds a new node to the tree as a child of this node.voidaddLayeredListener(ILcdLayeredListener aLayeredListener) Registers the givenILcdLayeredListenerto be notified when layers are added, removed or moved.voidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListenerto be notified when this object's properties change.booleancontainsLayer(ILcdLayer aLayer) Returns whether thisILcdLayeredcontains the given layer.Returns the initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.booleanReturns whether a node should be painted on top of its children when the node is added to a view, or beneath its child layers.intReturns the number ofILcdLayerobjects in thisILcdLayered.layers()Returns anEnumerationof allILcdLayerobjects currently in thisILcdLayered, starting from the bottom layer to the top layer.Returns anEnumerationof allILcdLayerobjects currently in thisILcdLayered, starting from the top layer to the bottom layer.voidRemoves all theILcdLayerobjects from thisILcdLayered.voidUnregisters the givenILcdLayeredListenerfrom receivingTLcdLayeredEvents for the tree with this node as root node.voidUnregisters the givenPropertyChangeListenerfrom receivingPropertyChangeEvents for the tree with this node as root node.voidUnregisters the givenILcdSelectionListenerfrom receivingTLcdSelectionChangedEvents for the tree with this node as root node.voidremoveLayer(int aIndex) Removes the node at indexaIndexfrom this node and sends the appropriateTLcdLayeredEvent.voidremoveLayeredListener(ILcdLayeredListener aLayeredListener) Unregisters the givenILcdLayeredListenerfrom receiving layered events for theILcdLayered.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListenerfrom receiving property change events for this object.voidsetInitialLayerIndexProvider(ILcdInitialLayerIndexProvider aInitialLayerIndexProvider) Sets an initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.voidsetPaintOnTopOfChildrenHint(boolean aPaintOnTopOfChildrenHint) Sets whether a node should be painted on top of its children when the node is added to a view, or beneath its child layers.Methods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisibleMethods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, getLayer, getLayers, indexOf, layerOf, moveLayerAt, removeLayer, removeLayeredListenerMethods inherited from interface com.luciad.util.ILcdSelection
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
-
Method Details
-
addLayer
Adds a new node to the tree as a child of this node. This newly added node will normally be the last child node, but that can be implementation specific. Implementations could for example decide to use the initial layer index provider to determine the best index to add the layer. Notice that in order to avoid loops in the tree
aNewChildNodemust not already be an element of the tree. This method should also generate aTLcdLayeredEventto warn its listeners that a node has been added.- Parameters:
aNewChildNode- the node which must be added as a child- Returns:
truewhen the layer was successfully added to this node,falseif the node already contained layeraNewChildNode- Throws:
IllegalArgumentException- when the node is already an element of the tree
-
addLayer
boolean addLayer(ILcdLayer aNewChildNode, int aIndex) throws IndexOutOfBoundsException, IllegalArgumentException Adds a new node to the tree as a child of this node. The child will be inserted at index
aIndexin the child list of this node. Notice that in order to avoid loops in the treeaNewChildNodemust not already be an element of the tree. This method should also generate aTLcdLayeredEventto warn its listeners that a node has been added.- Parameters:
aNewChildNode- the new childaIndex- the index in the child list of this node for the new child- Returns:
truewhen the layer was successfully added to this node,falseif the node already contained layeraNewChildNode- Throws:
IndexOutOfBoundsException- whenindex >layerCount()IllegalArgumentException- when the node is already an element of the tree
-
removeLayer
void removeLayer(int aIndex) Removes the node at index
aIndexfrom this node and sends the appropriateTLcdLayeredEvent.- Parameters:
aIndex- the index of the child node which has to be removed
-
addHierarchyLayeredListener
Registers the given
ILcdLayeredListenerto receiveTLcdLayeredEvents from all theILcdLayerTreeNodes contained in the tree with this node as root node. If the listener should only receive events for changes occurring in this node, it should be registered as a regular listener (seeaddLayeredListener(ILcdLayeredListener).The source
ILcdLayeredof the event can be retrieved by callingTLcdLayeredEvent.getLayered()on the receivedTLcdLayeredEvent.- Parameters:
aListener- the listener
-
removeHierarchyLayeredListener
Unregisters the given
ILcdLayeredListenerfrom receivingTLcdLayeredEvents for the tree with this node as root node.- Parameters:
aListener- the listener
-
addHierarchyPropertyChangeListener
Registers the given
PropertyChangeListenerto receivePropertyChangeEvents from all theILcdLayers contained in the tree with this node as root node. If the listener should only receive events for changes occurring in this layer, it should be registered as a regular listener (seeaddPropertyChangeListener(java.beans.PropertyChangeListener)).The source layer of the event can be retrieved by calling
EventObject.getSource()on the receivedPropertyChangeEvent.- Parameters:
aListener- the listener
-
removeHierarchyPropertyChangeListener
Unregisters the given
PropertyChangeListenerfrom receivingPropertyChangeEvents for the tree with this node as root node.- Parameters:
aListener- the listener
-
addHierarchySelectionListener
Registers the given
ILcdSelectionListenerto receiveTLcdSelectionChangedEvents from all theILcdLayers contained in the tree with this node as root node. If the listener should only receive events for selection changes occurring in this layer, it should be registered as a regular listener (seeILcdSelection.addSelectionListener(com.luciad.util.ILcdSelectionListener)).The source layer of the event can be retrieved by calling
TLcdSelectionChangedEvent.getSelection()on the receivedTLcdSelectionChangedEvent.- Parameters:
aListener- the listener
-
removeHierarchySelectionListener
Unregisters the given
ILcdSelectionListenerfrom receivingTLcdSelectionChangedEvents for the tree with this node as root node.- Parameters:
aListener- the listener
-
removeAllLayers
void removeAllLayers()Removes all theILcdLayerobjects from thisILcdLayered.This method will generate a
TLcdLayeredEventindicating a layer was removed for every child layer.- Specified by:
removeAllLayersin interfaceILcdLayered
-
isPaintOnTopOfChildrenHint
boolean isPaintOnTopOfChildrenHint()Returns whether a node should be painted on top of its children when the node is added to a view, or beneath its child layers.
- Returns:
truewhen a node should be painted on top of its children,falsewhen the node should be painted underneath its child layers- See Also:
-
setPaintOnTopOfChildrenHint
void setPaintOnTopOfChildrenHint(boolean aPaintOnTopOfChildrenHint) Sets whether a node should be painted on top of its children when the node is added to a view, or beneath its child layers. Notice that this is only a hint, hence the paint order of the node and its children is not guaranteed.
This property must be set before the node is added to the view. Otherwise it will have no effect. Changing it afterwards will have no effect, unless the node is removed and re-added to the view.
The default behavior is to paint nodes underneath the child layers.
- Parameters:
aPaintOnTopOfChildrenHint-truewhen a node should be painted on top of its children,falsewhen the node should be painted underneath its child layers- See Also:
-
addPropertyChangeListener
Registers the given
PropertyChangeListenerto be notified when this object's properties change.In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakPropertyChangeListenerinstance as property change listener.This property change listener will only be notified of changes in this layer node, not of changes in any of the child layers. Use
addHierarchyPropertyChangeListener(java.beans.PropertyChangeListener)for this purpose.- Specified by:
addPropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- The listener to be notified- See Also:
-
removePropertyChangeListener
De-registers the given
PropertyChangeListenerfrom receiving property change events for this object.If the listener was added more than once, it will be notified one less time after being removed. If the listener is
null, or was never added, no exception is thrown and no action is taken.It is not possible to remove a hierarchy property change listener with this method. Use
removeHierarchyPropertyChangeListener(java.beans.PropertyChangeListener)for this purpose.- Specified by:
removePropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- the listener that should no longer be notified of changes of this object's properties- See Also:
-
addLayeredListener
Registers the given
ILcdLayeredListenerto be notified when layers are added, removed or moved.In case you need to register a listener which keeps a reference to an object with a shorter life-time than this layered, you can use a
ALcdWeakLayeredListenerinstance as layered listener.This layer will only be informed when child layers are added, removed or moved in this layer node. To receive the events of the whole hierarchical structure, the listener must be added as a hierarchical listener (see
addHierarchyLayeredListener(ILcdLayeredListener)).- Specified by:
addLayeredListenerin interfaceILcdLayered- Parameters:
aLayeredListener- the listener that from now on will be notified of all changes to theILcdLayered- See Also:
-
removeLayeredListener
Unregisters the givenILcdLayeredListenerfrom receiving layered events for theILcdLayered.It is not possible to remove a hierarchy listener with this method. Use
removeHierarchyLayeredListener(ILcdLayeredListener)for this purpose.- Specified by:
removeLayeredListenerin interfaceILcdLayered- Parameters:
aLayeredListener- the listener that will no longer be notified of changes to theILcdLayered- See Also:
-
containsLayer
Returns whether thisILcdLayeredcontains the given layer. More formally, returnstrueif and only if theILcdLayeredcontains at least one layerlsuch that (aLayer==null ? l==null : aLayer.equals(l)).Calling this method with this node as parameter will return
false, since this method only checks the child layers and not the layer node itself.- Specified by:
containsLayerin interfaceILcdLayered- Parameters:
aLayer- the layer to check whether it is in this layered.- Returns:
- true if
aLayeris in thisILcdLayered, false otherwise.
-
layers
Enumeration layers()Returns anEnumerationof allILcdLayerobjects currently in thisILcdLayered, starting from the bottom layer to the top layer.This enumeration does not include this layer node, but only the child layers.
- Specified by:
layersin interfaceILcdLayered- Returns:
- an
Enumerationof allILcdLayerobjects currently in thisILcdLayered, starting from the bottom layer to the top layer.
-
layersBackwards
Enumeration layersBackwards()Returns anEnumerationof allILcdLayerobjects currently in thisILcdLayered, starting from the top layer to the bottom layer.This enumeration does not include this layer node, but only the child layers.
- Specified by:
layersBackwardsin interfaceILcdLayered- Returns:
- an
Enumerationof allILcdLayerobjects currently in thisILcdLayered, starting from the top layer to the bottom layer.
-
layerCount
int layerCount()Returns the number ofILcdLayerobjects in thisILcdLayered.This number does not include this layer node. It is the number of child layers of this node that is returned.
- Specified by:
layerCountin interfaceILcdLayered- Returns:
- the number of
ILcdLayerobjects in thisILcdLayered.
-
getInitialLayerIndexProvider
ILcdInitialLayerIndexProvider getInitialLayerIndexProvider()Returns the initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.
It is however up to the implementation to decide whether it uses the
ILcdInitialLayerIndexProvider.- Returns:
- the initial layer index provider. Can be
null - See Also:
-
setInitialLayerIndexProvider
Sets an initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.
- Parameters:
aInitialLayerIndexProvider- The new initial layer index provider. May benull- See Also:
-