Interface ILcyCustomizableRepresentationAction

All Superinterfaces:
ActionListener, EventListener, ILcdAction, ILcdPropertyChangeSource, Serializable
All Known Implementing Classes:
TLcyInterruptTaskAction

public interface ILcyCustomizableRepresentationAction extends ILcdAction

Extension of ILcdAction that allows to customize the component that represents it (typically a JButton). Implementations of ILcyActionBar (e.g. TLcyToolBar) will call the customizeRepresentation method to provide a hook for the action to modify its component. One could for example want to add a DropTargetListener or a MouseListener that listens for a double click on the component. It is also possible to completely replace the component with a custom one.

General components don't always play nice when added to a Swing JToolBar, see also TLcyAlwaysFitJToolBar.createToolBarPanel(java.awt.Component).

  • Method Details

    • customizeRepresentation

      Component customizeRepresentation(Component aDefaultComponent, ILcdAction aWrapperAction, ILcyActionBar aActionBar)

      Allows to customize or replace the default component that is used to represent this ILcdAction (typically a JButton).

      Parameters:
      aDefaultComponent - The component that normally represents this action.
      aWrapperAction - In case this action is wrapped (for example when using (TLcyActionBarUtil), this parameter is the wrapper action, if not, it is this action. This is useful to retrieve properties such as the name or the icon of the action which can be different for different wrapper instances. E.g., a tool bar might use a different icon as a menu bar. And if the action is customized for the tool bar, it might be required to retrieve the tool bar icon.
      aActionBar - The action bar in which this action is going to be inserted, provided as contextual information.
      Returns:
      A customized or new component to represent this action. The simplest (but not useful) implementation of this method would be return aDefaultComponent;.
      See Also: