Package io.guise.framework.event
Class ActionEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.globalmentor.event.AbstractEvent
-
- io.guise.framework.event.AbstractGuiseEvent
-
- io.guise.framework.event.AbstractTargetedGuiseEvent
-
- io.guise.framework.event.ActionEvent
-
- All Implemented Interfaces:
com.globalmentor.event.Event
,com.globalmentor.event.TargetedEvent
,GuiseEvent
,java.io.Serializable
public class ActionEvent extends AbstractTargetedGuiseEvent
An event indicating an action should take place. The event target indicates the component that originally initiated the action.- Author:
- Garret Wilson
- See Also:
ActionListener
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ActionEvent.Command
The commands that can be represented by an action.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_FORCE
The default action force.static int
DEFAULT_OPTION
The default action option.
-
Constructor Summary
Constructors Constructor Description ActionEvent(java.lang.Object source)
Source constructor with a default force and option.ActionEvent(java.lang.Object source, int force, int option)
Source, force, and option constructor.ActionEvent(java.lang.Object source, ActionEvent actionEvent)
Copy constructor that specifies a different source.ActionEvent(java.lang.Object source, java.lang.Object target, int force, int option)
Source, target, force, and option constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActionEvent.Command
getCommand()
Determines the conventional command represented by this action.int
getForce()
int
getOption()
-
Methods inherited from class io.guise.framework.event.AbstractTargetedGuiseEvent
getTarget
-
Methods inherited from class io.guise.framework.event.AbstractGuiseEvent
getSession
-
-
-
-
Field Detail
-
DEFAULT_OPTION
public static final int DEFAULT_OPTION
The default action option.- See Also:
- Constant Field Values
-
DEFAULT_FORCE
public static final int DEFAULT_FORCE
The default action force.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActionEvent
public ActionEvent(java.lang.Object source)
Source constructor with a default force and option. The target will be set to be the same as the given source.- Parameters:
source
- The object on which the event initially occurred.- Throws:
java.lang.NullPointerException
- if the given source isnull
.
-
ActionEvent
public ActionEvent(java.lang.Object source, int force, int option)
Source, force, and option constructor. The target will be set to be the same as the given source.- Parameters:
source
- The object on which the event initially occurred.force
- The zero-based force, such as 0 for no force or 1 for a mouse single click.option
- The zero-based option, such as 0 for a mouse left button click or 1 for a mouse right button click.- Throws:
java.lang.NullPointerException
- if the given source and/or target isnull
.java.lang.IllegalArgumentException
- if the given force and/or option is negative.
-
ActionEvent
public ActionEvent(java.lang.Object source, java.lang.Object target, int force, int option)
Source, target, force, and option constructor.- Parameters:
source
- The object on which the event initially occurred.target
- The target of the event.force
- The zero-based force, such as 0 for no force or 1 for a mouse single click.option
- The zero-based option, such as 0 for a mouse left button click or 1 for a mouse right button click.- Throws:
java.lang.NullPointerException
- if the given source and/or target isnull
.java.lang.IllegalArgumentException
- if the given force and/or option is negative.
-
ActionEvent
public ActionEvent(java.lang.Object source, ActionEvent actionEvent)
Copy constructor that specifies a different source.- Parameters:
source
- The object on which the event initially occurred.actionEvent
- The event the properties of which will be copied.- Throws:
java.lang.NullPointerException
- if the given source and/or event isnull
.
-
-
Method Detail
-
getOption
public int getOption()
- Returns:
- The option indicated by this action. The option is zero-based and represents any alternate option indicated by the user. If the action was initiated by a mouse click, for instance, the left button traditionally will indicate the default option (0), while the right button will indicate a secondary option (1).
-
getForce
public int getForce()
- Returns:
- The force with which the action was initiated. A force of zero indicates no force. A mouse single click should generate a force of 1, while a double single click should generate a force of 2.
-
getCommand
public ActionEvent.Command getCommand()
Determines the conventional command represented by this action.- Returns:
- The conventional command represented by this action.
-
-