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 TypeMethodDescriptionvoid
addHierarchyLayeredListener
(ILcdLayeredListener aListener) Registers the givenILcdLayeredListener
to receiveTLcdLayeredEvent
s from all theILcdLayerTreeNode
s contained in the tree with this node as root node.void
Registers the givenPropertyChangeListener
to receivePropertyChangeEvent
s from all theILcdLayer
s contained in the tree with this node as root node.void
Registers the givenILcdSelectionListener
to receiveTLcdSelectionChangedEvent
s from all theILcdLayer
s contained in the tree with this node as root node.boolean
Adds a new node to the tree as a child of this node.boolean
Adds a new node to the tree as a child of this node.void
addLayeredListener
(ILcdLayeredListener aLayeredListener) Registers the givenILcdLayeredListener
to be notified when layers are added, removed or moved.void
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.boolean
containsLayer
(ILcdLayer aLayer) Returns whether thisILcdLayered
contains 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.boolean
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.int
Returns the number ofILcdLayer
objects in thisILcdLayered
.layers()
Returns anEnumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the bottom layer to the top layer.Returns anEnumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the top layer to the bottom layer.void
Removes all theILcdLayer
objects from thisILcdLayered
.void
Unregisters the givenILcdLayeredListener
from receivingTLcdLayeredEvent
s for the tree with this node as root node.void
Unregisters the givenPropertyChangeListener
from receivingPropertyChangeEvent
s for the tree with this node as root node.void
Unregisters the givenILcdSelectionListener
from receivingTLcdSelectionChangedEvent
s for the tree with this node as root node.void
removeLayer
(int aIndex) Removes the node at indexaIndex
from this node and sends the appropriateTLcdLayeredEvent
.void
removeLayeredListener
(ILcdLayeredListener aLayeredListener) Unregisters the givenILcdLayeredListener
from receiving layered events for theILcdLayered
.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
setInitialLayerIndexProvider
(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.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.Methods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisible
Methods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, getLayer, getLayers, indexOf, layerOf, moveLayerAt, removeLayer, removeLayeredListener
Methods 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
aNewChildNode
must not already be an element of the tree. This method should also generate aTLcdLayeredEvent
to warn its listeners that a node has been added.- Parameters:
aNewChildNode
- the node which must be added as a child- Returns:
true
when the layer was successfully added to this node,false
if 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
aIndex
in the child list of this node. Notice that in order to avoid loops in the treeaNewChildNode
must not already be an element of the tree. This method should also generate aTLcdLayeredEvent
to 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:
true
when the layer was successfully added to this node,false
if 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
aIndex
from this node and sends the appropriateTLcdLayeredEvent
.- Parameters:
aIndex
- the index of the child node which has to be removed
-
addHierarchyLayeredListener
Registers the given
ILcdLayeredListener
to receiveTLcdLayeredEvent
s from all theILcdLayerTreeNode
s 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
ILcdLayered
of the event can be retrieved by callingTLcdLayeredEvent.getLayered()
on the receivedTLcdLayeredEvent
.- Parameters:
aListener
- the listener
-
removeHierarchyLayeredListener
Unregisters the given
ILcdLayeredListener
from receivingTLcdLayeredEvent
s for the tree with this node as root node.- Parameters:
aListener
- the listener
-
addHierarchyPropertyChangeListener
Registers the given
PropertyChangeListener
to receivePropertyChangeEvent
s from all theILcdLayer
s 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
PropertyChangeListener
from receivingPropertyChangeEvent
s for the tree with this node as root node.- Parameters:
aListener
- the listener
-
addHierarchySelectionListener
Registers the given
ILcdSelectionListener
to receiveTLcdSelectionChangedEvent
s from all theILcdLayer
s 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
ILcdSelectionListener
from receivingTLcdSelectionChangedEvent
s for the tree with this node as root node.- Parameters:
aListener
- the listener
-
removeAllLayers
void removeAllLayers()Removes all theILcdLayer
objects from thisILcdLayered
.This method will generate a
TLcdLayeredEvent
indicating a layer was removed for every child layer.- Specified by:
removeAllLayers
in 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:
true
when a node should be painted on top of its children,false
when 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
-true
when a node should be painted on top of its children,false
when the node should be painted underneath its child layers- See Also:
-
addPropertyChangeListener
Registers the given
PropertyChangeListener
to 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
ALcdWeakPropertyChangeListener
instance 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:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- The listener to be notified- See Also:
-
removePropertyChangeListener
De-registers the given
PropertyChangeListener
from 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:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
addLayeredListener
Registers the given
ILcdLayeredListener
to 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
ALcdWeakLayeredListener
instance 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:
addLayeredListener
in interfaceILcdLayered
- Parameters:
aLayeredListener
- the listener that from now on will be notified of all changes to theILcdLayered
- See Also:
-
removeLayeredListener
Unregisters the givenILcdLayeredListener
from 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:
removeLayeredListener
in interfaceILcdLayered
- Parameters:
aLayeredListener
- the listener that will no longer be notified of changes to theILcdLayered
- See Also:
-
containsLayer
Returns whether thisILcdLayered
contains the given layer. More formally, returnstrue
if and only if theILcdLayered
contains at least one layerl
such 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:
containsLayer
in interfaceILcdLayered
- Parameters:
aLayer
- the layer to check whether it is in this layered.- Returns:
- true if
aLayer
is in thisILcdLayered
, false otherwise.
-
layers
Enumeration layers()Returns anEnumeration
of allILcdLayer
objects 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:
layers
in interfaceILcdLayered
- Returns:
- an
Enumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the bottom layer to the top layer.
-
layersBackwards
Enumeration layersBackwards()Returns anEnumeration
of allILcdLayer
objects 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:
layersBackwards
in interfaceILcdLayered
- Returns:
- an
Enumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the top layer to the bottom layer.
-
layerCount
int layerCount()Returns the number ofILcdLayer
objects 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:
layerCount
in interfaceILcdLayered
- Returns:
- the number of
ILcdLayer
objects 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:
-