public class TLcdLayer extends Object implements ILcdLayer
ILcdLayer
interface.
It also allows setting a filter
to limit the
objects that the layer takes into account.ILcdLayer
,
Serialized FormConstructor and Description |
---|
TLcdLayer()
Creates a new, empty layer with a default label.
|
TLcdLayer(ILcdModel aModel,
String aLabel)
Creates a new, empty layer with the given label and model.
|
TLcdLayer(String aLabel)
Creates a new, empty layer with the given label.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers the given
PropertyChangeListener 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 this
ILcdLayer , i.e., the selection of
this ILcdLayer is empty afterward. |
void |
fireCollectedSelectionChanges()
Fires a
TLcdSelectionChangedEvent that contains all the
selection changes appended by successively calling
selectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER) . |
void |
firePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent)
Notifies the registered property change listeners of the given property change event.
|
ILcdFilter |
getFilter()
Gets the current
ILcdFilter that filter the Object on this
ILcdLayer . |
ILcdIcon |
getIcon()
Returns a visual indication of the contents of this layer.
|
String |
getLabel()
Gets the label of this
ILcdLayer . |
ILcdModel |
getModel()
Gets the
ILcdModel currently associated to this ILcdLayer . |
int |
getSelectionCount()
Returns the number of objects in this selection.
|
void |
invalidate()
Convenience method to indicate that the representation of the model is no longer valid.
|
boolean |
isEditable()
Returns whether the layer allows editing the content that it visualizes.
|
boolean |
isEditableSupported()
Returns
true if the layer supports editing its objects. |
boolean |
isSelectable()
Returns whether the layer's objects can be selected, for example, by clicking on them.
|
boolean |
isSelectableSupported()
Returns
true if this layer supports selecting objects, false otherwise. |
boolean |
isSelected(Object aObject)
Checks whether the given
Object is currently in the set of
selected objects. |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
boolean |
isVisible()
Returns whether or not the layer's content is painted.
|
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
De-registers the given
PropertyChangeListener from receiving property change events
for this object. |
void |
removeSelectionListener(ILcdSelectionListener<Object> aSelectionListener)
Removes an
ILcdSelectionListener from this ILcdSelection . |
Enumeration<Object> |
selectedObjects()
Returns the objects in this selection.
|
void |
selectObject(Object aObject,
boolean aSelection,
int aDispatchEventMode)
Changes the selection state of any element contained in the
ILcdModel this ILcdLayer refers to. |
void |
selectObjects(Collection<Object> aObjects,
boolean aSelection,
int aDispatchEventMode)
Changes the selection state for the given collection of objects contained in the
ILcdModel this ILcdLayer refers to. |
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setEditable(boolean aEditable)
Sets whether the layer should allow editing the content that it visualizes.
|
void |
setFilter(ILcdFilter aFilter)
Sets the
ILcdFilter to filter the Object on this
ILcdLayer . |
void |
setIcon(ILcdIcon aIcon)
Sets a visual indication of the contents of this layer.
|
void |
setLabel(String aLabel)
Sets the label of this
ILcdLayer . |
void |
setModel(ILcdModel aModel)
Sets the
ILcdModel to this ILcdLayer . |
void |
setSelectable(boolean aSelectable)
Sets the Selectable property of this
ILcdLayer . |
void |
setSelectableSupported(boolean aSelectableSupported)
Controls whether this layer supports selection.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setVisible(boolean aVisible)
Sets whether or not the layer's content is painted.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSelectedObjects
public TLcdLayer()
setModel(com.luciad.model.ILcdModel)
public TLcdLayer(String aLabel)
aLabel
- a label for the layersetModel(com.luciad.model.ILcdModel)
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.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.public boolean isTraceOn()
true
if tracing is enabled for this class.public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
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.
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
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.
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void firePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent)
aPropertyChangeEvent
- the event that should be passed on to all registered listenerspublic ILcdModel getModel()
ILcdModel
currently associated to this ILcdLayer
.public void setModel(ILcdModel aModel)
ILcdModel
to this ILcdLayer
.aModel
- the model that contains the objects that should be displayed in this layer.public void invalidate()
public ILcdFilter getFilter()
ILcdFilter
that filter the Object
on this
ILcdLayer
.setFilter(com.luciad.util.ILcdFilter)
public void setFilter(ILcdFilter aFilter)
Sets the ILcdFilter
to filter the Object
on this
ILcdLayer
. 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 is null
.
aFilter
- the filter that accepts only those objects that should be taken into account.getFilter()
public void setVisible(boolean aVisible)
ILcdLayer
setVisible
in interface ILcdLayer
aVisible
- true
if the layer should be visible, false
otherwise.ILcdLayer.isVisible()
public boolean isVisible()
ILcdLayer
isVisible
in interface ILcdLayer
true
if the layer is visible, false
otherwise.ILcdLayer.setVisible(boolean)
public boolean isSelectableSupported()
true
if this layer supports selecting objects, false
otherwise.isSelectableSupported
in interface ILcdLayer
true
if this ILcdLayer
supports the
selectable property, false
otherwise. I.e. if this
ILcdLayer
can be put or not in a selectable mode.setSelectableSupported(boolean)
public void setSelectableSupported(boolean aSelectableSupported)
true
.
If the layer supports selection, selection can be activated by calling setSelectable(boolean)
.
It is recommended to only set this property once, right after constructing the layer, e.g. in a layer factory.
aSelectableSupported
- true
to allow making this layer's contents selectable, and false
otherwise.public void setSelectable(boolean aSelectable)
ILcdLayer
ILcdLayer
.
Check isSelectableSupported
to see if the layer supports selection.setSelectable
in interface ILcdLayer
aSelectable
- true
if the layer allows selection, false
otherwise.ILcdLayer.isSelectable()
,
ILcdLayer.isSelectableSupported()
public boolean isSelectable()
ILcdLayer
isSelectable
in interface ILcdLayer
true
if the layer allows selection, false
otherwise.ILcdSelection
,
ILcdLayer.setSelectable(boolean)
public boolean isEditableSupported()
true
if the layer supports editing its objects.
This implementation always returns true. Override this method if editing behavior is restricted.isEditableSupported
in interface ILcdLayer
true
.ILcdLayer.setEditable(boolean)
public void setEditable(boolean aEditable)
ILcdLayer
isEditableSupported
to see if the layer supports editing.setEditable
in interface ILcdLayer
aEditable
- true if the layer content can be editedILcdLayer.isEditableSupported()
,
ILcdLayer.isEditable()
public boolean isEditable()
ILcdLayer
isEditable
in interface ILcdLayer
true
if this ILcdLayer
is editable,
false
otherwiseILcdLayer.setEditable(boolean)
public String getLabel()
ILcdLayer
.public void setLabel(String aLabel)
ILcdLayer
.public Enumeration<Object> selectedObjects()
ILcdSelection
selectedObjects
in interface ILcdSelection<Object>
ILcdSelection
.public int getSelectionCount()
ILcdSelection
getSelectionCount
in interface ILcdSelection<Object>
ILcdSelection
.public boolean isSelected(Object aObject) throws IllegalArgumentException
ILcdSelection
Object
is currently in the set of
selected objects.isSelected
in interface ILcdSelection<Object>
aObject
- the Object
to be checked.true
if the Object
is in this ILcdSelection
,
false otherwise.IllegalArgumentException
public void selectObject(Object aObject, boolean aSelection, int aDispatchEventMode)
ILcdModel
this ILcdLayer
refers to. This method
shall have an effect only if isSelectableSupported and isSelectable return
true.selectObject
in interface ILcdLayer
aObject
- the Object
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 among ILcdFireEventMode.FIRE_NOW
,
ILcdFireEventMode.FIRE_LATER
, ILcdFireEventMode.NO_EVENT
selectObjects(java.util.Collection<java.lang.Object>, boolean, int)
public void selectObjects(Collection<Object> aObjects, boolean aSelection, int aDispatchEventMode)
ILcdModel
this ILcdLayer
refers to. This method
shall have an effect only if isSelectableSupported and isSelectable return
true.aObjects
- the collection of Object
s to select or deselect.aSelection
- the selection state, true
to select, false
to deselect.aDispatchEventMode
- shall be one among ILcdFireEventMode.FIRE_NOW
,
ILcdFireEventMode.FIRE_LATER
, ILcdFireEventMode.NO_EVENT
ILcdFireEventMode
public void fireCollectedSelectionChanges()
ILcdLayer
TLcdSelectionChangedEvent
that contains all the
selection changes appended by successively calling
selectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER)
.fireCollectedSelectionChanges
in interface ILcdLayer
public void clearSelection(int aDispatchEventMode)
ILcdLayer
ILcdLayer
, i.e., the selection of
this ILcdLayer
is empty afterward.clearSelection
in interface ILcdLayer
aDispatchEventMode
- shall be one among ILcdFireEventMode.FIRE_NOW
,
ILcdFireEventMode.FIRE_LATER
, ILcdFireEventMode.NO_EVENT
ILcdFireEventMode
public void addSelectionListener(ILcdSelectionListener<Object> aSelectionListener)
ILcdSelection
ILcdSelection
,
you can use a ALcdWeakSelectionListener
instance as selection listener.addSelectionListener
in interface ILcdSelection<Object>
aSelectionListener
- the ILcdSelectionListener
to be added.public void removeSelectionListener(ILcdSelectionListener<Object> aSelectionListener)
ILcdSelection
ILcdSelectionListener
from this ILcdSelection
.removeSelectionListener
in interface ILcdSelection<Object>
aSelectionListener
- the ILcdSelectionListener
to be removed.public ILcdIcon getIcon()
ILcdLayer
public void setIcon(ILcdIcon aIcon)
ILcdLayer
setIcon
in interface ILcdLayer
aIcon
- a visual indication of the contents of this layer.ILcdLayer.getIcon()