Package com.tagtraum.core.app
Class ApplicationAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.tagtraum.core.app.ApplicationAction
-
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
- Direct Known Subclasses:
ApplicationAction.ApplicationActionFacade
,BaseAction
public abstract class ApplicationAction extends AbstractAction
Application action.- Author:
- Hendrik Schreiber
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ApplicationAction.ApplicationActionFacade
Facade that suppresses certain action properties so that the action that may have rich icons etc can also be used in other contexts.
-
Field Summary
Fields Modifier and Type Field Description static String
BUTTON_MODEL
Shared button model.static String
DISABLED_ICON
Icon to show as disabled button.static String
DISABLED_SELECTED_ICON
Icon to show as disabled, but selected (e.g.static String
PRESSED_ICON
Icon to show as 'pressed' in a button.static String
ROLLOVER_ICON
Icon to show as rollover effect in a button.static String
SELECTED_ICON
Icon to show as selected in a button.static String
SHORT_NAME
Short name (i.e.-
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
-
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ApplicationAction()
protected
ApplicationAction(boolean createFacades)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ActionLocation[]
getActionLocations()
Specifies where in the UI this action should be installed.ButtonModel
getButtonModel()
ApplicationAction
getIconButtonFacade()
abstract String
getId()
Returns a unique id for this action.ApplicationAction
getMenuFacade()
ApplicationAction
getToolbarButtonFacade()
boolean
isVisible()
Indicates whether this action should be shown in a UI at all.void
register(AbstractButton button)
Registers this action with a button in order to set the correct icons and model.void
setButtonModel(ButtonModel buttonModel)
void
setVisible(boolean visible)
Sets visibility.-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
-
-
-
-
Field Detail
-
SHORT_NAME
public static final String SHORT_NAME
Short name (i.e. shorter thanAction.NAME
) to show.- See Also:
- Constant Field Values
-
ROLLOVER_ICON
public static final String ROLLOVER_ICON
Icon to show as rollover effect in a button.- See Also:
- Constant Field Values
-
PRESSED_ICON
public static final String PRESSED_ICON
Icon to show as 'pressed' in a button.- See Also:
- Constant Field Values
-
SELECTED_ICON
public static final String SELECTED_ICON
Icon to show as selected in a button.- See Also:
- Constant Field Values
-
DISABLED_ICON
public static final String DISABLED_ICON
Icon to show as disabled button.- See Also:
- Constant Field Values
-
DISABLED_SELECTED_ICON
public static final String DISABLED_SELECTED_ICON
Icon to show as disabled, but selected (e.g. as toggle) button.- See Also:
- Constant Field Values
-
BUTTON_MODEL
public static final String BUTTON_MODEL
Shared button model.- See Also:
- Constant Field Values
-
-
Method Detail
-
getButtonModel
public ButtonModel getButtonModel()
-
setButtonModel
public void setButtonModel(ButtonModel buttonModel)
-
getId
public abstract String getId()
Returns a unique id for this action. Typically follows thex.y.z
notation from general to specific.- Returns:
- unique id for this action
-
isVisible
public boolean isVisible()
Indicates whether this action should be shown in a UI at all.- Returns:
- true or false
-
setVisible
public void setVisible(boolean visible)
Sets visibility.- Parameters:
visible
- true or false- See Also:
isVisible()
-
register
public void register(AbstractButton button)
Registers this action with a button in order to set the correct icons and model.- Parameters:
button
- button- See Also:
ROLLOVER_ICON
,PRESSED_ICON
,SELECTED_ICON
,DISABLED_ICON
,DISABLED_SELECTED_ICON
-
getMenuFacade
public ApplicationAction getMenuFacade()
-
getIconButtonFacade
public ApplicationAction getIconButtonFacade()
-
getToolbarButtonFacade
public ApplicationAction getToolbarButtonFacade()
-
getActionLocations
public ActionLocation[] getActionLocations()
Specifies where in the UI this action should be installed.- Returns:
- installation locations for this action - the default is an empty array
-
-