|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractAction org.eodisp.ui.common.actions.EodispAction
public class EodispAction
An EodispAction extends the AbstractAction
to be used by
the EODiSP framework. It adds some functionality needed by the framework.
More specifically, it specifies if an EodispAction should be used in the menu
bar, in the tool bar, or in the context menu (or any combination of those).
It also has the functionality to add a target handler to the action. The
target handler is responsible to handle the
actionPerformed(ActionEvent)
event. Usually, this will be a
controller which takes the responsibility to react to an action.
Registering a controller as a target handler can be done through the use of
the delegation mechanism provided by the
EodispDelegate
class.
Field Summary | |
---|---|
static java.lang.String |
CTX_GROUP
This is the name of a context group. |
static java.lang.String |
CTX_GROUP_SUBMENU
This is the name of a dedicated sub-menu for a list of menu item. |
protected java.awt.event.ActionListener |
targetHandler
Holds the target handler which is responsible for handling the events (i.e. |
static java.lang.String |
USER_OBJECT
An additional user object. |
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 | |
---|---|
EodispAction()
|
Method Summary | ||
---|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
This distributes the event. |
|
java.lang.Class<? extends ActionSourceProvider> |
getActionSource()
Returns the action source for this action. |
|
int |
getMenuIndex()
Return the value of the index of this action. |
|
javax.swing.ImageIcon |
getToolBarIcon()
|
|
int |
getToolBarIndex()
|
|
java.lang.String |
getTopMenuItemName()
Returns the name of the parent menu as a string. |
|
boolean |
isAlwaysSelected()
|
|
boolean |
isCheckBox()
|
|
boolean |
isCheckBoxEnabled()
|
|
boolean |
isProcessed()
Return whether the action has already been processed. |
|
boolean |
isShowInContextMenu()
Returns whether or not this action should be showed as an entry in the context menu. |
|
boolean |
isShowInMenuBar()
Returns whether or not this action should be showed as an entry in the menu bar. |
|
boolean |
isShowInToolBar()
Returns whether or not this action should be showed as an entry in the tool bar. |
|
void |
registerTargetHandler(java.awt.event.ActionListener l)
Registers a target handler. |
|
|
setActionSource(java.lang.Class<T> actionSource)
Sets the action source for this action. |
|
void |
setAlwaysSelected(boolean isAlwaysSelected)
This can be set to indicate that an action cannot be disabled. |
|
void |
setCheckBox(boolean isCheckBox)
Sets the isCheckBox flag. |
|
void |
setCheckBoxEnabled(boolean checkBoxEnabled)
Toggles the initial state of a checkbox enabled action. |
|
void |
setMenuIndex(int menuIndex)
Changes the value of the index in the menu bar for this action. |
|
void |
setProcessed(boolean isProcessed)
Sets whether the action has been processed by the action manager. |
|
void |
setShowInContextMenu(boolean showInContextMenu)
Specifies whether this action should be showed as an entry in the menu bar. |
|
void |
setShowInMenuBar(boolean showInMenuBar)
Specifies whether this action should be showed as an entry in the menu bar. |
|
void |
setShowInToolBar(boolean showInToolBar)
Specifies whether this action should be showed as an entry in the tool bar. |
|
void |
setToolBarIcon(javax.swing.ImageIcon toolBarIcon)
|
|
void |
setToolBarIndex(int toolBarIndex)
|
|
void |
setTopMenuItemName(java.lang.String topMenuItemName)
Sets the name of the parent menu. |
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 |
Field Detail |
---|
public static final java.lang.String USER_OBJECT
public static final java.lang.String CTX_GROUP_SUBMENU
public static final java.lang.String CTX_GROUP
JMenu
that is separated by a JSeparator
.
The menu item will not be placed in a dedicated
sub-menu when using this value.
protected java.awt.event.ActionListener targetHandler
actionPerformed(ActionEvent)
. Such a target handler should be
an instance of the class EodispDelegate
.
Constructor Detail |
---|
public EodispAction()
Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
EodispActionRegistry
. The first is the preferred way, the second
the more natural way for dynamic actions. Also, the second approach
(distributing the event), is only available for dynamic actions.
public void registerTargetHandler(java.awt.event.ActionListener l)
EodispDelegate
. The target class in
this defined in this instance will be responsible to execute appropriate
code when an action is performed.
l
- The target handler which is responsible to handle the event.public boolean isShowInContextMenu()
public void setShowInContextMenu(boolean showInContextMenu)
showInContextMenu
- Used to set the visibility in the context menu.public boolean isShowInMenuBar()
public void setShowInMenuBar(boolean showInMenuBar)
The default value is true.
showInMenuBar
- Used to set the visibility in the menu bar.public boolean isShowInToolBar()
The default value is false.
public void setShowInToolBar(boolean showInToolBar)
Remember to specify an icon for the action if you set this to true.
The default value is false.
showInToolBar
- Used to set the visibility in the tool bar.public int getMenuIndex()
public void setMenuIndex(int menuIndex)
menuIndex
- public java.lang.String getTopMenuItemName()
public void setTopMenuItemName(java.lang.String topMenuItemName)
topMenuItemName
for
further explanation how the name can be constructed (especially for
sub-menus).
This is only useful if this action should be displayed in the menu bar.
topMenuItemName
- The name of the parent menu. If this action should be shown in
the menu bar, it will be a child item of the top menu bar.public boolean isCheckBox()
public void setCheckBox(boolean isCheckBox)
isCheckBox
- The enableCheckBox to set.public boolean isCheckBoxEnabled()
public void setCheckBoxEnabled(boolean checkBoxEnabled)
checkBoxEnabled
- The checkBoxEnabled to set. If true, the initial state of the
checkbox will be enabled, if false, the initial state of will
be disabled.public java.lang.Class<? extends ActionSourceProvider> getActionSource()
This information can be use to clear all actions defined for such a component. This can happen if the component is disposed or if the if it uses dynamic action entries.
actionSource
- The action source for this action.public <T extends ActionSourceProvider> void setActionSource(java.lang.Class<T> actionSource)
EodispView
or a EodispFrame
. It is the
component which is responsible for registering this action.
public boolean isProcessed()
public void setProcessed(boolean isProcessed)
isProcessed
- True, if the action has been processed.public boolean isAlwaysSelected()
public void setAlwaysSelected(boolean isAlwaysSelected)
isAlwaysSelected
- The isAlwaysSelected to set.public javax.swing.ImageIcon getToolBarIcon()
public void setToolBarIcon(javax.swing.ImageIcon toolBarIcon)
toolBarIcon
- The toolBarIcon to set.public int getToolBarIndex()
public void setToolBarIndex(int toolBarIndex)
toolBarIndex
- The toolBarIndex to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |