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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListenerto be notified when this object's properties change.voidaddSelectionListener(ILcdSelectionListener<Object> aSelectionListener) Adds a listener to this selection.voidclearSelection(int aDispatchEventMode) Deselect all the Objects in thisILcdLayer, i.e., the selection of thisILcdLayeris empty afterward.voidFires aTLcdSelectionChangedEventthat contains all the selection changes appended by successively callingselectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER).voidfirePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent) Notifies the registered property change listeners of the given property change event.Gets the currentILcdFilterthat filter theObjecton thisILcdLayer.getIcon()Returns a visual indication of the contents of this layer.getLabel()Gets the label of thisILcdLayer.getModel()Gets theILcdModelcurrently associated to thisILcdLayer.intReturns the number of objects in this selection.voidConvenience method to indicate that the representation of the model is no longer valid.booleanReturns whether the layer allows editing the content that it visualizes.booleanReturnstrueif the layer supports editing its objects.booleanReturns whether the layer's objects can be selected, for example, by clicking on them.booleanReturnstrueif this layer supports selecting objects,falseotherwise.booleanisSelected(Object aObject) Checks whether the givenObjectis currently in the set of selected objects.booleanDeprecated.This method has been deprecated.booleanReturns whether or not the layer's content is painted.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListenerfrom receiving property change events for this object.voidremoveSelectionListener(ILcdSelectionListener<Object> aSelectionListener) Removes anILcdSelectionListenerfrom thisILcdSelection.Returns the objects in this selection.voidselectObject(Object aObject, boolean aSelection, int aDispatchEventMode) Changes the selection state of any element contained in theILcdModelthisILcdLayerrefers to.voidselectObjects(Collection<Object> aObjects, boolean aSelection, int aDispatchEventMode) Changes the selection state for the given collection of objects contained in theILcdModelthisILcdLayerrefers to.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidsetEditable(boolean aEditable) Sets whether the layer should allow editing the content that it visualizes.voidsetFilter(ILcdFilter aFilter) Sets theILcdFilterto filter theObjecton thisILcdLayer.voidSets a visual indication of the contents of this layer.voidSets the label of thisILcdLayer.voidSets theILcdModelto thisILcdLayer.voidsetSelectable(boolean aSelectable) Sets the Selectable property of thisILcdLayer.voidsetSelectableSupported(boolean aSelectableSupported) Controls whether this layer supports selection.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidsetVisible(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, waitMethods 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 istruethen 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 eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen 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.Returnstrueif tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceRegisters the given
PropertyChangeListenerto 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
ALcdWeakPropertyChangeListenerinstance as property change listener.- Specified by:
addPropertyChangeListenerin interfaceILcdPropertyChangeSource- Parameters:
aPropertyChangeListener- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceDe-registers the given
PropertyChangeListenerfrom 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:
removePropertyChangeListenerin 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 theILcdModelcurrently associated to thisILcdLayer. -
setModel
Sets theILcdModelto 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 currentILcdFilterthat filter theObjecton thisILcdLayer.- Returns:
- the filter that accepts only those objects that should be taken into account.
- See Also:
-
setFilter
Sets the
ILcdFilterto filter theObjecton 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
nullfilter, 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:ILcdLayerSets whether or not the layer's content is painted.- Specified by:
setVisiblein interfaceILcdLayer- Parameters:
aVisible-trueif the layer should be visible,falseotherwise.- See Also:
-
isVisible
public boolean isVisible()Description copied from interface:ILcdLayerReturns whether or not the layer's content is painted. -
isSelectableSupported
public boolean isSelectableSupported()Returnstrueif this layer supports selecting objects,falseotherwise.- Specified by:
isSelectableSupportedin interfaceILcdLayer- Returns:
trueif thisILcdLayersupports the selectable property,falseotherwise. I.e. if thisILcdLayercan 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-trueto allow making this layer's contents selectable, andfalseotherwise.- Since:
- 2017.0
-
setSelectable
public void setSelectable(boolean aSelectable) Description copied from interface:ILcdLayerSets the Selectable property of thisILcdLayer. CheckisSelectableSupportedto see if the layer supports selection.- Specified by:
setSelectablein interfaceILcdLayer- Parameters:
aSelectable-trueif the layer allows selection,falseotherwise.- See Also:
-
isSelectable
public boolean isSelectable()Description copied from interface:ILcdLayerReturns whether the layer's objects can be selected, for example, by clicking on them.- Specified by:
isSelectablein interfaceILcdLayer- Returns:
trueif the layer allows selection,falseotherwise.- See Also:
-
isEditableSupported
public boolean isEditableSupported()Returnstrueif the layer supports editing its objects. This implementation always returns true. Override this method if editing behavior is restricted.- Specified by:
isEditableSupportedin interfaceILcdLayer- Returns:
true.- See Also:
-
setEditable
public void setEditable(boolean aEditable) Description copied from interface:ILcdLayerSets whether the layer should allow editing the content that it visualizes. CheckisEditableSupportedto see if the layer supports editing.- Specified by:
setEditablein interfaceILcdLayer- Parameters:
aEditable- true if the layer content can be edited- See Also:
-
isEditable
public boolean isEditable()Description copied from interface:ILcdLayerReturns whether the layer allows editing the content that it visualizes.- Specified by:
isEditablein interfaceILcdLayer- Returns:
trueif thisILcdLayeris editable,falseotherwise- See Also:
-
getLabel
Gets the label of thisILcdLayer. -
setLabel
Sets the label of thisILcdLayer. -
selectedObjects
Description copied from interface:ILcdSelectionReturns the objects in this selection.- Specified by:
selectedObjectsin interfaceILcdSelection<Object>- Returns:
- the objects currently in this
ILcdSelection.
-
getSelectionCount
public int getSelectionCount()Description copied from interface:ILcdSelectionReturns the number of objects in this selection.- Specified by:
getSelectionCountin interfaceILcdSelection<Object>- Returns:
- the number of objects in this
ILcdSelection.
-
isSelected
Description copied from interface:ILcdSelectionChecks whether the givenObjectis currently in the set of selected objects.- Specified by:
isSelectedin interfaceILcdSelection<Object>- Parameters:
aObject- theObjectto be checked.- Returns:
trueif theObjectis in thisILcdSelection, false otherwise.- Throws:
IllegalArgumentException
-
selectObject
Changes the selection state of any element contained in theILcdModelthisILcdLayerrefers to. This method shall have an effect only if isSelectableSupported and isSelectable return true.- Specified by:
selectObjectin interfaceILcdLayer- Parameters:
aObject- theObjectto 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,trueto select,falseto 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 theILcdModelthisILcdLayerrefers to. This method shall have an effect only if isSelectableSupported and isSelectable return true.- Parameters:
aObjects- the collection ofObjects to select or deselect.aSelection- the selection state,trueto select,falseto deselect.aDispatchEventMode- shall be one amongILcdFireEventMode.FIRE_NOW,ILcdFireEventMode.FIRE_LATER,ILcdFireEventMode.NO_EVENT- See Also:
-
fireCollectedSelectionChanges
public void fireCollectedSelectionChanges()Description copied from interface:ILcdLayerFires aTLcdSelectionChangedEventthat contains all the selection changes appended by successively callingselectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER).- Specified by:
fireCollectedSelectionChangesin interfaceILcdLayer
-
clearSelection
public void clearSelection(int aDispatchEventMode) Description copied from interface:ILcdLayerDeselect all the Objects in thisILcdLayer, i.e., the selection of thisILcdLayeris empty afterward.- Specified by:
clearSelectionin interfaceILcdLayer- Parameters:
aDispatchEventMode- shall be one amongILcdFireEventMode.FIRE_NOW,ILcdFireEventMode.FIRE_LATER,ILcdFireEventMode.NO_EVENT- See Also:
-
addSelectionListener
Description copied from interface:ILcdSelectionAdds 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 aALcdWeakSelectionListenerinstance as selection listener.- Specified by:
addSelectionListenerin interfaceILcdSelection<Object>- Parameters:
aSelectionListener- theILcdSelectionListenerto be added.
-
removeSelectionListener
Description copied from interface:ILcdSelectionRemoves anILcdSelectionListenerfrom thisILcdSelection.- Specified by:
removeSelectionListenerin interfaceILcdSelection<Object>- Parameters:
aSelectionListener- theILcdSelectionListenerto be removed.
-
getIcon
Description copied from interface:ILcdLayerReturns 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:ILcdLayerSets a visual indication of the contents of this layer. -
toString
-