Package org.apache.juneau.console
Class ModelAction
java.lang.Object
org.apache.juneau.console.ModelAction
A click-triggered action on an element: an icon button that calls a handler.
Example:
ModelAction.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionSets the handler by name.handler(HandlerRef ref) Sets the handler.Sets the icon (a sprite name).id()Returns the action id.Sets the visible label.static ModelActionStarts an action.Sets the payload merged into the event payload.toMap()Serializes to the contract shape.Sets the tone.Sets the tooltip.
-
Method Details
-
of
Starts an action.- Parameters:
id- The action id, unique per element.- Returns:
- A new action.
- Throws:
IllegalArgumentException- If the id is malformed.
-
id
Returns the action id.- Returns:
- The id.
-
icon
Sets the icon (a sprite name).- Parameters:
v- The icon.- Returns:
- This object.
-
label
Sets the visible label.- Parameters:
v- The label.- Returns:
- This object.
-
tooltip
Sets the tooltip.- Parameters:
v- The tooltip.- Returns:
- This object.
-
tone
Sets the tone.- Parameters:
v- The tone.- Returns:
- This object.
-
handler
Sets the handler by name.- Parameters:
name- A registered handler name or a listed built-in (juneau.refresh).- Returns:
- This object.
- Throws:
IllegalArgumentException- If the name is malformed.
-
handler
Sets the handler.- Parameters:
ref- The handler reference.- Returns:
- This object.
-
payload
Sets the payload merged into the event payload.- Parameters:
v- The payload.- Returns:
- This object.
-
toMap
Serializes to the contract shape.- Returns:
- The map, with
"type":"handler". - Throws:
IllegalStateException- If no handler was set.
-