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
ConstructorsConstructorDescriptionTLcdIndependentOrderTreeLayeredSupport(ILcdLayered aLayeredToSupport, ILcdLayerTreeNode aRootNode) Constructs a newTLcdIndependentOrderTreeLayeredSupportfor a tree with root nodeaRootNode.Constructs a newTLcdIndependentOrderTreeLayeredSupportfor a tree with root nodeaRootNode. -
Method Summary
Modifier and TypeMethodDescriptionintgetLayerAddingIndex(ILcdLayer aLayer) This method provides a hook allowing to alter the index at which the layeraLayerwill be inserted in the flat list representation.voidmoveLayerAt(int aIndex, ILcdLayer aLayer) Move the layeraLayerto the indexaIndexMethods inherited from class com.luciad.view.TLcdTreeLayeredSupport
addLayeredListener, containsLayer, getLayer, getLayeredToSupport, getRootNode, indexOf, layerCount, layerOf, layers, layersBackwards, removeAllLayers, removeLayer, removeLayeredListener, setLayeredToSupportMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, getLayers, removeLayeredListener
-
Constructor Details
-
TLcdIndependentOrderTreeLayeredSupport
public TLcdIndependentOrderTreeLayeredSupport(ILcdLayered aLayeredToSupport, ILcdLayerTreeNode aRootNode) Constructs a new
TLcdIndependentOrderTreeLayeredSupportfor a tree with root nodeaRootNode.- Parameters:
aLayeredToSupport- theILcdLayeredthat will delegate to this supportaRootNode- the root node of the hierarchical layer structure
-
TLcdIndependentOrderTreeLayeredSupport
Constructs a new
TLcdIndependentOrderTreeLayeredSupportfor 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
aLayerwill 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
aLayerwill 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
aLayerto the indexaIndexThis 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:
moveLayerAtin interfaceILcdLayered- Overrides:
moveLayerAtin classTLcdTreeLayeredSupport- Parameters:
aIndex- the index to move the layer toaLayer- the layer which must be moved- Throws:
NoSuchElementException- ifaLayeris not in thisILcdLayered.ArrayIndexOutOfBoundsException- ifaIndexis not an index of one of the layers of thisILcdLayered.
-