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)
.
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
Modifier and Type | Method and Description |
---|---|
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 ). |
getValue, isEnabled, putValue, setEnabled
actionPerformed
addPropertyChangeListener, removePropertyChangeListener
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
).
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.return aDefaultComponent;
.TLcyAlwaysFitJToolBar.createToolBarPanel(java.awt.Component)