Class TLcdLayer

java.lang.Object
com.luciad.view.TLcdLayer
All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdSelection<Object>, ILcdLayer, Serializable
Direct Known Subclasses:
TLcdGXYLayer

public class TLcdLayer extends Object implements ILcdLayer
Default implementation of the ILcdLayer interface. It also allows setting a filter to limit the objects that the layer takes into account.
See Also:
  • 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

      public TLcdLayer(String aLabel)
      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

      public TLcdLayer(ILcdModel aModel, String aLabel)
      Creates a new, empty layer with the given label and model.
      Parameters:
      aModel - the model to represent
      aLabel - 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 is true 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 either 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.
      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.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
      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 interface ILcdPropertyChangeSource
      Parameters:
      aPropertyChangeListener - The listener to be notified
      See Also:
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
      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 interface ILcdPropertyChangeSource
      Parameters:
      aPropertyChangeListener - the listener that should no longer be notified of changes of this object's properties
      See Also:
    • firePropertyChangeEvent

      public void firePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent)
      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

      public ILcdModel getModel()
      Gets the ILcdModel currently associated to this ILcdLayer.
      Specified by:
      getModel in interface ILcdLayer
      Returns:
      the ILcdModel associated to this ILcdLayer
    • setModel

      public void setModel(ILcdModel aModel)
      Sets the ILcdModel to this ILcdLayer.
      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

      public ILcdFilter getFilter()
      Gets the current ILcdFilter that filter the Object on this ILcdLayer.
      Returns:
      the filter that accepts only those objects that should be taken into account.
      See Also:
    • setFilter

      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.

      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 interface ILcdLayer
      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.
      Specified by:
      isVisible in interface ILcdLayer
      Returns:
      true if the layer is visible, false otherwise.
      See Also:
    • isSelectableSupported

      public boolean isSelectableSupported()
      Returns true if this layer supports selecting objects, false otherwise.
      Specified by:
      isSelectableSupported in interface ILcdLayer
      Returns:
      true if this ILcdLayer supports the selectable property, false otherwise. I.e. if this ILcdLayer 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 is 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.

      Parameters:
      aSelectableSupported - true to allow making this layer's contents selectable, and false otherwise.
      Since:
      2017.0
    • setSelectable

      public void setSelectable(boolean aSelectable)
      Description copied from interface: ILcdLayer
      Sets the Selectable property of this ILcdLayer. Check isSelectableSupported to see if the layer supports selection.
      Specified by:
      setSelectable in interface ILcdLayer
      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 interface ILcdLayer
      Returns:
      true if the layer allows selection, false otherwise.
      See Also:
    • isEditableSupported

      public boolean isEditableSupported()
      Returns true if the layer supports editing its objects. This implementation always returns true. Override this method if editing behavior is restricted.
      Specified by:
      isEditableSupported in interface ILcdLayer
      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. Check isEditableSupported to see if the layer supports editing.
      Specified by:
      setEditable in interface ILcdLayer
      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 interface ILcdLayer
      Returns:
      true if this ILcdLayer is editable, false otherwise
      See Also:
    • getLabel

      public String getLabel()
      Gets the label of this ILcdLayer.
      Specified by:
      getLabel in interface ILcdLayer
      Returns:
      a short textual representation of this ILcdLayer
    • setLabel

      public void setLabel(String aLabel)
      Sets the label of this ILcdLayer.
      Specified by:
      setLabel in interface ILcdLayer
      Parameters:
      aLabel - the the textual representation to use for this ILcdLayer.
    • selectedObjects

      public Enumeration<Object> selectedObjects()
      Description copied from interface: ILcdSelection
      Returns the objects in this selection.
      Specified by:
      selectedObjects in interface ILcdSelection<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 interface ILcdSelection<Object>
      Returns:
      the number of objects in this ILcdSelection.
    • isSelected

      public boolean isSelected(Object aObject) throws IllegalArgumentException
      Description copied from interface: ILcdSelection
      Checks whether the given Object is currently in the set of selected objects.
      Specified by:
      isSelected in interface ILcdSelection<Object>
      Parameters:
      aObject - the Object to be checked.
      Returns:
      true if the Object is in this ILcdSelection, false otherwise.
      Throws:
      IllegalArgumentException
    • selectObject

      public void selectObject(Object aObject, boolean aSelection, int aDispatchEventMode)
      Changes the selection state of any element contained in the ILcdModel this ILcdLayer refers to. This method shall have an effect only if isSelectableSupported and isSelectable return true.
      Specified by:
      selectObject in interface ILcdLayer
      Parameters:
      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
      See Also:
    • selectObjects

      public 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. This method shall have an effect only if isSelectableSupported and isSelectable return true.
      Parameters:
      aObjects - the collection of Objects 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
      See Also:
    • fireCollectedSelectionChanges

      public void fireCollectedSelectionChanges()
      Description copied from interface: ILcdLayer
      Fires a TLcdSelectionChangedEvent that contains all the selection changes appended by successively calling selectObject(Object, boolean, ILcdFireEventMode.FIRE_LATER).
      Specified by:
      fireCollectedSelectionChanges in interface ILcdLayer
    • clearSelection

      public void clearSelection(int aDispatchEventMode)
      Description copied from interface: ILcdLayer
      Deselect all the Objects in this ILcdLayer, i.e., the selection of this ILcdLayer is empty afterward.
      Specified by:
      clearSelection in interface ILcdLayer
      Parameters:
      aDispatchEventMode - shall be one among ILcdFireEventMode.FIRE_NOW, ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT
      See Also:
    • addSelectionListener

      public void addSelectionListener(ILcdSelectionListener<Object> aSelectionListener)
      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 this ILcdSelection, you can use a ALcdWeakSelectionListener instance as selection listener.
      Specified by:
      addSelectionListener in interface ILcdSelection<Object>
      Parameters:
      aSelectionListener - the ILcdSelectionListener to be added.
    • removeSelectionListener

      public void removeSelectionListener(ILcdSelectionListener<Object> aSelectionListener)
      Description copied from interface: ILcdSelection
      Removes an ILcdSelectionListener from this ILcdSelection.
      Specified by:
      removeSelectionListener in interface ILcdSelection<Object>
      Parameters:
      aSelectionListener - the ILcdSelectionListener to be removed.
    • getIcon

      public ILcdIcon 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.
      Specified by:
      getIcon in interface ILcdLayer
      Returns:
      a visual indication of the contents of this layer.
    • setIcon

      public void setIcon(ILcdIcon aIcon)
      Description copied from interface: ILcdLayer
      Sets a visual indication of the contents of this layer.
      Specified by:
      setIcon in interface ILcdLayer
      Parameters:
      aIcon - a visual indication of the contents of this layer.
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object