com.guiseframework.event
Class ActionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.globalmentor.event.AbstractEvent
          extended by com.guiseframework.event.AbstractGuiseEvent
              extended by com.guiseframework.event.AbstractTargetedGuiseEvent
                  extended by com.guiseframework.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
static class ActionEvent.Command
          The commands that can be represented by an action.
 
Field Summary
static int DEFAULT_FORCE
          The default action force.
static int DEFAULT_OPTION
          The default action option.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ActionEvent(java.lang.Object source)
          Source constructor with a default force and option.
ActionEvent(java.lang.Object source, ActionEvent actionEvent)
          Copy constructor that specifies a different source.
ActionEvent(java.lang.Object source, int force, int option)
          Source, force, and option constructor.
ActionEvent(java.lang.Object source, java.lang.Object target, int force, int option)
          Source, target, force, and option constructor.
 
Method Summary
 ActionEvent.Command getCommand()
          Determines the conventional command represented by this action.
 int getForce()
          Returns the force with which the action was initiated.
 int getOption()
          Returns the option indicated by this action.
 
Methods inherited from class com.guiseframework.event.AbstractTargetedGuiseEvent
getTarget
 
Methods inherited from class com.guiseframework.event.AbstractGuiseEvent
getSession
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.globalmentor.event.Event
getSource
 

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 is null.

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 is null.
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 is null.
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 is null.
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.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.