Interface MenuItem
-
- All Superinterfaces:
Comparable<MenuItem>
- All Known Implementing Classes:
AbstractMenuItem
,NavigationMenuItem
,OperationMenuItem
,SimpleMenuItem
public interface MenuItem extends Comparable<MenuItem>
Topology UI MenuItem API. This allows a fine grade control over each Menu Item, e.g. the order, label, etc.- Author:
- mvrueden
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addChildren(MenuItem menuItem)
Adds a children to the currentMenuItem
default int
compareTo(MenuItem other)
List<MenuItem>
getChildren()
TheMenuItem
s can be cascaded (allowing a tree).MenuCommand
getCommand()
Returns the command to execute if theMenuItem
is selected.String
getLabel()
The Label of the menu item.int
getOrder()
boolean
isCheckable()
Defines if the currentMenuItem
is a checkable item.boolean
isChecked(List<VertexRef> targets, OperationContext operationContext)
Defines if the currentMenuItem
is checked.boolean
isEnabled(List<VertexRef> targets, OperationContext operationContext)
Defines if the currentMenuItem
is enabled.boolean
isVisible(List<VertexRef> targets, OperationContext operationContext)
Defines if the currentMenuItem
is visible.void
setOrder(int order)
-
-
-
Method Detail
-
getLabel
String getLabel()
The Label of the menu item.- Returns:
- The label of the menu item.
-
isVisible
boolean isVisible(List<VertexRef> targets, OperationContext operationContext)
Defines if the currentMenuItem
is visible.- Parameters:
targets
- The current targets (e.g. the selection)operationContext
- The currentOperationContext
.- Returns:
- True if visible, false otherwise.
-
isEnabled
boolean isEnabled(List<VertexRef> targets, OperationContext operationContext)
Defines if the currentMenuItem
is enabled. IfisVisible(List, OperationContext)
returns false, this is never called.- Parameters:
targets
- The current targets (e.g. the selection)operationContext
- The currentOperationContext
.- Returns:
- True if enabled, false otherwise.
-
isChecked
boolean isChecked(List<VertexRef> targets, OperationContext operationContext)
Defines if the currentMenuItem
is checked. IfisCheckable()
returns false, this is never called.- Parameters:
targets
- The current targets (e.g. the selection)operationContext
- The currentOperationContext
.- Returns:
- True if it is checked, false otherwise.
-
setOrder
void setOrder(int order)
-
getOrder
int getOrder()
-
isCheckable
boolean isCheckable()
Defines if the currentMenuItem
is a checkable item.- Returns:
- true if checkable, false otherwise
- See Also:
MenuBar.MenuItem.isCheckable()
-
getChildren
List<MenuItem> getChildren()
TheMenuItem
s can be cascaded (allowing a tree).- Returns:
- the children, or an empty list if no children exits. Must not be null.
-
addChildren
void addChildren(MenuItem menuItem)
Adds a children to the currentMenuItem
- Parameters:
menuItem
- the child to add.
-
getCommand
MenuCommand getCommand()
Returns the command to execute if theMenuItem
is selected. Please Note, that it MUST return null ifgetChildren()
is NOT empty.- Returns:
- the command to execute if the
MenuItem
is selected, or null ifgetChildren()
is NOT empty.
-
compareTo
default int compareTo(MenuItem other)
- Specified by:
compareTo
in interfaceComparable<MenuItem>
-
-