public abstract class GeneiousAction extends AbstractAction
GeneiousActionOptions for details concerning the various attributes an
action may have.| Modifier and Type | Class and Description |
|---|---|
static class |
GeneiousAction.Divider
A subclass of GeneiousAction which is placed in a toolbar/menu as a divider.
|
static class |
GeneiousAction.SubMenu
A subclass of GeneiousAction which is placed in the menu as a submenu which opens to the right;
In the toolbar, it will appear as a drop-down menu that opens downwards.
|
static class |
GeneiousAction.ToggleAction
A subclass of GeneiousAction which is placed in a toolbar/menu as a toggle button or check box menu item.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DESC |
static String |
ICON |
static String |
NAME |
changeSupport, enabledACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON| Constructor and Description |
|---|
GeneiousAction(GeneiousAction internalAction)
Creates a GeneiousAction that wraps another action.
|
GeneiousAction(GeneiousActionOptions actionOptions)
Construct a GeneiousAction from GeneiousActionOptions.
|
GeneiousAction(String name) |
GeneiousAction(String name,
String description) |
GeneiousAction(String name,
String description,
Icons icons) |
GeneiousAction(String name,
String description,
Icons icons,
GeneiousActionOptions.Category category,
GeneiousActionOptions.MainMenu menu,
boolean isInPopupMenu,
boolean isInMainToolbar,
KeyStroke shortcut)
Deprecated.
Construct
GeneiousActionOptions first then use
constructor GeneiousAction(GeneiousActionOptions) instead. |
| Modifier and Type | Method and Description |
|---|---|
JComponent |
asMenuItem()
Create a JComponent for this action which can be added to a JMenu.
|
AbstractButton |
asToolbarButton()
Create an AbstractButton for this action which can be added to a Toolbar.
|
boolean |
equals(Object obj) |
static List<GeneiousAction> |
getActionsInMainMenuOrder(List<GeneiousAction> actions)
Get a sorted list of actions in the order determined by
GeneiousActionOptions.getMainMenuPosition()/alphabetically
for any actions with the same main menu position value. |
static List<GeneiousAction> |
getActionsInPopupMenuOrder(List<GeneiousAction> actions)
Get a sorted list of actions in the order determined by
GeneiousActionOptions.getPopupMenuPosition()/alphabetically
for any actions with the same popup menu position value. |
static List<GeneiousAction> |
getActionsInToolbarOrder(List<GeneiousAction> actions)
Get a sorted list of actions in the order determined by
GeneiousActionOptions.getMainToolbarPosition()/alphabetically
for any actions with the same toolbar position value. |
GeneiousActionOptions.Category |
getCategory() |
String |
getDescription() |
Icon |
getIcon16() |
Icon |
getIcon24() |
Icon |
getIcon32() |
String |
getIdentifier() |
GeneiousActionOptions.MainMenu |
getMainMenuLocation() |
String |
getName() |
GeneiousActionOptions |
getOptions() |
KeyStroke |
getShortcut() |
int |
hashCode() |
boolean |
isEnabled() |
boolean |
isInMainToolbar() |
boolean |
isInPopupMenu() |
boolean |
isProOnly() |
void |
setDescription(String description)
Set the description of the action.
|
void |
setEnabled(boolean newValue) |
void |
setIcons(Icons icons)
Set the icons of the action.
|
GeneiousAction |
setInMainToolbar(boolean isInMainToolbar)
Set the location of this actio in the main toolbar (with the default position of 0.5 - see
setInMainToolbar(boolean, double)). |
GeneiousAction |
setInMainToolbar(boolean isInMainToolbar,
double mainToolbarPosition)
Set the location of this action in the main toolbar.
|
GeneiousAction |
setInPopupMenu(boolean isInPopupMenu)
Set the location of this action in the popup menu (with the default position of 0.5 - see
setInPopupMenu(boolean, double)). |
GeneiousAction |
setInPopupMenu(boolean isInPopupMenu,
double popupMenuPosition)
Set the location of this action in the popup menu.
|
GeneiousAction |
setMainMenuLocation(GeneiousActionOptions.MainMenu menu)
Set the location of this action in the main menu (with the default position of 0.5 - see
setMainMenuLocation(com.biomatters.geneious.publicapi.plugin.GeneiousActionOptions.MainMenu, double)). |
GeneiousAction |
setMainMenuLocation(GeneiousActionOptions.MainMenu menu,
double mainMenuPosition)
Set the location of this action in the main menu.
|
void |
setName(String name)
Set the name of the action.
|
GeneiousAction |
setProOnly(boolean isProOnly)
Set whether this action requires an active license.
|
GeneiousAction |
setShortcutKey(KeyStroke shortcutKey)
Set the shortcutKey for this action (eg.
|
String |
toString() |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListenerfinalize, getClass, notify, notifyAll, wait, wait, waitactionPerformedpublic static final String NAME
public static final String ICON
public static final String DESC
public GeneiousAction(String name)
name - Name of the action to display in menu or toolbar, must not be nullpublic GeneiousAction(String name, String description)
name - Name of the action to display in menu or toolbar, must not be nulldescription - Description of the actions function, used as a tooltip, or null to have no descriptionpublic GeneiousAction(String name, String description, Icons icons)
name - Name of the action to display in menu or toolbar, must not be nulldescription - Description of the actions function, used as a tooltip, or null to have no descriptionicons - Icons to display in the toolbar and menu, or null for no icons@Deprecated public GeneiousAction(String name, String description, Icons icons, GeneiousActionOptions.Category category, GeneiousActionOptions.MainMenu menu, boolean isInPopupMenu, boolean isInMainToolbar, KeyStroke shortcut)
GeneiousActionOptions first then use
constructor GeneiousAction(GeneiousActionOptions) instead.name - Name of the action to display in menu or toolbar, must not be nulldescription - Description of the actions function, used as a tooltip, or null to have no descriptionicons - Icons to display in the toolbar and menu, or null for no iconscategory - Category that this action fits into, or GeneiousActionOptions.Category.None if
it doesn't fit a category, must not be null.menu - Main menu to place the action in, GeneiousActionOptions.MainMenu.NotPresent
to have the action in no menu (must not be null). Ignored for actions returned from an ActionProvider.isInPopupMenu - True to have the action placed in the popup menu. If this is a Service action, it will be placed
in the service popup menu, if this is a DocumentOperation action, it will be placed in the document table popup menu. Ignored
for actions returned from an ActionProvider.isInMainToolbar - True to have the action placed in the toolbar at the top of the main window. Ignored
for actions returned from an ActionProvider.shortcut - Keyboard shortcut for this actionpublic GeneiousAction(GeneiousActionOptions actionOptions)
actionOptions - GeneiousActionOptions that will determine the properties of this actionGeneiousActionOptionspublic GeneiousAction(GeneiousAction internalAction)
internalAction - the internal GeneiousAction that all methods are delegated to.public boolean isEnabled()
isEnabled in interface ActionisEnabled in class AbstractActionpublic void setEnabled(boolean newValue)
setEnabled in interface ActionsetEnabled in class AbstractActionpublic final String getName()
GeneiousActionOptions.getName()public final boolean isInPopupMenu()
GeneiousActionOptions.isInPopupMenupublic final GeneiousActionOptions.MainMenu getMainMenuLocation()
public final boolean isInMainToolbar()
public final Icon getIcon16()
public final Icon getIcon24()
public final Icon getIcon32()
public final GeneiousActionOptions getOptions()
public final String getDescription()
public final KeyStroke getShortcut()
public final GeneiousActionOptions.Category getCategory()
public final boolean isProOnly()
public final String getIdentifier()
public void setName(String name)
name - public void setIcons(Icons icons)
icons - public void setDescription(String description)
description - public GeneiousAction setMainMenuLocation(GeneiousActionOptions.MainMenu menu)
setMainMenuLocation(com.biomatters.geneious.publicapi.plugin.GeneiousActionOptions.MainMenu, double)).menu - Main menu to place the action in, GeneiousActionOptions.MainMenu.NotPresent
to have the action in no menu (must not be null). Ignored for actions returned from an ActionProvider.return new GeneiousAction(...).setMainMenuLocation(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setMainMenuLocation(GeneiousActionOptions.MainMenu menu, double mainMenuPosition)
menu - Main menu to place the action in, GeneiousActionOptions.MainMenu.NotPresent
to have the action in no menu (must not be null). Ignored for actions returned from an ActionProvider.mainMenuPosition - A relative position of the action in its menu. Should be between 0 and 1, where 0 is top-most and
1 is the bottom-most. 0.5 is the default. If multiple actions have the same position, they are ordered alphabetically.return new GeneiousAction(...).setMainmenuLocation(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setInMainToolbar(boolean isInMainToolbar)
setInMainToolbar(boolean, double)).isInMainToolbar - True to have the action placed in the toolbar at the top of the main window. Ignored
for actions returned from an ActionProvider.return new GeneiousAction(...).setInMainToolbar(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setInMainToolbar(boolean isInMainToolbar, double mainToolbarPosition)
isInMainToolbar - True to have the action placed in the toolbar at the top of the main window. Ignored
for actions returned from an ActionProvider.mainToolbarPosition - A relative position of the action in its toolbar. Should be between 0 and 1, where 0 is left-most and
1 is the right-most. 0.5 is the default. If multiple actions have the same position, they are ordered alphabetically.return new GeneiousAction(...).setInMainToolbar(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setInPopupMenu(boolean isInPopupMenu)
setInPopupMenu(boolean, double)).isInPopupMenu - True to have the action placed in the popup menu. If this is a Service action, it will be placed
in the service popup menu, if this is a DocumentOperation action, it will be placed in the document table popup menu. Ignored
for actions returned from an ActionProvider.return new GeneiousAction(...).setInPopupMenu(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setInPopupMenu(boolean isInPopupMenu, double popupMenuPosition)
ActionProvider.isInPopupMenu - True to have the action placed in the popup menu.popupMenuPosition - A relative position of the action in its menu. Should be between 0 and 1, where 0 is top-most and
1 is the bottom-most. 0.5 is the default. If multiple actions have the same position, they are ordered alphabetically.return new GeneiousAction(...).setInPopupMenu(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setShortcutKey(KeyStroke shortcutKey)
shortcutKey - KeyStroke for the shortcut keyreturn new GeneiousAction(...).setShortcutKey(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousAction setProOnly(boolean isProOnly)
isProOnly - whether this action requires an active licensereturn new GeneiousAction(...).setProOnly(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public JComponent asMenuItem()
asToolbarButton()
and vice-versa.public AbstractButton asToolbarButton()
asMenuItem()
and vice-versa.public static List<GeneiousAction> getActionsInMainMenuOrder(List<GeneiousAction> actions)
GeneiousActionOptions.getMainMenuPosition()/alphabetically
for any actions with the same main menu position value.actions - list of actions to sortpublic static List<GeneiousAction> getActionsInPopupMenuOrder(List<GeneiousAction> actions)
GeneiousActionOptions.getPopupMenuPosition()/alphabetically
for any actions with the same popup menu position value.actions - list of actions to sortpublic static List<GeneiousAction> getActionsInToolbarOrder(List<GeneiousAction> actions)
GeneiousActionOptions.getMainToolbarPosition()/alphabetically
for any actions with the same toolbar position value.actions - list of actions to sort