public class TLcd2DBoundsIndexedModelTreeNode extends TLcd2DBoundsIndexedModel implements ILcdModelTreeNode
An implementation of ILcdModelTreeNode
based on a TLcd2DBoundsIndexedModel
. It is mainly intended for
nodes with data (see TLcdModelTreeNode
for empty nodes). Such a model node is a model
which useful data and could have child models.
The isEmpty()
method is used to indicate whether a node is empty or not. By default,
this method will check the TLcd2DBoundsIndexedModel.size()
of the model.
The created model nodes are instances of TLcd2DBoundsIndexedModel
, and have the same features and properties.
TLcdModelTreeNode
,
Serialized FormILcdModel.Query
fModelEventSupport
FIRE_LATER, FIRE_NOW, NO_EVENT
Constructor and Description |
---|
TLcd2DBoundsIndexedModelTreeNode()
Constructs a new, empty
TLcd2DBoundsIndexedModel with a default TLcdModelDescriptor . |
TLcd2DBoundsIndexedModelTreeNode(ILcdBounds aBounds)
Constructs a new empty
TLcd2DBoundsIndexedModel with a default TLcdModelDescriptor . |
Modifier and Type | Method and Description |
---|---|
void |
addHierarchyModelContainerListener(ILcdModelContainerListener aModelContainerListener)
Registers the given
ILcdModelContainerListener to receive TLcdModelContainerEvent s from all the
ILcdModelTreeNode s contained in the tree with this node as root node. |
void |
addHierarchyModelListener(ILcdModelListener aModelListener)
Registers the given
ILcdModelListener to receive
TLcdModelChangedEvent s from all the ILcdModel s contained in the tree
with this node as root node. |
boolean |
addModel(ILcdModel aModel)
Adds the
ILcdModel aModel as a child model to this
ILcdModelTreeNode . |
void |
addModelContainerListener(ILcdModelContainerListener aModelContainerListener)
Adds an
ILcdModelContainerListener to this ILcdModelContainer . |
ILcdModel |
getModel(int aIndex)
Returns the child model at the given index.
|
boolean |
isEmpty()
Returns
true when the model node is only used as a container for other models,
and contains no useful data itself, false otherwise. |
int |
modelCount()
Returns the number of child models of this model node.
|
void |
modelProduced(TLcdModelProducerEvent e)
Notifies this ILcdModelProducerListener of a produced model.
|
Enumeration |
models()
Returns an
Enumeration of the child models of this
ILcdModelTreeNode . |
void |
removeHierarchyModelContainerListener(ILcdModelContainerListener aModelContainerListener)
Unregisters the given
ILcdModelContainerListener from receiving TLcdModelContainerEvent s for the tree
with this node as root node. |
void |
removeHierarchyModelListener(ILcdModelListener aModelListener)
Unregisters the given
ILcdModelListener from
receiving TLcdModelChangedEvent s for the tree with this node as root node. |
boolean |
removeModel(ILcdModel aModel)
Removes the child model
aModel from this ILcdModelTreeNode . |
void |
removeModelContainerListener(ILcdModelContainerListener aModelContainerListener)
Removes an
ILcdModelContainerListener from this ILcdModelContainer . |
addElement, allElementsChanged, applyOnInteract2DBounds, applyOnInteract2DBounds, canAddElement, canRemoveElement, contains, elementAt, elementChanged, elements, elementsChanged, getAddElementFilter, getBounds, getRemoveElementFilter, indexOf, isSynchronized, removeAllElements, removeElement, setAddElementFilter, setRemoveElementFilter, setSynchronized, size
addElements, addModelListener, allElementsRemoved, dispose, elementAdded, elementRemoved, elementsAdded, elementsRemoved, fireCollectedModelChanges, getModelDescriptor, getModelEncoder, getModelMetadata, getModelReference, initializeTransientValues, isClassTraceOn, isTraceOn, removeElements, removeModelListener, setClassTraceOn, setModelDescriptor, setModelDisposer, setModelEncoder, setModelMetadataFunction, setModelReference, setTraceOn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addElement, addElements, addModelListener, canAddElement, canRemoveElement, dispose, elementChanged, elements, elementsChanged, fireCollectedModelChanges, getModelDescriptor, getModelEncoder, getModelReference, removeAllElements, removeElement, removeElements, removeModelListener
all, filter, getModelMetadata, query
close
getModels
query
public TLcd2DBoundsIndexedModelTreeNode()
TLcd2DBoundsIndexedModel
with a default TLcdModelDescriptor
.public TLcd2DBoundsIndexedModelTreeNode(ILcdBounds aBounds)
TLcd2DBoundsIndexedModel
with a default TLcdModelDescriptor
.aBounds
- the initial bounds for the spatial indexing scheme of the model.
They should ideally encompass all the elements the user plans to add
to the model, although this model will extend its bounds when required,
by 'unfolding' the rectangle in the appropriate direction, i.e. by doubling
the size of the bounds. The initial width or height of the bounds must therefore
be larger than 0. The bounds of the entire model space are a safe bet,
although they will be less efficient when the model is much smaller.public boolean addModel(ILcdModel aModel)
ILcdModelTreeNode
Adds the ILcdModel aModel
as a child model to this
ILcdModelTreeNode
.
addModel
in interface ILcdModelContainer
addModel
in interface ILcdModelTreeNode
aModel
- the model to be added.true
if this collection of models changed as a result of the callpublic boolean removeModel(ILcdModel aModel)
ILcdModelTreeNode
Removes the child model aModel
from this ILcdModelTreeNode
.
removeModel
in interface ILcdModelContainer
removeModel
in interface ILcdModelTreeNode
aModel
- the model to be removed.true
if a model was removed as a result of this callpublic void addHierarchyModelContainerListener(ILcdModelContainerListener aModelContainerListener)
ILcdModelTreeNode
Registers the given ILcdModelContainerListener
to receive TLcdModelContainerEvent
s from all the
ILcdModelTreeNode
s contained in the tree with this node as root node. If the
listener should only receive events originating from this model node, it should be adedd as a
regular model listener (see ILcdModelTreeNode.addModelContainerListener(ILcdModelContainerListener)
).
The source ILcdModelContainer
of the event can be retrieved by calling TLcdModelContainerEvent.getModelContainer()
on the received TLcdModelContainerEvent
.
addHierarchyModelContainerListener
in interface ILcdModelTreeNode
aModelContainerListener
- the listenerILcdModelTreeNode.removeHierarchyModelContainerListener(ILcdModelContainerListener)
public void removeHierarchyModelContainerListener(ILcdModelContainerListener aModelContainerListener)
ILcdModelTreeNode
Unregisters the given ILcdModelContainerListener
from receiving TLcdModelContainerEvent
s for the tree
with this node as root node.
removeHierarchyModelContainerListener
in interface ILcdModelTreeNode
aModelContainerListener
- the listenerILcdModelTreeNode.addHierarchyModelContainerListener(ILcdModelContainerListener)
public void addHierarchyModelListener(ILcdModelListener aModelListener)
ILcdModelTreeNode
Registers the given ILcdModelListener
to receive
TLcdModelChangedEvent
s from all the ILcdModel
s contained in the tree
with this node as root node. If the listener should only receive events originating from this
model node, it should be added as a regular model listener (see ILcdModelTreeNode.addModelListener(ILcdModelListener)
).
The source ILcdModel
of the event can be retrieved by calling TLcdModelChangedEvent.getModel()
on the received TLcdModelChangedEvent
.
addHierarchyModelListener
in interface ILcdModelTreeNode
aModelListener
- the listenerILcdModelTreeNode.removeHierarchyModelListener(ILcdModelListener)
public void removeHierarchyModelListener(ILcdModelListener aModelListener)
ILcdModelTreeNode
Unregisters the given ILcdModelListener
from
receiving TLcdModelChangedEvent
s for the tree with this node as root node.
removeHierarchyModelListener
in interface ILcdModelTreeNode
aModelListener
- the listenerILcdModelTreeNode.addHierarchyModelListener(ILcdModelListener)
public void addModelContainerListener(ILcdModelContainerListener aModelContainerListener)
ILcdModelTreeNode
ILcdModelContainerListener
to this ILcdModelContainer
.
It will only receive notifications of changes in this ILcdModelTreeNode
and not
of any changes in the state of the child model node(s). If this is required, the listener must
be registered as a hierarchy listener (see ILcdModelTreeNode.addHierarchyModelContainerListener(ILcdModelContainerListener)
).
addModelContainerListener
in interface ILcdModelContainer
addModelContainerListener
in interface ILcdModelTreeNode
aModelContainerListener
- the listener to be added.ILcdModelContainer.removeModelContainerListener(com.luciad.model.ILcdModelContainerListener)
public void removeModelContainerListener(ILcdModelContainerListener aModelContainerListener)
ILcdModelTreeNode
ILcdModelContainerListener
from this ILcdModelContainer
.
It is not possible to remove a hierarchy model container listener. Use ILcdModelTreeNode.removeHierarchyModelContainerListener(ILcdModelContainerListener)
for this purpose.
removeModelContainerListener
in interface ILcdModelContainer
removeModelContainerListener
in interface ILcdModelTreeNode
aModelContainerListener
- the listener to be removed.ILcdModelContainer.addModelContainerListener(com.luciad.model.ILcdModelContainerListener)
public int modelCount()
ILcdModelTreeNode
Returns the number of child models of this model node.
modelCount
in interface ILcdModelContainer
modelCount
in interface ILcdModelTreeNode
public ILcdModel getModel(int aIndex)
ILcdModelTreeNode
Returns the child model at the given index.
getModel
in interface ILcdModelContainer
getModel
in interface ILcdModelTreeNode
aIndex
- a valid index in this ILcdModelTreeNode
public Enumeration models()
ILcdModelTreeNode
Returns an Enumeration
of the child models of this
ILcdModelTreeNode
.
models
in interface ILcdModelContainer
models
in interface ILcdModelTreeNode
Enumeration
of the child models of this ILcdModelTreeNode
.public void modelProduced(TLcdModelProducerEvent e)
ILcdModelProducerListener
modelProduced
in interface ILcdModelProducerListener
e
- the event describing the changes to a ILcdModelProducer
.public boolean isEmpty()
Returns true
when the model node is only used as a container for other models,
and contains no useful data itself, false
otherwise.
This implementation looks at the TLcd2DBoundsIndexedModel.size()
of the model to determine whether this model
node is empty or not.
isEmpty
in interface ILcdModelTreeNode
true
when the model node contains no useful data, false
otherwise