Package adams.gui.flow.menu
Class AbstractFlowEditorMenuItem
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.gui.flow.menu.AbstractFlowEditorMenuItem
-
- All Implemented Interfaces:
LoggingSupporter,SizeOfHandler,Serializable,Comparable<AbstractFlowEditorMenuItem>
- Direct Known Subclasses:
ShowTriggers
public abstract class AbstractFlowEditorMenuItem extends LoggingObject implements Comparable<AbstractFlowEditorMenuItem>
Ancestor for additional menu items in the flow editor.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractBaseActionm_Actionthe underlying action.protected JMenuItemm_MenuItemthe underlying menuitem.protected FlowEditorPanelm_Ownerthe owner.protected JMenum_SubMenuthe underlying submenu.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFlowEditorMenuItem()Initializes the menu item.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(AbstractFlowEditorMenuItem o)Compares this object with the specified object for order.protected StringdetermineCaption(AbstractFlowEditorMenuItem item)Determines the caption of the menu item.booleanequals(Object o)Returns whether the two objects are the same.AbstractBaseActiongetAction()Returns the action to add to the flow editor menu.abstract StringgetMenu()Returns the name of the menu to list this item under.JMenuItemgetMenuItem()Returns the menuitem to add to the flow editor menu.static Class[]getMenuItems()Returns a list with classnames of menu items.FlowEditorPanelgetOwner()Returns the owner.JMenugetSubMenu()Returns the submenu to add to the flow editor menu.booleanhasAction()Returns whether the menu item is based on an action.booleanhasMenuItem()Returns whether the menu item is based on a menuitem.booleanhasSubMenu()Returns whether the menu item is based on a submenu.protected voidinitialize()Initializes the menu item.protected abstract AbstractBaseActionnewAction()Creates the action to use.protected JMenuItemnewMenuItem()Creates the menuitem to use.protected JMenunewSubMenu()Creates the submenu to use.voidsetOwner(FlowEditorPanel value)Sets the owning flow editor.abstract voidupdate()Updating the action/menuitem/submenu, based on the current status of the owner.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Owner
protected FlowEditorPanel m_Owner
the owner.
-
m_Action
protected AbstractBaseAction m_Action
the underlying action.
-
m_MenuItem
protected JMenuItem m_MenuItem
the underlying menuitem.
-
m_SubMenu
protected JMenu m_SubMenu
the underlying submenu.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the menu item.
-
hasAction
public boolean hasAction()
Returns whether the menu item is based on an action.
Default implementation returns true.- Returns:
- true if action-based
-
newAction
protected abstract AbstractBaseAction newAction()
Creates the action to use.- Returns:
- the action
-
getAction
public AbstractBaseAction getAction()
Returns the action to add to the flow editor menu.- Returns:
- the action to add
- See Also:
hasAction()
-
hasMenuItem
public boolean hasMenuItem()
Returns whether the menu item is based on a menuitem.
Default implementation returns false.- Returns:
- true if menuitem-based
-
newMenuItem
protected JMenuItem newMenuItem()
Creates the menuitem to use.
Default implementation returns null.- Returns:
- the menuitem
-
getMenuItem
public JMenuItem getMenuItem()
Returns the menuitem to add to the flow editor menu.- Returns:
- the menuitem to add
- See Also:
hasMenuItem()
-
hasSubMenu
public boolean hasSubMenu()
Returns whether the menu item is based on a submenu.
Default implementation returns false.- Returns:
- true if submenu-based
-
newSubMenu
protected JMenu newSubMenu()
Creates the submenu to use.
Default implementation returns null.- Returns:
- the submenu
-
getSubMenu
public JMenu getSubMenu()
Returns the submenu to add to the flow editor menu.- Returns:
- the submenu to add
- See Also:
hasSubMenu()
-
setOwner
public void setOwner(FlowEditorPanel value)
Sets the owning flow editor.- Parameters:
value- the owner
-
getOwner
public FlowEditorPanel getOwner()
Returns the owner.- Returns:
- the owner, null if none set
-
getMenu
public abstract String getMenu()
Returns the name of the menu to list this item under.- Returns:
- the name of the menu
- See Also:
FlowEditorPanel.MENU_FILE,FlowEditorPanel.MENU_EDIT,FlowEditorPanel.MENU_RUN,FlowEditorPanel.MENU_ACTIVE,FlowEditorPanel.MENU_VIEW,FlowEditorPanel.MENU_WINDOW,FlowEditorPanel.MENU_HELP
-
update
public abstract void update()
Updating the action/menuitem/submenu, based on the current status of the owner.
-
determineCaption
protected String determineCaption(AbstractFlowEditorMenuItem item)
Determines the caption of the menu item.- Parameters:
item- the item- Returns:
- the caption, empty string if unable to find one
-
compareTo
public int compareTo(AbstractFlowEditorMenuItem o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Uses the name of the menu item text for comparison.- Specified by:
compareToin interfaceComparable<AbstractFlowEditorMenuItem>- Parameters:
o- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
equals
public boolean equals(Object o)
Returns whether the two objects are the same.
Only compares the menu item text of the two objects.
-
getMenuItems
public static Class[] getMenuItems()
Returns a list with classnames of menu items.- Returns:
- the menu item classnames
-
-