Class GeneiousAction.SubMenu
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.biomatters.geneious.publicapi.plugin.GeneiousAction
-
- com.biomatters.geneious.publicapi.plugin.GeneiousAction.SubMenu
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
- Enclosing class:
- GeneiousAction
public static class GeneiousAction.SubMenu extends GeneiousAction
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.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.biomatters.geneious.publicapi.plugin.GeneiousAction
GeneiousAction.Divider, GeneiousAction.SubMenu, GeneiousAction.ToggleAction
-
-
Field Summary
-
Fields inherited from class com.biomatters.geneious.publicapi.plugin.GeneiousAction
DESC, ICON, NAME
-
-
Constructor Summary
Constructors Constructor Description SubMenu(GeneiousActionOptions actionOptions, java.util.List<GeneiousAction> subMenuActions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
void
addSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener listener)
Add a simple listener to this action which will be fired when the actions in the submenu/popup-menu are changed.protected javax.swing.JPopupMenu
constructPopupMenu()
This method can be overridden to show a custom JPopupMenu but it is not recommended.javax.swing.JPopupMenu
doPopup(javax.swing.JButton button, int x, int y)
Show the popup represented by this submenu at a specified location relative to the button source.Icons
getPopupIcons()
Get the icons which should be used for this action when it is displayed as a toolbar button.java.util.List<GeneiousAction>
getSubMenuActions()
Get the actions that appear in the submenu/popup-menu, in the same order they will appear in the menu.void
removeSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener listener)
Remove a SubMenuActionsChangedListenervoid
setPopupIcons(Icons popupIcons)
Set the icons which should be used for this action when it is displayed as a toolbar button.void
setSubMenuActions(java.util.List<GeneiousAction> subMenuActions)
Set the list of actions which will appear in the submenu/popup-menu.-
Methods inherited from class com.biomatters.geneious.publicapi.plugin.GeneiousAction
asMenuItem, asToolbarButton, equals, getActionsInMainMenuOrder, getActionsInPopupMenuOrder, getActionsInToolbarOrder, getCategory, getDescription, getIcon16, getIcon24, getIcon32, getIdentifier, getKeys, getMainMenuLocation, getMainMenuLocations, getName, getOptions, getShortcut, getValue, hashCode, isEnabled, isInMainToolbar, isInPopupMenu, isProOnly, isSearchable, setDescription, setEnabled, setIcons, setInMainToolbar, setInMainToolbar, setInPopupMenu, setInPopupMenu, setMainMenuLocation, setMainMenuLocation, setMainMenuLocations, setName, setProOnly, setSearchable, setShortcutKey, toString
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getPropertyChangeListeners, putValue, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
SubMenu
public SubMenu(GeneiousActionOptions actionOptions, java.util.List<GeneiousAction> subMenuActions)
- Parameters:
actionOptions
- GeneiousActionOptions that will determine the properties of the actionsubMenuActions
- List of GeneiousActions that will appear in the submenu/popup-menu. Actions will appear in the menu in the same order as they are in this list.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
-
getSubMenuActions
public java.util.List<GeneiousAction> getSubMenuActions()
Get the actions that appear in the submenu/popup-menu, in the same order they will appear in the menu.- Returns:
- the actions that appear in the submenu/popup-menu, in the same order they will appear in the menu.
-
doPopup
public javax.swing.JPopupMenu doPopup(javax.swing.JButton button, int x, int y)
Show the popup represented by this submenu at a specified location relative to the button source. This is automatically called wheneverGeneiousAction.asToolbarButton()
is clicked., but this method may be useful if the popup needs to be shown at a custom location.- Parameters:
button
- The button that triggered the popup.x
- Popup top-left x position relative to the button.y
- Popup top-left y position relative to the button.- Returns:
- The popup.
- Since:
- API 4.202200 (Geneious 2022.0.0)
-
constructPopupMenu
protected javax.swing.JPopupMenu constructPopupMenu()
This method can be overridden to show a custom JPopupMenu but it is not recommended. It is preferred that instead you create a list of actions you want shown by this submenu and pass them in via the constructor.- Returns:
- The JPopupMenu shown when this submenu is clicked.
- Since:
- API 4.202110 (Geneious 2021.1.0)
-
getPopupIcons
public Icons getPopupIcons()
Get the icons which should be used for this action when it is displayed as a toolbar button. This is usually the same as the Icons specified by the GeneiousActionOptions except with a small black triangle pointing down.- Returns:
- icons which should be used for this action when it is displayed as a toolbar button.
-
setPopupIcons
public void setPopupIcons(Icons popupIcons)
Set the icons which should be used for this action when it is displayed as a toolbar button.- Parameters:
popupIcons
- Icons which should be used for this action when it is displayed as a toolbar button.
-
setSubMenuActions
public void setSubMenuActions(java.util.List<GeneiousAction> subMenuActions)
Set the list of actions which will appear in the submenu/popup-menu. They will appear in the same order as they are in the list.- Parameters:
subMenuActions
- the list of actions which will appear in the submenu/popup-menu.
-
addSubMenuActionsChangedListener
public void addSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener listener)
Add a simple listener to this action which will be fired when the actions in the submenu/popup-menu are changed.- Parameters:
listener
- SimpleListener which will be fired when the actions in the submenu/popup-menu are changed.- See Also:
removeSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener)
-
removeSubMenuActionsChangedListener
public void removeSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener listener)
Remove a SubMenuActionsChangedListener- Parameters:
listener
- to remove from the action.- See Also:
addSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener)
-
-