Class TLcd2DBoundsIndexedModelTreeNode
- All Implemented Interfaces:
ILcd2DBoundsIndexedModel
,ILcd2DBoundsInteractable
,ILcdIntegerIndexedModel
,ILcdModel
,ILcdModelContainer
,ILcdModelProducerListener
,ILcdModelTreeNode
,ILcdBounded
,ILcdDisposable
,Serializable
,AutoCloseable
,EventListener
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.
- Since:
- 9.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.model.ILcdModel
ILcdModel.Query
-
Field Summary
Fields inherited from class com.luciad.model.ALcdModel
fModelEventSupport
Fields inherited from interface com.luciad.model.ILcdModel
FIRE_LATER, FIRE_NOW, NO_EVENT
-
Constructor Summary
ConstructorDescriptionConstructs a new, emptyTLcd2DBoundsIndexedModel
with a defaultTLcdModelDescriptor
.Constructs a new emptyTLcd2DBoundsIndexedModel
with a defaultTLcdModelDescriptor
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHierarchyModelContainerListener
(ILcdModelContainerListener aModelContainerListener) Registers the givenILcdModelContainerListener
to receiveTLcdModelContainerEvent
s from all theILcdModelTreeNode
s contained in the tree with this node as root node.void
addHierarchyModelListener
(ILcdModelListener aModelListener) Registers the givenILcdModelListener
to receiveTLcdModelChangedEvent
s from all theILcdModel
s contained in the tree with this node as root node.boolean
Adds theILcdModel aModel
as a child model to thisILcdModelTreeNode
.void
addModelContainerListener
(ILcdModelContainerListener aModelContainerListener) Adds anILcdModelContainerListener
to thisILcdModelContainer
.getModel
(int aIndex) Returns the child model at the given index.boolean
isEmpty()
Returnstrue
when the model node is only used as a container for other models, and contains no useful data itself,false
otherwise.int
Returns the number of child models of this model node.void
Notifies this ILcdModelProducerListener of a produced model.models()
Returns anEnumeration
of the child models of thisILcdModelTreeNode
.void
removeHierarchyModelContainerListener
(ILcdModelContainerListener aModelContainerListener) Unregisters the givenILcdModelContainerListener
from receivingTLcdModelContainerEvent
s for the tree with this node as root node.void
removeHierarchyModelListener
(ILcdModelListener aModelListener) Unregisters the givenILcdModelListener
from receivingTLcdModelChangedEvent
s for the tree with this node as root node.boolean
removeModel
(ILcdModel aModel) Removes the child modelaModel
from thisILcdModelTreeNode
.void
removeModelContainerListener
(ILcdModelContainerListener aModelContainerListener) Removes anILcdModelContainerListener
from thisILcdModelContainer
.Methods inherited from class com.luciad.model.TLcd2DBoundsIndexedModel
addElement, allElementsChanged, applyOnInteract2DBounds, applyOnInteract2DBounds, canAddElement, canRemoveElement, contains, elementAt, elementChanged, elements, elementsChanged, getAddElementFilter, getBounds, getRemoveElementFilter, indexOf, isSynchronized, removeAllElements, removeElement, setAddElementFilter, setRemoveElementFilter, setSynchronized, size
Methods inherited from class com.luciad.model.ALcdModel
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcd2DBoundsIndexedModel
query
Methods inherited from interface com.luciad.util.ILcdDisposable
close
Methods inherited from interface com.luciad.model.ILcdModel
getModelMetadata
Methods inherited from interface com.luciad.model.ILcdModelContainer
getModels
Methods inherited from interface com.luciad.model.ILcdModelTreeNode
addElement, addElements, addModelListener, canAddElement, canRemoveElement, dispose, elementChanged, elements, elementsChanged, fireCollectedModelChanges, getModelDescriptor, getModelEncoder, getModelReference, removeAllElements, removeElement, removeElements, removeModelListener
-
Constructor Details
-
TLcd2DBoundsIndexedModelTreeNode
public TLcd2DBoundsIndexedModelTreeNode()Constructs a new, emptyTLcd2DBoundsIndexedModel
with a defaultTLcdModelDescriptor
. -
TLcd2DBoundsIndexedModelTreeNode
Constructs a new emptyTLcd2DBoundsIndexedModel
with a defaultTLcdModelDescriptor
.- Parameters:
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.
-
-
Method Details
-
addModel
Description copied from interface:ILcdModelTreeNode
Adds the
ILcdModel aModel
as a child model to thisILcdModelTreeNode
.- Specified by:
addModel
in interfaceILcdModelContainer
- Specified by:
addModel
in interfaceILcdModelTreeNode
- Parameters:
aModel
- the model to be added.- Returns:
true
if this collection of models changed as a result of the call
-
removeModel
Description copied from interface:ILcdModelTreeNode
Removes the child model
aModel
from thisILcdModelTreeNode
.- Specified by:
removeModel
in interfaceILcdModelContainer
- Specified by:
removeModel
in interfaceILcdModelTreeNode
- Parameters:
aModel
- the model to be removed.- Returns:
true
if a model was removed as a result of this call
-
addHierarchyModelContainerListener
Description copied from interface:ILcdModelTreeNode
Registers the given
ILcdModelContainerListener
to receiveTLcdModelContainerEvent
s from all theILcdModelTreeNode
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 (seeILcdModelTreeNode.addModelContainerListener(ILcdModelContainerListener)
).The source
ILcdModelContainer
of the event can be retrieved by callingTLcdModelContainerEvent.getModelContainer()
on the receivedTLcdModelContainerEvent
.- Specified by:
addHierarchyModelContainerListener
in interfaceILcdModelTreeNode
- Parameters:
aModelContainerListener
- the listener- See Also:
-
removeHierarchyModelContainerListener
public void removeHierarchyModelContainerListener(ILcdModelContainerListener aModelContainerListener) Description copied from interface:ILcdModelTreeNode
Unregisters the given
ILcdModelContainerListener
from receivingTLcdModelContainerEvent
s for the tree with this node as root node.- Specified by:
removeHierarchyModelContainerListener
in interfaceILcdModelTreeNode
- Parameters:
aModelContainerListener
- the listener- See Also:
-
addHierarchyModelListener
Description copied from interface:ILcdModelTreeNode
Registers the given
ILcdModelListener
to receiveTLcdModelChangedEvent
s from all theILcdModel
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 (seeILcdModelTreeNode.addModelListener(ILcdModelListener)
).The source
ILcdModel
of the event can be retrieved by callingTLcdModelChangedEvent.getModel()
on the receivedTLcdModelChangedEvent
.- Specified by:
addHierarchyModelListener
in interfaceILcdModelTreeNode
- Parameters:
aModelListener
- the listener- See Also:
-
removeHierarchyModelListener
Description copied from interface:ILcdModelTreeNode
Unregisters the given
ILcdModelListener
from receivingTLcdModelChangedEvent
s for the tree with this node as root node.- Specified by:
removeHierarchyModelListener
in interfaceILcdModelTreeNode
- Parameters:
aModelListener
- the listener- See Also:
-
addModelContainerListener
Description copied from interface:ILcdModelTreeNode
Adds anILcdModelContainerListener
to thisILcdModelContainer
.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 (seeILcdModelTreeNode.addHierarchyModelContainerListener(ILcdModelContainerListener)
).- Specified by:
addModelContainerListener
in interfaceILcdModelContainer
- Specified by:
addModelContainerListener
in interfaceILcdModelTreeNode
- Parameters:
aModelContainerListener
- the listener to be added.- See Also:
-
removeModelContainerListener
Description copied from interface:ILcdModelTreeNode
Removes anILcdModelContainerListener
from thisILcdModelContainer
.It is not possible to remove a hierarchy model container listener. Use
ILcdModelTreeNode.removeHierarchyModelContainerListener(ILcdModelContainerListener)
for this purpose.- Specified by:
removeModelContainerListener
in interfaceILcdModelContainer
- Specified by:
removeModelContainerListener
in interfaceILcdModelTreeNode
- Parameters:
aModelContainerListener
- the listener to be removed.- See Also:
-
modelCount
public int modelCount()Description copied from interface:ILcdModelTreeNode
Returns the number of child models of this model node.
- Specified by:
modelCount
in interfaceILcdModelContainer
- Specified by:
modelCount
in interfaceILcdModelTreeNode
- Returns:
- the number of child models of this model node.
-
getModel
Description copied from interface:ILcdModelTreeNode
Returns the child model at the given index.
- Specified by:
getModel
in interfaceILcdModelContainer
- Specified by:
getModel
in interfaceILcdModelTreeNode
- Parameters:
aIndex
- a valid index in thisILcdModelTreeNode
- Returns:
- the child model at the given index.
-
models
Description copied from interface:ILcdModelTreeNode
Returns an
Enumeration
of the child models of thisILcdModelTreeNode
.- Specified by:
models
in interfaceILcdModelContainer
- Specified by:
models
in interfaceILcdModelTreeNode
- Returns:
- an
Enumeration
of the child models of thisILcdModelTreeNode
.
-
modelProduced
Description copied from interface:ILcdModelProducerListener
Notifies this ILcdModelProducerListener of a produced model.- Specified by:
modelProduced
in interfaceILcdModelProducerListener
- Parameters:
e
- the event describing the changes to aILcdModelProducer
.
-
isEmpty
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.- Specified by:
isEmpty
in interfaceILcdModelTreeNode
- Returns:
true
when the model node contains no useful data,false
otherwise
-