Class TLcdIndependentOrderTreeLayeredSupport
- All Implemented Interfaces:
ILcdLayered
,ILcdTreeLayered
,ILcdTreeLayeredSupport
,Serializable
A utility class that can be used to create a class that implements
ILcdTreeLayered
. The major difference with the class
TLcdTreeLayeredSupport
is that the order of the layers in this
ILcdTreeLayered
is independent of the order in the hierarchical structure on which
this ILcdTreeLayered
is based.
As a consequence, the move operation (moveLayerAt(int, ILcdLayer)
performs the move
only on the flat list representation and not on the hierarchical structure. If you want to move a
node/layer in the hierarchical structure, it is necessary to access this structure directly
(TLcdTreeLayeredSupport.getRootNode()
) and perform the move on the node structure. Notice that this operation
will not affect the order in the flat list representation.
- Since:
- 9.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdIndependentOrderTreeLayeredSupport
(ILcdLayered aLayeredToSupport, ILcdLayerTreeNode aRootNode) Constructs a newTLcdIndependentOrderTreeLayeredSupport
for a tree with root nodeaRootNode
.Constructs a newTLcdIndependentOrderTreeLayeredSupport
for a tree with root nodeaRootNode
. -
Method Summary
Modifier and TypeMethodDescriptionint
getLayerAddingIndex
(ILcdLayer aLayer) This method provides a hook allowing to alter the index at which the layeraLayer
will be inserted in the flat list representation.void
moveLayerAt
(int aIndex, ILcdLayer aLayer) Move the layeraLayer
to the indexaIndex
Methods inherited from class com.luciad.view.TLcdTreeLayeredSupport
addLayeredListener, containsLayer, getLayer, getLayeredToSupport, getRootNode, indexOf, layerCount, layerOf, layers, layersBackwards, removeAllLayers, removeLayer, removeLayeredListener, setLayeredToSupport
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, getLayers, removeLayeredListener
-
Constructor Details
-
TLcdIndependentOrderTreeLayeredSupport
public TLcdIndependentOrderTreeLayeredSupport(ILcdLayered aLayeredToSupport, ILcdLayerTreeNode aRootNode) Constructs a new
TLcdIndependentOrderTreeLayeredSupport
for a tree with root nodeaRootNode
.- Parameters:
aLayeredToSupport
- theILcdLayered
that will delegate to this supportaRootNode
- the root node of the hierarchical layer structure
-
TLcdIndependentOrderTreeLayeredSupport
Constructs a new
TLcdIndependentOrderTreeLayeredSupport
for a tree with root nodeaRootNode
.Before using an instance of this class,
TLcdTreeLayeredSupport.setLayeredToSupport(ILcdLayered)
must be called.- Parameters:
aRootNode
- the root node of the hierarchical layer structure
-
-
Method Details
-
getLayerAddingIndex
This method provides a hook allowing to alter the index at which the layer
aLayer
will be inserted in the flat list representation. However, it is up to the synchronization listener to use this method when adding layers to the flat list structure (seecreateSynchronizationListener(TLcdLayeredSupport)
).The default implementation of
createSynchronizationListener(TLcdLayeredSupport)
uses this method. If you only want to change the index when layers are added, it is sufficient to override this method without overriding createSynchronizationListener(TLcdLayeredSupport).- Parameters:
aLayer
- the layer- Returns:
- the index at which the layer
aLayer
will be inserted in the flat list. Return -1 when the layer should be added at the end of the flat list. - See Also:
-
moveLayerAt
public void moveLayerAt(int aIndex, ILcdLayer aLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException Move the layer
aLayer
to the indexaIndex
This move operation will only perform the move on the flat list and not on the node structure. This will allow the order in the flat list to be completely independent of the order in hierarchical structure. Hence, the order in the flat list will not always map on a tree structure.
Moving a node with this method will only move the node in the flat list, and not the children of the node. They remain at their position in the flat list. If you want to move the node and its children, this method must be called multiple times (one time for the node, and one time for each child) with the correct indices.
- Specified by:
moveLayerAt
in interfaceILcdLayered
- Overrides:
moveLayerAt
in classTLcdTreeLayeredSupport
- Parameters:
aIndex
- the index to move the layer toaLayer
- the layer which must be moved- Throws:
NoSuchElementException
- ifaLayer
is not in thisILcdLayered
.ArrayIndexOutOfBoundsException
- ifaIndex
is not an index of one of the layers of thisILcdLayered
.
-