In most applications, you need to handle GUI input events. GUI input events are typically end user actions such as a click on one of the buttons in a toolbar. To define a GUI event, you typically use an ILcdAction. By using an ILcdAction, the functionality of a GUI component is separated from the effect it has on the application.

Take, for example, a button that has an ILcdAction associated to it. When the button is pressed by the user, the button calls its actionPerformed() method. The method actionPerformed has one argument that specifies the event (user interaction) invoked on the button. It is then the ILcdAction that defines the effect of this user interaction on the application. As you can see, the button has no direct effect on the application. It merely serves as a messenger that forwards user interaction to the application. The same behavior applies to a menu item in a menu bar.

What is an ILcdAction?

An ILcdAction is an extension of java.awt.event.ActionListener that applies the Command design pattern (objects are modeled as executable commands). It is very similar to the Swing javax.swing.Action interface. To create a Swing Action from a given ILcdAction you simply create an instance of TLcdSWAction, which is a Swing wrapper around an ILcdAction.

The interface ILcdAction applies the Listener pattern in collaboration with java.beans.PropertyChangeListener. A PropertyChangeListener accepts java.beans.PropertyChangedEvent objects from the ILcdAction on which it is registered. For more information on listening to changes, refer to Notifying objects of changes with listeners.

Available implementations of ILcdAction

Currently, LuciadLightspeed offers the following main ILcdAction implementations out of the box for Lightspeed views:

See the API reference information for more details.

For more information about implementing an ILcdAction, see Defining GUI actions.