public class TLcdGXYAsynchronousLayerTreeNodeWrapper extends TLcdGXYAsynchronousLayerWrapper implements ILcdLayerTreeNode
TLcdGXYAsynchronousLayerWrapper
extension for layer nodes
.
It only protects the functionality offered by the ILcdGXYLayer
interface.
The node functionality is not protected from asynchronous painting, and should therefore not be
accessed in paint-specific methods.Constructor and Description |
---|
TLcdGXYAsynchronousLayerTreeNodeWrapper(ILcdGXYLayer aDecoratedLayer)
Creates a layer node decorator that delegates painting to an asynchronous paint queue.
|
TLcdGXYAsynchronousLayerTreeNodeWrapper(ILcdGXYLayer aDecoratedLayer,
ILcdGXYAsynchronousPaintQueue aPaintQueue)
Creates a layer node decorator that delegates painting to an asynchronous paint queue.
|
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. |
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.
|
ILcdLayer |
getLayer(int aIndex)
Returns the
ILcdLayer in this ILcdLayered
with index aIndex . |
int |
indexOf(ILcdLayer aLayer)
Returns the index if the given layer is in the list.
|
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 . |
ILcdLayer |
layerOf(ILcdModel aModel)
Returns the
ILcdLayer of this ILcdLayered that contains the given ILcdModel . |
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 |
moveLayerAt(int aIndex,
ILcdLayer aLayer)
Moves the given layer (which is already in
ILcdLayered ) to the existing index
aIndex. |
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(ILcdLayer aLayer)
Removes aLayer from this
ILcdLayered . |
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 |
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.
|
addPropertyChangeListener, addSelectionListener, applyOnInteract, clearSelection, fireCollectedSelectionChanges, firePropertyChangeEvent, getAsynchronousGXYLayerChangeTracker, getBounds, getGXYAsynchronousPaintQueue, getGXYEditor, getGXYLabelPainter, getGXYLayer, getGXYPainter, getGXYPen, getIcon, getLabel, getLabelMapScaleRange, getLabelScaleRange, getMapScaleRange, getModel, getModelXYWorldTransfoClass, getScaleRange, getSelectionCount, getSynchronousGXYLayerChangeTracker, invokeAndWaitOnGXYLayer, invokeLaterOnGXYLayer, invokeLaterOnGXYLayerInEDT, invokeNowOnGXYLayer, isAsynchronous, isEditable, isEditableSupported, isLabeled, isLabeledSupported, isSelectable, isSelectableSupported, isSelected, isTraceOn, isVisible, paint, removePropertyChangeListener, removeSelectionListener, selectedObjects, selectObject, setAsynchronous, setEditable, setGXYAsynchronousPaintQueue, setIcon, setLabel, setLabeled, setSelectable, setTraceOn, setVisible, stopPainting
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisible
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
addLayeredListener, getLayers, removeLayeredListener
create
public TLcdGXYAsynchronousLayerTreeNodeWrapper(ILcdGXYLayer aDecoratedLayer)
TLcdGXYAsynchronousLayerWrapper.setGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue)
aDecoratedLayer
- the layer node to decorate. The node must implement ILcdLayerTreeNode.public TLcdGXYAsynchronousLayerTreeNodeWrapper(ILcdGXYLayer aDecoratedLayer, ILcdGXYAsynchronousPaintQueue aPaintQueue)
aDecoratedLayer
- the layer node to decorate. The node must implement ILcdLayerTreeNode.
Paint-sensitive state changes are propagated to and from the wrapper.aPaintQueue
- the paint queue that handles the asynchronous paint callspublic void addHierarchyLayeredListener(ILcdLayeredListener aListener)
ILcdLayerTreeNode
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 ILcdLayerTreeNode.addLayeredListener(ILcdLayeredListener)
.
The source ILcdLayered
of the event can be retrieved by calling TLcdLayeredEvent.getLayered()
on the received TLcdLayeredEvent
.
addHierarchyLayeredListener
in interface ILcdLayerTreeNode
aListener
- the listenerpublic void removeHierarchyLayeredListener(ILcdLayeredListener aListener)
ILcdLayerTreeNode
Unregisters the given ILcdLayeredListener
from
receiving TLcdLayeredEvent
s for the tree with this node as root node.
removeHierarchyLayeredListener
in interface ILcdLayerTreeNode
aListener
- the listenerpublic void addHierarchyPropertyChangeListener(PropertyChangeListener aListener)
ILcdLayerTreeNode
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 ILcdLayerTreeNode.addPropertyChangeListener(java.beans.PropertyChangeListener)
).
The source layer of the event can be retrieved by calling EventObject.getSource()
on the received PropertyChangeEvent
.
addHierarchyPropertyChangeListener
in interface ILcdLayerTreeNode
aListener
- the listenerpublic void removeHierarchyPropertyChangeListener(PropertyChangeListener aListener)
ILcdLayerTreeNode
Unregisters the given PropertyChangeListener
from
receiving PropertyChangeEvent
s for the tree with this node as root node.
removeHierarchyPropertyChangeListener
in interface ILcdLayerTreeNode
aListener
- the listenerpublic void removeAllLayers()
ILcdLayerTreeNode
ILcdLayer
objects from this ILcdLayered
.
This method will generate a TLcdLayeredEvent
indicating a layer was removed for
every child layer.
removeAllLayers
in interface ILcdLayered
removeAllLayers
in interface ILcdLayerTreeNode
public void addLayeredListener(ILcdLayeredListener aLayeredListener)
ILcdLayerTreeNode
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 ILcdLayerTreeNode.addHierarchyLayeredListener(ILcdLayeredListener)
).
addLayeredListener
in interface ILcdLayered
addLayeredListener
in interface ILcdLayerTreeNode
aLayeredListener
- the listener that from now on will be notified of all changes
to the ILcdLayered
ILcdLayered.removeLayeredListener(com.luciad.view.ILcdLayeredListener)
public void removeLayeredListener(ILcdLayeredListener aLayeredListener)
ILcdLayerTreeNode
ILcdLayeredListener
from receiving layered events for
the ILcdLayered
.
It is not possible to remove a hierarchy listener with this method. Use ILcdLayerTreeNode.removeHierarchyLayeredListener(ILcdLayeredListener)
for this purpose.
removeLayeredListener
in interface ILcdLayered
removeLayeredListener
in interface ILcdLayerTreeNode
aLayeredListener
- the listener that will no longer be notified of changes
to the ILcdLayered
ILcdLayered.addLayeredListener(ILcdLayeredListener)
public void addHierarchySelectionListener(ILcdSelectionListener aListener)
ILcdLayerTreeNode
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
.
addHierarchySelectionListener
in interface ILcdLayerTreeNode
aListener
- the listenerpublic void removeHierarchySelectionListener(ILcdSelectionListener aListener)
ILcdLayerTreeNode
Unregisters the given ILcdSelectionListener
from receiving TLcdSelectionChangedEvent
s for the tree with this node as root
node.
removeHierarchySelectionListener
in interface ILcdLayerTreeNode
aListener
- the listenerpublic int layerCount()
ILcdLayerTreeNode
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
layerCount
in interface ILcdLayerTreeNode
ILcdLayer
objects in this ILcdLayered
.public Enumeration layers()
ILcdLayerTreeNode
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
layers
in interface ILcdLayerTreeNode
Enumeration
of all ILcdLayer
objects currently
in this ILcdLayered
,
starting from the bottom layer to the top layer.public Enumeration layersBackwards()
ILcdLayerTreeNode
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
layersBackwards
in interface ILcdLayerTreeNode
Enumeration
of all ILcdLayer
objects currently in this ILcdLayered
,
starting from the top layer to the bottom layer.public ILcdLayer getLayer(int aIndex) throws ArrayIndexOutOfBoundsException
ILcdLayered
ILcdLayer
in this ILcdLayered
with index aIndex
.getLayer
in interface ILcdLayered
aIndex
- the position of the layer to retrieve in the ILcdLayered
.ILcdLayer
in this ILcdLayered
with index aIndex
.ArrayIndexOutOfBoundsException
- if the given index is invalidpublic ILcdLayer layerOf(ILcdModel aModel) throws NoSuchElementException
ILcdLayered
ILcdLayer
of this ILcdLayered
that contains the given ILcdModel
.layerOf
in interface ILcdLayered
aModel
- the model to check for in this ILcdLayered
.ILcdLayer
of this ILcdLayered
that contains the given ILcdModel
.NoSuchElementException
- if there is no layer containing the given modelpublic int indexOf(ILcdLayer aLayer) throws NoSuchElementException
ILcdLayered
indexOf
in interface ILcdLayered
aLayer
- the layer whose index to returnaLayer
NoSuchElementException
- if aLayer
is not in the listpublic boolean containsLayer(ILcdLayer aLayer)
ILcdLayerTreeNode
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
containsLayer
in interface ILcdLayerTreeNode
aLayer
- the layer to check whether it is in this layered.aLayer
is in this ILcdLayered
,
false otherwise.public void removeLayer(ILcdLayer aLayer) throws NoSuchElementException
ILcdLayered
ILcdLayered
.removeLayer
in interface ILcdLayered
aLayer
- the layer to remove.NoSuchElementException
public void moveLayerAt(int aIndex, ILcdLayer aLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException
ILcdLayered
ILcdLayered
) to the existing index
aIndex.
When a layer is moved down, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position up.
When a layer is moved up, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position down.
More formally, let previousIndex be the index of aLayer
before the move.
If previousIndex < aIndex, then the index of all ILcdLayer
objects
in from previousIndex + 1 to aIndex is decremented with 1.
If previousIndex > aIndex, then the index of all ILcdLayer
objects
in from aIndex to previousIndex -1 is incremented with 1.
moveLayerAt
in interface ILcdLayered
aIndex
- the index of the position where to move the layer.aLayer
- the layer to move.NoSuchElementException
- if aLayer
is not in this ILcdLayered
.ArrayIndexOutOfBoundsException
- if aIndex
is not an index of one of
the layers of this ILcdLayered
.public boolean addLayer(ILcdLayer aNewChildNode) throws IllegalArgumentException
ILcdLayerTreeNode
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.
addLayer
in interface ILcdLayerTreeNode
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 treepublic boolean addLayer(ILcdLayer aNewChildNode, int aIndex) throws IndexOutOfBoundsException, IllegalArgumentException
ILcdLayerTreeNode
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.
addLayer
in interface ILcdLayerTreeNode
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 > ILcdLayerTreeNode.layerCount()
IllegalArgumentException
- when the node is already an element of the treepublic void removeLayer(int aIndex)
ILcdLayerTreeNode
Removes the node at index aIndex
from this node and sends the appropriate
TLcdLayeredEvent
.
removeLayer
in interface ILcdLayerTreeNode
aIndex
- the index of the child node which has to be removedpublic boolean isPaintOnTopOfChildrenHint()
ILcdLayerTreeNode
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.
isPaintOnTopOfChildrenHint
in interface ILcdLayerTreeNode
true
when a node should be painted on top of its children,
false
when the node should be painted underneath its child layersILcdLayerTreeNode.setPaintOnTopOfChildrenHint(boolean)
public void setPaintOnTopOfChildrenHint(boolean aPaintOnTopOfChildrenHint)
ILcdLayerTreeNode
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.
setPaintOnTopOfChildrenHint
in interface ILcdLayerTreeNode
aPaintOnTopOfChildrenHint
- true
when a node should be painted on top of its
children, false
when the node should be painted
underneath its child layersILcdLayerTreeNode.isPaintOnTopOfChildrenHint()
public ILcdInitialLayerIndexProvider getInitialLayerIndexProvider()
ILcdLayerTreeNode
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
.
getInitialLayerIndexProvider
in interface ILcdLayerTreeNode
null
ILcdLayerTreeNode.setInitialLayerIndexProvider(ILcdInitialLayerIndexProvider)
public void setInitialLayerIndexProvider(ILcdInitialLayerIndexProvider aInitialLayerIndexProvider)
ILcdLayerTreeNode
Sets an initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.
setInitialLayerIndexProvider
in interface ILcdLayerTreeNode
aInitialLayerIndexProvider
- The new initial layer index provider. May be
null
ILcdLayerTreeNode.getInitialLayerIndexProvider()