public class GeneiousActionOptions extends Object
DocumentOperation or SequenceAnnotationGenerator to indicate to
Geneious how to construct the menu item or button that the user clicks on to start the DocumentOperation or AnnotationGenerator.
DocumentViewers may also provide actions via DocumentViewer.getActionProvider()| Modifier and Type | Class and Description |
|---|---|
static class |
GeneiousActionOptions.Category
The category (if any) which this action fits into.
|
static class |
GeneiousActionOptions.MainMenu
All available menu locations.
|
static interface |
GeneiousActionOptions.ShortcutChangeListener
A listener that can be notified when the shortcut changes for a
GeneiousActionOptions |
| Modifier and Type | Field and Description |
|---|---|
static GeneiousActionOptions |
ALIGN_ASSEMBLE_MENU_ACTION_OPTIONS
ActionOptions for the Align/Assemble menu.
|
static double |
DEFAULT_POSITION
The default
menuPosition for GeneiousActionOptions. |
| Modifier | Constructor and Description |
|---|---|
protected |
GeneiousActionOptions(GeneiousActionOptions toCopy) |
|
GeneiousActionOptions(String name) |
|
GeneiousActionOptions(String name,
String description) |
|
GeneiousActionOptions(String name,
String description,
Icons icons) |
|
GeneiousActionOptions(String name,
String description,
Icons icons,
GeneiousActionOptions.Category category)
Constructor of GeneiousActionOptions for DocumentOperations that belong to a category (eg.
|
|
GeneiousActionOptions(String name,
String description,
Icons icons,
GeneiousActionOptions.Category category,
GeneiousActionOptions.MainMenu menu,
boolean isInPopupMenu,
boolean isInMainToolbar,
KeyStroke shortcut,
boolean isProOnly)
Deprecated.
Use other constructors in combination with setters instead
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addShortcutChangeListener(GeneiousActionOptions.ShortcutChangeListener shortcutChangeListener)
Add a listener which will be notified whenever
setOverrideShortcut(javax.swing.KeyStroke) is called on
a GeneiousActionOptions. |
GeneiousActionOptions |
addSubmenuDivider(double position)
Call this on parentOptions passed into
createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions)
to add a divider to the resulting sub menu. |
protected GeneiousActionOptions |
createCopy() |
static GeneiousActionOptions |
createSubmenuActionOptions(GeneiousActionOptions parentOptions,
GeneiousActionOptions childOptions)
Create options for an action which will appear in a submenu (if in a menu) or a popup button
(if in the toolbar).
|
GeneiousActionOptions.Category |
getCategory() |
KeyStroke |
getDefaultShortcut() |
String |
getDescription() |
Icon |
getIcon16() |
Icon |
getIcon24() |
Icon |
getIcon32() |
Icons |
getIcons() |
String |
getIdentifier()
This is used so Geneious can identify actions when their name is changed
It is simply a concatenation of name and description.
|
GeneiousActionOptions.MainMenu |
getMainMenuLocation() |
double |
getMainMenuPosition()
The position of the action in the main menu.
|
double |
getMainToolbarPosition()
The position of the action in the main toolbar.
|
String |
getName()
Human readable name for action
|
GeneiousActionOptions |
getParentOptions()
The options of the parent action which represents the submenu this action
should appear in.
|
double |
getPopupMenuPosition()
The position of the action in its popup menu.
|
KeyStroke |
getShortcut()
A keyboard shortcut for the action.
|
List<Double> |
getSubmenuDividerPositions()
List of positions for dividers if these are parentOptions passed to
createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions) |
String |
getToolbarName() |
boolean |
isAvailableToWorkflows() |
boolean |
isInMainToolbar() |
boolean |
isInPopupMenu() |
boolean |
isProOnly()
If true, this action will be always disabled when the user doesn't have an active license.
|
static void |
removeShortcutChangeListener(GeneiousActionOptions.ShortcutChangeListener shortcutChangeListener)
Remove a shortcut change listener
|
GeneiousActionOptions |
setAvailableToWorkflows(boolean availableToWorkflows)
Sets whether or not a DocumentOperation or AnnotationGenerator is available to workflows.
|
GeneiousActionOptions |
setInMainToolbar(boolean isInMainToolbar)
Set the location of these action options in the main toolbar (with the default position of 0.5 - see
setInMainToolbar(boolean, double)). |
GeneiousActionOptions |
setInMainToolbar(boolean isInMainToolbar,
double mainToolbarPosition)
Set the location of these action options in the main toolbar.
|
GeneiousActionOptions |
setInPopupMenu(boolean isInPopupMenu)
Set the location of these action options in the popup menu (with the default position of 0.5 - see
setInPopupMenu(boolean, double)). |
GeneiousActionOptions |
setInPopupMenu(boolean isInPopupMenu,
double popupMenuPosition)
Set the location of these action options in the popup menu.
|
GeneiousActionOptions |
setMainMenuLocation(GeneiousActionOptions.MainMenu menu)
Set the location of these action options in the main menu (with the default position of 0.5 - see
setMainMenuLocation(com.biomatters.geneious.publicapi.plugin.GeneiousActionOptions.MainMenu, double)). |
GeneiousActionOptions |
setMainMenuLocation(GeneiousActionOptions.MainMenu menu,
double mainMenuPosition)
Set the location of these action options in the main menu.
|
void |
setOverrideShortcut(KeyStroke keyStroke)
Set a shortcut keystroke to override the default.
|
GeneiousActionOptions |
setProOnly(boolean isProOnly)
Set whether this action requires an active license.
|
GeneiousActionOptions |
setShortcutKey(KeyStroke shortcutKey)
Set the shortcutKey for the action (eg.
|
GeneiousActionOptions |
setToolbarName(String toolbarName)
Set name to be used when this action is displayed in the main toolbar.
|
GeneiousActionOptions |
setToolbarPosition(double toolbarPosition)
Sets the relative position of these action options when they appear in a toolbar.
|
public static final double DEFAULT_POSITION
menuPosition for GeneiousActionOptions.public static final GeneiousActionOptions ALIGN_ASSEMBLE_MENU_ACTION_OPTIONS
createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions)
with this as the parent options to add an operation to the Align/Assemble menu.public GeneiousActionOptions(String name)
name - Name of the action to display in menu or toolbar.public GeneiousActionOptions(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 GeneiousActionOptions(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 iconspublic GeneiousActionOptions(String name, String description, Icons icons, GeneiousActionOptions.Category category)
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 operation fits in to, or GeneiousActionOptions.Category.None if
it doesn't fit a category, must not be null. This is only used if specifying the action options for a DocumentOperation.@Deprecated public GeneiousActionOptions(String name, String description, Icons icons, GeneiousActionOptions.Category category, GeneiousActionOptions.MainMenu menu, boolean isInPopupMenu, boolean isInMainToolbar, KeyStroke shortcut, boolean isProOnly)
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 actionisProOnly - whether this action requires an active license. If it is, then the action will be disabled automatically if the user
doesn't have an active license.protected GeneiousActionOptions(GeneiousActionOptions toCopy)
protected GeneiousActionOptions createCopy()
public GeneiousActionOptions 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 GeneiousActionOptions(...).setMainMenuLocation(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions 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 GeneiousActionOptions(...).setMainmenuLocation(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions setInMainToolbar(boolean isInMainToolbar)
setInMainToolbar(boolean, double)).isInMainToolbar - True to have the action made visible in the toolbar at the top of the main window by default
(if you pass in false, the operation can still be made visible in the toolbar by the user). Ignored
for actions returned from an ActionProvider.return new GeneiousActionOptions(...).setInMainToolbar(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions setInMainToolbar(boolean isInMainToolbar, double mainToolbarPosition)
isInMainToolbar - True to have the action mde visible in the toolbar at the top of the main window (if you
pass in false, the operation can still be made visible in the toolbar by the user). 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 GeneiousActionOptions(...).setInMainToolbar(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions setToolbarPosition(double toolbarPosition)
setInMainToolbar(boolean, double) instead to make them appear in the main toolbar.toolbarPosition - 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.public GeneiousActionOptions 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 GeneiousActionOptions(...).setInPopupMenu(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions 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 GeneiousActionOptions(...).setInPopupMenu(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions setShortcutKey(KeyStroke shortcutKey)
shortcutKey - KeyStroke for the shortcut keyreturn new GeneiousActionOptions(...).setShortcutKey(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public GeneiousActionOptions addSubmenuDivider(double position)
createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions)
to add a divider to the resulting sub menu. Can be called multiple times to add several dividers.
IMPORTANT: This will be ignored for any options other than parentOptions passed to createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions).position - position of the divider relative to other actions in the submenu. Compared to getPopupMenuPosition()
for the other actions to determine position.return new GeneiousActionOptions(...).addSubmenuDivider(...);)public List<Double> getSubmenuDividerPositions()
createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions)createSubmenuActionOptions(GeneiousActionOptions, GeneiousActionOptions)public GeneiousActionOptions setProOnly(boolean isProOnly)
isProOnly - whether this action requires an active licensereturn new GeneiousActionOptions(...).setProOnly(...);)IllegalStateException - if called after a get method has been called
(set methods must be called immediately after constructing the options)public static GeneiousActionOptions createSubmenuActionOptions(GeneiousActionOptions parentOptions, GeneiousActionOptions childOptions)
setInMainToolbar(boolean) and setMainMenuLocation(com.biomatters.geneious.publicapi.plugin.GeneiousActionOptions.MainMenu)
must not be called on the child options. These options will be obtained from the parent. However, the order of the actions
in the submenu will be determined by their popup menu position value (use setInPopupMenu(boolean, double) to set this.
eg. The BLAST actions in Geneious are created like this:
GeneiousActionOptions parent = new GeneiousActionOptions("BLAST this sequence", null, MenuLocation.Tools, true);
GeneiousActionOptions blastnOptions = new GeneiousActionOptions("blastn", "Searches NCBI blastn for this sequence", null);
GeneiousActionOptions blastpOptions = new GeneiousActionOptions("blastn", "Searches NCBI blastn for this sequence", null);
...
GeneiousActionOptions blastn = createSubmenuActionOptions(parent, blastnOptions);
GeneiousActionOptions blastp = createSubmenuActionOptions(parent, blastpOptions);
...
If this is being used to add a popup button to the toolbar you should consider using
setToolbarName(String) to set a shorter name and setIcons(Icons)
to give the button an icon with a popup triangle.
To add a divider to the submenu, call addSubmenuDivider(double) on the parent options.parentOptions - childOptions - public final GeneiousActionOptions.MainMenu getMainMenuLocation()
public final String getName()
public final boolean isInPopupMenu()
public final Icon getIcon32()
public final Icon getIcon24()
public final Icon getIcon16()
public final Icons getIcons()
public final boolean isInMainToolbar()
public final String getDescription()
public final KeyStroke getShortcut()
KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | InputEvent.SHIFT_MASK)do not use KeyEvent.CTRL_MASK! use Toolkit.getDefaultToolkit().getMenuShortcutKeyMask().
public final GeneiousActionOptions.Category getCategory()
public final boolean isProOnly()
public final String getIdentifier()
public final GeneiousActionOptions getParentOptions()
public String getToolbarName()
public double getMainMenuPosition()
public double getPopupMenuPosition()
public double getMainToolbarPosition()
public GeneiousActionOptions setToolbarName(String toolbarName)
toolbarName - The name to be used when this action is displayed in the main toolbar or null to use the normal name.onlyreturn new GeneiousActionOptions(...).setToolbarName(...);)public boolean isAvailableToWorkflows()
setAvailableToWorkflows(false)
is called. DocumentOperations and AnnotationGenerators not normally visible to users can be exposed from workflows only using
setAvailableToWorkflows(true)setAvailableToWorkflows(boolean)public GeneiousActionOptions setAvailableToWorkflows(boolean availableToWorkflows)
availableToWorkflows - true to make it available to workflowsreturn new GeneiousActionOptions(...).setAvailableToWorkflows(...);)isAvailableToWorkflows()public KeyStroke getDefaultShortcut()
getShortcut()public void setOverrideShortcut(KeyStroke keyStroke)
keyStroke - the new shortcut keystroke to use or null for no shortcut.public static void addShortcutChangeListener(GeneiousActionOptions.ShortcutChangeListener shortcutChangeListener)
setOverrideShortcut(javax.swing.KeyStroke) is called on
a GeneiousActionOptions. ie. The listener will be notified whenever the shortcut changes for an action.shortcutChangeListener - the listener to addpublic static void removeShortcutChangeListener(GeneiousActionOptions.ShortcutChangeListener shortcutChangeListener)
shortcutChangeListener - the listener to remove