Class ALcyFormatBar

java.lang.Object
com.luciad.lucy.gui.formatbar.ALcyFormatBar
All Implemented Interfaces:
ILcdPropertyChangeSource

public abstract class ALcyFormatBar extends Object implements ILcdPropertyChangeSource

(Swing) component that can be displayed to manipulate a layer of a given format. Manipulation can be anything. A typical use could be to have buttons to start drawing new domain objects into (the model of) the layer.

For an example use of these bars, please refer to the TLcyFormatBarAddOn.

  • Field Details

  • Constructor Details

    • ALcyFormatBar

      protected ALcyFormatBar()
      Creates a new format bar named "Toolbar"
  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener aListener)
      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:
      aListener - The listener to be notified
      See Also:
    • addPropertyChangeListener

      public void addPropertyChangeListener(String aProperty, PropertyChangeListener aListener)
      Adds the given listener to the list of listeners, so that it will receive notifications about changes in aProperty.
      Parameters:
      aProperty - The property to watch for changes.
      aListener - The listener to add.
    • removePropertyChangeListener

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

      public void removePropertyChangeListener(String aProperty, PropertyChangeListener aListener)
      Removes the given listener for the given property, so that it no longer receives those change events.
      Parameters:
      aProperty - The property to stop listening to.
      aListener - The listener to remove.
    • putValue

      public void putValue(String aKey, Object aValue)

      Sets one of this object's properties using the associated key. The keys are defined by the constants in the class, for example SMALL_ICON. Implementations of this interface can use these properties to show them in their user interface. For instance the icon set with the SMALL_ICON key could be shown in the tab of a tabbed pane.

      The type of the value is specified by the key. For instance, the key SMALL_ICON demands that the value is an ILcdIcon.

      If the value has changed, a PropertyChangeEvent is sent to listeners with aKey as the property name.

      Parameters:
      aKey - a String representing the key. This must not be null, but can otherwise be any String, ie. it is not restricted to being one of SMALL_ICON, SHORT_DESCRIPTION or LONG_DESCRIPTION.
      aValue - an Object value. This may be null.
      Since:
      2013.0
      See Also:
    • getValue

      public Object getValue(String aKey)
      Gets one of this object's properties using the associated key.
      Parameters:
      aKey - the String of the key for which you want to retrieve the value. This can be any String, ie. it is not restricted to being one of SMALL_ICON, SHORT_DESCRIPTION or LONG_DESCRIPTION.
      Returns:
      The Object value corresponding to aKey, or null if no value corresponding to aKey could be found. The type of this value is determined by the key. For instance, the SMALL_ICON key specifies that the returned value is an ILcdIcon.
      Since:
      2013.0
      See Also:
    • firePropertyChange

      protected void firePropertyChange(String aProperty, Object aOldValue, Object aNewValue)
      Fires the given event to the associated listeners.
      Parameters:
      aProperty - The property that was changed.
      aOldValue - The old value.
      aNewValue - The new value.
    • getLayer

      public ILcdLayer getLayer()
      Returns the associated layer.
      Returns:
      the associated layer.
    • setLayer

      public void setLayer(ILcdLayer aLayer)
      Sets the layer to the given layer. Invokes updateForLayer(com.luciad.view.ILcdLayer, com.luciad.view.ILcdLayer) so that sub-classes can update their representation for the new layer.
      Parameters:
      aLayer - The layer to manipulate. Can be null, which indicates a (temporary) de-initialization.
      Throws:
      IllegalArgumentException - If canSetLayer(com.luciad.view.ILcdLayer) returns false for the same layer.
    • updateForLayer

      protected abstract void updateForLayer(ILcdLayer aPreviousLayer, ILcdLayer aLayer)
      Called by setLayer(com.luciad.view.ILcdLayer) when a new layer is set.
      Parameters:
      aPreviousLayer - The previously set layer. Can be null. This parameter can for example be useful to remove listeners from it.
      aLayer - The new layer, to update this bar for. Can be null.
    • canSetLayer

      public abstract boolean canSetLayer(ILcdLayer aLayer)

      Returns true if the layer can be accepted, false otherwise.

      A typical implementation would verify that only the layers of its own format are accepted.

      Another implementation could be to only accept one specific layer instance, so that the ALcyFormatBar cannot be reused for other layer instances of the same type, which might simplify the implementation of this ALcyFormatBar.

      Parameters:
      aLayer - The layer to test.
      Returns:
      true if the layer can be accepted, false otherwise. null must be accepted as this indicates a (temporary) de-initialization.
    • getComponent

      public abstract Component getComponent()
      Returns the (Swing) component that can be displayed to the end-user.
      Returns:
      the (Swing) component that can be displayed to the end-user.