Action

open class Action(val command: Command, val lambda: (ActionEvent) -> Unit?)

An Action how a Command is implemented, i.e. the code that runs when a GUI element is pressed. One action is often shared by multiple GUI Nodes. For example, an 'Undo' button in a ToolBar can use the same Action as an 'Undo' menu item in a Menu.

The DRY principal (Don't Repeat Yourself).

In a 'traditional' application, DRY is achieved by calling an 'undo()' method from the onAction event of the Undo Button, and the Undo MenuItem. However, this means that when we build our scene graphs, we would need to reference the classes that perform the action, and in a large application, this gets messy.

Instead, we define the Actions completely separately from the Commands.

Each Action is part of the Actions class, and each Command is part of the Commands class.

Inheritors

Constructors

Link copied to clipboard
constructor(command: Command, lambda: (ActionEvent) -> Unit?)

Properties

Link copied to clipboard
Link copied to clipboard

Should this action consume the event, which prevents other event handlers firing?

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
open override fun toString(): String