public class Menu
extends java.lang.Object
GUIPanel
class as a text in the status window.Modifier and Type | Class and Description |
---|---|
protected class |
Menu.openSubMenuAction
Utility class used for adding submenus to a
Menu . |
Constructor and Description |
---|
Menu(GUIPanel gp,
java.lang.String s,
boolean persistent) |
Modifier and Type | Method and Description |
---|---|
void |
addAction(java.lang.String keystroke,
NamedGUIAction ga)
Schedule an action to be executed every time the user presses the key sequence,
expressed by the String provided.
|
void |
addSubMenu(java.lang.String keystroke,
Menu m)
Add a submenu to this
Menu , scheduling it to open whenever
the sequence of keys, indicated by the provided string is pressed. |
void |
close()
Close this menu.
|
NamedGUIAction |
getAction(java.lang.String s) |
GUIPanel |
getGUIPanel() |
java.lang.String |
getString()
Return the name of this
Menu to the string provided. |
Menu |
getSuperMenu() |
void |
handle(java.lang.String keystroke)
Run the
GUIAction , or open the respective Menu , based on the
sequence of keys, represented by the string provided. |
boolean |
isPersistent()
Whether this
Menu is persistent. |
void |
setGUIPanel(GUIPanel gp)
Set the
GUIPanel object, used to display this Menu . |
void |
setPersistent(boolean persistent)
Set whether or not should this
Menu be persistent |
void |
setSuperMenu(Menu superMenu)
Set the menu, which should be opened, when this one is closed.
|
void |
showMenu()
Display this
Menu in the statusWindow of the respective GUIPanel . |
void |
suggestClosing()
Close this
Menu if it is not persistent, do nothing otherwise. |
public Menu(GUIPanel gp, java.lang.String s, boolean persistent)
public void setGUIPanel(GUIPanel gp)
GUIPanel
object, used to display this Menu
.gp
- public NamedGUIAction getAction(java.lang.String s)
s
- the string to use when looking up the actionaddAction(java.lang.String, InstrumentationPlatformGUI.NamedGUIAction)
public void addAction(java.lang.String keystroke, NamedGUIAction ga)
KeySequence
methods
and the KeyProcessingUtils.createStringFromKeyEvent(javafx.scene.input.KeyEvent)
methods.keystroke
- the string expressing the key sequence which, when pressed, leads to
the given action being firedga
- KeyProcessingUtils.createStringFromKeyEvent(javafx.scene.input.KeyEvent)
public void addSubMenu(java.lang.String keystroke, Menu m)
Menu
, scheduling it to open whenever
the sequence of keys, indicated by the provided string is pressed.
This works by adding a new Menu.openSubMenuAction
to this Menu
.keystroke
- the string expressing the key sequence which, when pressed, leads to
the given submenu being openedm
- the submenupublic void setSuperMenu(Menu superMenu)
superMenu
- the menu, which should be opened, when this one is closed.public void showMenu()
Menu
in the statusWindow of the respective GUIPanel
.public void handle(java.lang.String keystroke)
GUIAction
, or open the respective Menu
, based on the
sequence of keys, represented by the string provided.keystroke
- the string representing the sequence of keys pressedaddAction(java.lang.String, InstrumentationPlatformGUI.NamedGUIAction)
public void suggestClosing()
Menu
if it is not persistent, do nothing otherwise.close()
,
setPersistent(boolean)
public void close()
Menu
instead, if such supermenu is persistent.
If not, also close it and continue recursively, closing supermenu of each Menu
, till the first persistent is reached.getSuperMenu()
public java.lang.String getString()
Menu
to the string provided.
This text is displayed when traversing the Menu system.Menu
to the string provided.public void setPersistent(boolean persistent)
Menu
be persistentpersistent
- isPersistent()
public boolean isPersistent()
Menu
is persistent. That is, whether it should close
automatically when one of the submenus closes or when one of the actions in this menu is executed.Menu
is persistent.public Menu getSuperMenu()