Class TLcdLayer
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdSelection<Object>
,ILcdLayer
,Serializable
- Direct Known Subclasses:
TLcdGXYLayer
ILcdLayer
interface.
It also allows setting a filter
to limit the
objects that the layer takes into account.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.void
addSelectionListener
(ILcdSelectionListener<Object> aSelectionListener) Adds a listener to this selection.void
clearSelection
(int aDispatchEventMode) Deselect all the Objects in thisILcdLayer
, i.e., the selection of thisILcdLayer
is empty afterward.void
Fires aTLcdSelectionChangedEvent
that contains all the selection changes appended by successively callingselectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER)
.void
firePropertyChangeEvent
(PropertyChangeEvent aPropertyChangeEvent) Notifies the registered property change listeners of the given property change event.Gets the currentILcdFilter
that filter theObject
on thisILcdLayer
.getIcon()
Returns a visual indication of the contents of this layer.getLabel()
Gets the label of thisILcdLayer
.getModel()
Gets theILcdModel
currently associated to thisILcdLayer
.int
Returns the number of objects in this selection.void
Convenience method to indicate that the representation of the model is no longer valid.boolean
Returns whether the layer allows editing the content that it visualizes.boolean
Returnstrue
if the layer supports editing its objects.boolean
Returns whether the layer's objects can be selected, for example, by clicking on them.boolean
Returnstrue
if this layer supports selecting objects,false
otherwise.boolean
isSelected
(Object aObject) Checks whether the givenObject
is currently in the set of selected objects.boolean
Deprecated.This method has been deprecated.boolean
Returns whether or not the layer's content is painted.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
removeSelectionListener
(ILcdSelectionListener<Object> aSelectionListener) Removes anILcdSelectionListener
from thisILcdSelection
.Returns the objects in this selection.void
selectObject
(Object aObject, boolean aSelection, int aDispatchEventMode) Changes the selection state of any element contained in theILcdModel
thisILcdLayer
refers to.void
selectObjects
(Collection<Object> aObjects, boolean aSelection, int aDispatchEventMode) Changes the selection state for the given collection of objects contained in theILcdModel
thisILcdLayer
refers to.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setEditable
(boolean aEditable) Sets whether the layer should allow editing the content that it visualizes.void
setFilter
(ILcdFilter aFilter) Sets theILcdFilter
to filter theObject
on thisILcdLayer
.void
Sets a visual indication of the contents of this layer.void
Sets the label of thisILcdLayer
.void
Sets theILcdModel
to thisILcdLayer
.void
setSelectable
(boolean aSelectable) Sets the Selectable property of thisILcdLayer
.void
setSelectableSupported
(boolean aSelectableSupported) Controls whether this layer supports selection.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
setVisible
(boolean aVisible) Sets whether or not the layer's content is painted.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdSelection
getSelectedObjects
-
Constructor Details
-
TLcdLayer
public TLcdLayer()Creates a new, empty layer with a default label. After calling this constructor, a model needs to be set.- See Also:
-
TLcdLayer
Creates a new, empty layer with the given label. After calling this constructor, a model needs to be set.- Parameters:
aLabel
- a label for the layer- See Also:
-
TLcdLayer
Creates a new, empty layer with the given label and model.- Parameters:
aModel
- the model to representaLabel
- a label for the layer
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
Registers the given
PropertyChangeListener
to be notified when this object's properties change.In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakPropertyChangeListener
instance as property change listener.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
De-registers the given
PropertyChangeListener
from receiving property change events for this object.If the listener was added more than once, it will be notified one less time after being removed. If the listener is
null
, or was never added, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
firePropertyChangeEvent
Notifies the registered property change listeners of the given property change event.- Parameters:
aPropertyChangeEvent
- the event that should be passed on to all registered listeners
-
getModel
Gets theILcdModel
currently associated to thisILcdLayer
. -
setModel
Sets theILcdModel
to thisILcdLayer
.- Parameters:
aModel
- the model that contains the objects that should be displayed in this layer.
-
invalidate
public void invalidate()Convenience method to indicate that the representation of the model is no longer valid. Call this method after modifying settings that influence the representation of the model, but are not properties of the layer itself. This method does not have to be called when setting a property of the layer itself (for example, calling setVisible) as setting such a property will inform listeners that the representation of the model is no longer valid. -
getFilter
Gets the currentILcdFilter
that filter theObject
on thisILcdLayer
.- Returns:
- the filter that accepts only those objects that should be taken into account.
- See Also:
-
setFilter
Sets the
ILcdFilter
to filter theObject
on thisILcdLayer
. Operations on this layer will only be applied to objects of the model that pass the filter. This includes painting, labeling, selection, editing, ...If the filter implements
ILcdChangeSource
, the layer will listen to changes in the filter to keep, for example, the selection up to date.Setting a
null
filter, lets all objects pass for rendering. By default the filter isnull
.- Parameters:
aFilter
- the filter that accepts only those objects that should be taken into account.- See Also:
-
setVisible
public void setVisible(boolean aVisible) Description copied from interface:ILcdLayer
Sets whether or not the layer's content is painted.- Specified by:
setVisible
in interfaceILcdLayer
- Parameters:
aVisible
-true
if the layer should be visible,false
otherwise.- See Also:
-
isVisible
public boolean isVisible()Description copied from interface:ILcdLayer
Returns whether or not the layer's content is painted. -
isSelectableSupported
public boolean isSelectableSupported()Returnstrue
if this layer supports selecting objects,false
otherwise.- Specified by:
isSelectableSupported
in interfaceILcdLayer
- Returns:
true
if thisILcdLayer
supports the selectable property,false
otherwise. I.e. if thisILcdLayer
can be put or not in a selectable mode.- See Also:
-
setSelectableSupported
public void setSelectableSupported(boolean aSelectableSupported) Controls whether this layer supports selection. By default this property istrue
. If the layer supports selection, selection can be activated by callingsetSelectable(boolean)
.It is recommended to only set this property once, right after constructing the layer, e.g. in a layer factory.
- Parameters:
aSelectableSupported
-true
to allow making this layer's contents selectable, andfalse
otherwise.- Since:
- 2017.0
-
setSelectable
public void setSelectable(boolean aSelectable) Description copied from interface:ILcdLayer
Sets the Selectable property of thisILcdLayer
. CheckisSelectableSupported
to see if the layer supports selection.- Specified by:
setSelectable
in interfaceILcdLayer
- Parameters:
aSelectable
-true
if the layer allows selection,false
otherwise.- See Also:
-
isSelectable
public boolean isSelectable()Description copied from interface:ILcdLayer
Returns whether the layer's objects can be selected, for example, by clicking on them.- Specified by:
isSelectable
in interfaceILcdLayer
- Returns:
true
if the layer allows selection,false
otherwise.- See Also:
-
isEditableSupported
public boolean isEditableSupported()Returnstrue
if the layer supports editing its objects. This implementation always returns true. Override this method if editing behavior is restricted.- Specified by:
isEditableSupported
in interfaceILcdLayer
- Returns:
true
.- See Also:
-
setEditable
public void setEditable(boolean aEditable) Description copied from interface:ILcdLayer
Sets whether the layer should allow editing the content that it visualizes. CheckisEditableSupported
to see if the layer supports editing.- Specified by:
setEditable
in interfaceILcdLayer
- Parameters:
aEditable
- true if the layer content can be edited- See Also:
-
isEditable
public boolean isEditable()Description copied from interface:ILcdLayer
Returns whether the layer allows editing the content that it visualizes.- Specified by:
isEditable
in interfaceILcdLayer
- Returns:
true
if thisILcdLayer
is editable,false
otherwise- See Also:
-
getLabel
Gets the label of thisILcdLayer
. -
setLabel
Sets the label of thisILcdLayer
. -
selectedObjects
Description copied from interface:ILcdSelection
Returns the objects in this selection.- Specified by:
selectedObjects
in interfaceILcdSelection<Object>
- Returns:
- the objects currently in this
ILcdSelection
.
-
getSelectionCount
public int getSelectionCount()Description copied from interface:ILcdSelection
Returns the number of objects in this selection.- Specified by:
getSelectionCount
in interfaceILcdSelection<Object>
- Returns:
- the number of objects in this
ILcdSelection
.
-
isSelected
Description copied from interface:ILcdSelection
Checks whether the givenObject
is currently in the set of selected objects.- Specified by:
isSelected
in interfaceILcdSelection<Object>
- Parameters:
aObject
- theObject
to be checked.- Returns:
true
if theObject
is in thisILcdSelection
, false otherwise.- Throws:
IllegalArgumentException
-
selectObject
Changes the selection state of any element contained in theILcdModel
thisILcdLayer
refers to. This method shall have an effect only if isSelectableSupported and isSelectable return true.- Specified by:
selectObject
in interfaceILcdLayer
- Parameters:
aObject
- theObject
to select or deselect. The object should be in the model of this layer. The implementation of this method is not responsible for checking this.aSelection
- the selection state,true
to select,false
to deselect.aDispatchEventMode
- shall be one amongILcdFireEventMode.FIRE_NOW
,ILcdFireEventMode.FIRE_LATER
,ILcdFireEventMode.NO_EVENT
- See Also:
-
selectObjects
Changes the selection state for the given collection of objects contained in theILcdModel
thisILcdLayer
refers to. This method shall have an effect only if isSelectableSupported and isSelectable return true.- Parameters:
aObjects
- the collection ofObject
s to select or deselect.aSelection
- the selection state,true
to select,false
to deselect.aDispatchEventMode
- shall be one amongILcdFireEventMode.FIRE_NOW
,ILcdFireEventMode.FIRE_LATER
,ILcdFireEventMode.NO_EVENT
- See Also:
-
fireCollectedSelectionChanges
public void fireCollectedSelectionChanges()Description copied from interface:ILcdLayer
Fires aTLcdSelectionChangedEvent
that contains all the selection changes appended by successively callingselectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER)
.- Specified by:
fireCollectedSelectionChanges
in interfaceILcdLayer
-
clearSelection
public void clearSelection(int aDispatchEventMode) Description copied from interface:ILcdLayer
Deselect all the Objects in thisILcdLayer
, i.e., the selection of thisILcdLayer
is empty afterward.- Specified by:
clearSelection
in interfaceILcdLayer
- Parameters:
aDispatchEventMode
- shall be one amongILcdFireEventMode.FIRE_NOW
,ILcdFireEventMode.FIRE_LATER
,ILcdFireEventMode.NO_EVENT
- See Also:
-
addSelectionListener
Description copied from interface:ILcdSelection
Adds a listener to this selection. In case you need to register a listener which keeps a reference to an object with a shorter life-time than thisILcdSelection
, you can use aALcdWeakSelectionListener
instance as selection listener.- Specified by:
addSelectionListener
in interfaceILcdSelection<Object>
- Parameters:
aSelectionListener
- theILcdSelectionListener
to be added.
-
removeSelectionListener
Description copied from interface:ILcdSelection
Removes anILcdSelectionListener
from thisILcdSelection
.- Specified by:
removeSelectionListener
in interfaceILcdSelection<Object>
- Parameters:
aSelectionListener
- theILcdSelectionListener
to be removed.
-
getIcon
Description copied from interface:ILcdLayer
Returns a visual indication of the contents of this layer. For example, for a grid layer, an icon containing a grid could be used. -
setIcon
Description copied from interface:ILcdLayer
Sets a visual indication of the contents of this layer. -
toString
-