public class IOPMenuItem
extends java.lang.Object
IOPTextMenu
Constructor and Description |
---|
IOPMenuItem(java.lang.String s)
Construct new menu item with text to display (must be non-null)
but no associated closure.
|
IOPMenuItem(java.lang.String s,
Closure c)
Construct new menu item with text to display (must be non-null)
and the associated closure (can be null).
|
IOPMenuItem(java.lang.String s,
Closure c,
char key)
Construct new menu item with text to display (must be non-null)
and the associated closure (can be null) and a given key as short cut.
|
Modifier and Type | Method and Description |
---|---|
boolean |
doAction(java.lang.Object source,
java.lang.Object event)
Execute associated action with this item if it is currently set.
|
boolean |
equals(java.lang.Object o) |
java.lang.Character |
getShortcut() |
int |
hashCode() |
void |
setAction(Closure c)
Set action associated with this menu item.
|
java.lang.String |
toString() |
public IOPMenuItem(java.lang.String s)
s
- Text to display for this menu itempublic IOPMenuItem(java.lang.String s, Closure c)
s
- Text to display for this menu itemc
- Closure to invoke when menu item gets activatedpublic IOPMenuItem(java.lang.String s, Closure c, char key)
s
- Text to display for this menu itemc
- Closure to invoke when menu item gets activatedkey
- Character to be used as short cutpublic java.lang.Character getShortcut()
public void setAction(Closure c)
c
- Closure to invoke when menu item gets activatedpublic boolean doAction(java.lang.Object source, java.lang.Object event)
source
- Object that is source of applied closureevent
- Object that is event to which closure reactspublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object