public interface ILcdLayerTreeNode extends ILcdLayer, ILcdLayered
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)
).
Modifier and Type | Method and Description |
---|---|
void |
addHierarchyLayeredListener(ILcdLayeredListener aListener)
Registers the given
ILcdLayeredListener to receive
TLcdLayeredEvent s from all the ILcdLayerTreeNode s contained in the
tree with this node as root node. |
void |
addHierarchyPropertyChangeListener(PropertyChangeListener aListener)
Registers the given
PropertyChangeListener to
receive PropertyChangeEvent s from all the ILcdLayer s contained in the
tree with this node as root node. |
void |
addHierarchySelectionListener(ILcdSelectionListener aListener)
Registers the given
ILcdSelectionListener to
receive TLcdSelectionChangedEvent s from all the ILcdLayer s contained
in the tree with this node as root node. |
boolean |
addLayer(ILcdLayer aNewChildNode)
Adds a new node to the tree as a child of this node.
|
boolean |
addLayer(ILcdLayer aNewChildNode,
int aIndex)
Adds a new node to the tree as a child of this node.
|
void |
addLayeredListener(ILcdLayeredListener aLayeredListener)
Registers the given
ILcdLayeredListener to be notified when layers are added, removed or moved. |
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers the given
PropertyChangeListener to be notified when this object's
properties change. |
boolean |
containsLayer(ILcdLayer aLayer)
Returns whether this
ILcdLayered contains the given layer. |
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.
|
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.
|
int |
layerCount()
Returns the number of
ILcdLayer objects in this ILcdLayered . |
Enumeration |
layers()
Returns an
Enumeration of all ILcdLayer objects currently
in this ILcdLayered ,
starting from the bottom layer to the top layer. |
Enumeration |
layersBackwards()
Returns an
Enumeration of all ILcdLayer objects currently in this ILcdLayered ,
starting from the top layer to the bottom layer. |
void |
removeAllLayers()
Removes all the
ILcdLayer objects from this ILcdLayered . |
void |
removeHierarchyLayeredListener(ILcdLayeredListener aListener)
Unregisters the given
ILcdLayeredListener from
receiving TLcdLayeredEvent s for the tree with this node as root node. |
void |
removeHierarchyPropertyChangeListener(PropertyChangeListener aListener)
Unregisters the given
PropertyChangeListener from
receiving PropertyChangeEvent s for the tree with this node as root node. |
void |
removeHierarchySelectionListener(ILcdSelectionListener aListener)
Unregisters the given
ILcdSelectionListener
from receiving TLcdSelectionChangedEvent s for the tree with this node as root
node. |
void |
removeLayer(int aIndex)
Removes the node at index
aIndex from this node and sends the appropriate
TLcdLayeredEvent . |
void |
removeLayeredListener(ILcdLayeredListener aLayeredListener)
Unregisters the given
ILcdLayeredListener from receiving layered events for
the ILcdLayered . |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
De-registers the given
PropertyChangeListener 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.
|
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisible
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
addLayeredListener, getLayer, getLayers, indexOf, layerOf, moveLayerAt, removeLayer, removeLayeredListener
boolean addLayer(ILcdLayer aNewChildNode) throws IllegalArgumentException
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 a TLcdLayeredEvent
to warn its listeners that a node has been
added.
aNewChildNode
- the node which must be added as a childtrue
when the layer was successfully added to this node, false
if the node already contained layer aNewChildNode
IllegalArgumentException
- when the node is already an element of the treeboolean 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
tree aNewChildNode
must not already be an element of the tree. This method should
also generate a TLcdLayeredEvent
to warn its listeners that a node has
been added.
aNewChildNode
- the new childaIndex
- the index in the child list of this node for the new childtrue
when the layer was successfully added to this node, false
if the node already contained layer aNewChildNode
IndexOutOfBoundsException
- when index > layerCount()
IllegalArgumentException
- when the node is already an element of the treevoid removeLayer(int aIndex)
Removes the node at index aIndex
from this node and sends the appropriate
TLcdLayeredEvent
.
aIndex
- the index of the child node which has to be removedvoid addHierarchyLayeredListener(ILcdLayeredListener aListener)
Registers the given ILcdLayeredListener
to receive
TLcdLayeredEvent
s from all the ILcdLayerTreeNode
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 (see addLayeredListener(ILcdLayeredListener)
.
The source ILcdLayered
of the event can be retrieved by calling TLcdLayeredEvent.getLayered()
on the received TLcdLayeredEvent
.
aListener
- the listenervoid removeHierarchyLayeredListener(ILcdLayeredListener aListener)
Unregisters the given ILcdLayeredListener
from
receiving TLcdLayeredEvent
s for the tree with this node as root node.
aListener
- the listenervoid addHierarchyPropertyChangeListener(PropertyChangeListener aListener)
Registers the given PropertyChangeListener
to
receive PropertyChangeEvent
s from all the ILcdLayer
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 (see addPropertyChangeListener(java.beans.PropertyChangeListener)
).
The source layer of the event can be retrieved by calling EventObject.getSource()
on the received PropertyChangeEvent
.
aListener
- the listenervoid removeHierarchyPropertyChangeListener(PropertyChangeListener aListener)
Unregisters the given PropertyChangeListener
from
receiving PropertyChangeEvent
s for the tree with this node as root node.
aListener
- the listenervoid addHierarchySelectionListener(ILcdSelectionListener aListener)
Registers the given ILcdSelectionListener
to
receive TLcdSelectionChangedEvent
s from all the ILcdLayer
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 (see
ILcdSelection.addSelectionListener(com.luciad.util.ILcdSelectionListener)
).
The source layer of the event can be retrieved by calling TLcdSelectionChangedEvent.getSelection()
on the received TLcdSelectionChangedEvent
.
aListener
- the listenervoid removeHierarchySelectionListener(ILcdSelectionListener aListener)
Unregisters the given ILcdSelectionListener
from receiving TLcdSelectionChangedEvent
s for the tree with this node as root
node.
aListener
- the listenervoid removeAllLayers()
ILcdLayer
objects from this ILcdLayered
.
This method will generate a TLcdLayeredEvent
indicating a layer was removed for
every child layer.
removeAllLayers
in interface ILcdLayered
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.
true
when a node should be painted on top of its children,
false
when the node should be painted underneath its child layerssetPaintOnTopOfChildrenHint(boolean)
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.
aPaintOnTopOfChildrenHint
- true
when a node should be painted on top of its
children, false
when the node should be painted
underneath its child layersisPaintOnTopOfChildrenHint()
void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
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.
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
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.
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
void addLayeredListener(ILcdLayeredListener aLayeredListener)
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)
).
addLayeredListener
in interface ILcdLayered
aLayeredListener
- the listener that from now on will be notified of all changes
to the ILcdLayered
ILcdLayered.removeLayeredListener(com.luciad.view.ILcdLayeredListener)
void removeLayeredListener(ILcdLayeredListener aLayeredListener)
ILcdLayeredListener
from receiving layered events for
the ILcdLayered
.
It is not possible to remove a hierarchy listener with this method. Use removeHierarchyLayeredListener(ILcdLayeredListener)
for this purpose.
removeLayeredListener
in interface ILcdLayered
aLayeredListener
- the listener that will no longer be notified of changes
to the ILcdLayered
ILcdLayered.addLayeredListener(ILcdLayeredListener)
boolean containsLayer(ILcdLayer aLayer)
ILcdLayered
contains the given layer.
More formally, returns true
if and only if the ILcdLayered
contains at least one layer l
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.
containsLayer
in interface ILcdLayered
aLayer
- the layer to check whether it is in this layered.aLayer
is in this ILcdLayered
,
false otherwise.Enumeration layers()
Enumeration
of all ILcdLayer
objects currently
in this ILcdLayered
,
starting from the bottom layer to the top layer.
This enumeration does not include this layer node, but only the child layers.
layers
in interface ILcdLayered
Enumeration
of all ILcdLayer
objects currently
in this ILcdLayered
,
starting from the bottom layer to the top layer.Enumeration layersBackwards()
Enumeration
of all ILcdLayer
objects currently in this ILcdLayered
,
starting from the top layer to the bottom layer.
This enumeration does not include this layer node, but only the child layers.
layersBackwards
in interface ILcdLayered
Enumeration
of all ILcdLayer
objects currently in this ILcdLayered
,
starting from the top layer to the bottom layer.int layerCount()
ILcdLayer
objects in this ILcdLayered
.
This number does not include this layer node. It is the number of child layers of this node that is returned.
layerCount
in interface ILcdLayered
ILcdLayer
objects in this ILcdLayered
.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
.
null
setInitialLayerIndexProvider(ILcdInitialLayerIndexProvider)
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.
aInitialLayerIndexProvider
- The new initial layer index provider. May be
null
getInitialLayerIndexProvider()