Interface ILcdAction

All Superinterfaces:
ActionListener, EventListener, ILcdPropertyChangeSource, Serializable
All Known Subinterfaces:
ILcyCustomizableRepresentationAction
All Known Implementing Classes:
ALcdAction, ALcdActionWrapper, ALcdKML22ViewFitAction, ALcdObjectSelectionAction, ALcyCreateLayersAction, ALcyObjectSelectionAction, TLcdBeanEditAction, TLcdBeanPropertyEditAction, TLcdDeleteSelectionAction, TLcdExitAction, TLcdFitGXYLayerInViewClipAction, TLcdFitSelectionInViewClipAction, TLcdGXYSetControllerAction, TLcdGXYViewFitAction, TLcdGXYViewPanAction, TLcdGXYViewZoomAction, TLcdKML22GXYViewFitAction, TLcdMoveLayerAction, TLcdNoopAction, TLcdOpenAction, TLcdPrintComponentAction, TLcdRedoAction, TLcdRemoveLayerAction, TLcdSaveAction, TLcdSaveGXYViewAsGIFAction, TLcdSetProjectionAction, TLcdUndoAction, TLcdUpdateTerrainModelAction, TLcyCreateGXYLayerAction, TLcyInterruptTaskAction, TLcyLspCreateLayerAction, TLcyStartNewMapComponentAction, TLspKML22ViewFitAction, TLspSetControllerAction

public interface ILcdAction extends ActionListener, Serializable, ILcdPropertyChangeSource
This interface defines a command pattern The pattern is used for implementing actions launched from the GUI. See Gamma et al.

An ILcdAction has a set of key-value pairs associated. These key-value pairs can be used to build up dynamically a set of properties of the action.

An ILcdAction can be associated to zero or more Invokers.

An ILcdAction is listenable by PropertyChangeListeners (from java.beans). (refer to existing pattern?)

The class also provides constants that can be used as the storage-retrieval key when setting or getting one of this object's properties (text or icon).

  • Field Details

    • DEFAULT

      static final String DEFAULT
      Useful constants that can be used as the storage-retrieval key when setting or getting one of this object's properties (text or icon).
      See Also:
    • NAME

      static final String NAME
      Constant key for Name property. Its associated value should be of type String.
      See Also:
    • SHORT_DESCRIPTION

      static final String SHORT_DESCRIPTION
      Constant key for ShortDescription property. Its associated value should be of type String.
      See Also:
    • LONG_DESCRIPTION

      static final String LONG_DESCRIPTION
      Constant key for LongDescription property. Its associated value should be of type String.
      See Also:
    • SMALL_ICON

      static final String SMALL_ICON
      Constant key for SmallIcon property. Its associated value should be of type ILcdIcon.
      See Also:
    • VISIBLE

      static final String VISIBLE

      Constant key for the Visible property. Its associated value should be of type Boolean.

      Note that this key is not automatically recognized by Swing. For example, when creating a visual representation for an ILcdAction changing the associated value of this key will not affect the Swing component:

      
         ILcdAction action = ...
         JButton button = new JButton( new TLcdSWAction( action ) );
         action.putValue( ILcdAction.VISIBLE, false );//by default this will not change
         //the visibility of button
       

      In Lucy, the ALcyActionBar and its extension do respect this property and adjust the visibility of the component representing the ILcdAction. A possible use-case for this property is to create context-sensitive pop-up menu items.

      See Also:
    • SHOW_ACTION_NAME

      static final String SHOW_ACTION_NAME

      Defines if the action would preferably show or hide its action name to the end user. The value is of type Boolean.

      Note that this key is not automatically recognized by Swing. For example, when creating a visual representation for an ILcdAction changing the associated value of this key will not affect the Swing component (see also VISIBLE).

      In Lucy, the TLcyToolBar respects this property. This allows for some actions to show both their icon and text on a tool bar, and for others to only show their icon. TLcyMenuBar for example ignores this property, and always displays the action name and icon.

      The default value depends on the particular tool bar implementation. TLcyToolBar by default hides all action names, so only displays the icons.

      See Also:
    • SELECTED_KEY

      static final String SELECTED_KEY
      The key used for storing a Boolean that corresponds to the selected state. This is typically used for components with a meaningful selection state, such as a toggle button.

      This property differs from the others in that it is both read by the component and set by the component. For example, TLcdGXYSetControllerAction automatically updates the value based on whether its controller is active or not.

      When developing toggle actions in Lucy, use ALcyActiveSettable instead of ILcdAction.

      See Also:
  • Method Details

    • getValue

      Object getValue(String key)
      Returns one of this object's properties using the associated key. If the value has changed, a PropertyChangeEvent will be sent to listeners.
    • putValue

      void putValue(String key, Object value)
      Sets one of this objects properties.
      Parameters:
      key - one of NAME, SHORT_DESCRIPTION, LONG_DESCRIPTION, SMALL_ICON.
      value - the value to be used for this action to display it textually using the name, short description or long description or to display it graphically using the icon. Values for NAME, SHORT_DESCRIPTION and LONG_DESCRIPTION should be String objects, values for SMALL_ICON should be ILcdIcon implementations.
    • setEnabled

      void setEnabled(boolean b)
      Sets/tests the enabled state of the ILcdAction. When enabled, any component associated with this object is active and able to fire this object's actionPerformed method.
    • isEnabled

      boolean isEnabled()