Class TLcdIndependentOrderTreeLayeredSupport

java.lang.Object
com.luciad.view.TLcdTreeLayeredSupport
com.luciad.view.TLcdIndependentOrderTreeLayeredSupport
All Implemented Interfaces:
ILcdLayered, ILcdTreeLayered, ILcdTreeLayeredSupport, Serializable

public class TLcdIndependentOrderTreeLayeredSupport extends TLcdTreeLayeredSupport

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 Details

    • TLcdIndependentOrderTreeLayeredSupport

      public TLcdIndependentOrderTreeLayeredSupport(ILcdLayered aLayeredToSupport, ILcdLayerTreeNode aRootNode)

      Constructs a new TLcdIndependentOrderTreeLayeredSupport for a tree with root node aRootNode.

      Parameters:
      aLayeredToSupport - the ILcdLayered that will delegate to this support
      aRootNode - the root node of the hierarchical layer structure
    • TLcdIndependentOrderTreeLayeredSupport

      public TLcdIndependentOrderTreeLayeredSupport(ILcdLayerTreeNode aRootNode)

      Constructs a new TLcdIndependentOrderTreeLayeredSupport for a tree with root node aRootNode.

      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

      public int getLayerAddingIndex(ILcdLayer aLayer)

      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 (see createSynchronizationListener(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:
      • createSynchronizationListener(TLcdLayeredSupport)
    • moveLayerAt

      public void moveLayerAt(int aIndex, ILcdLayer aLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException

      Move the layer aLayer to the index aIndex

      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 interface ILcdLayered
      Overrides:
      moveLayerAt in class TLcdTreeLayeredSupport
      Parameters:
      aIndex - the index to move the layer to
      aLayer - the layer which must be moved
      Throws:
      NoSuchElementException - if aLayer is not in this ILcdLayered.
      ArrayIndexOutOfBoundsException - if aIndex is not an index of one of the layers of this ILcdLayered.