JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart
Class EventTrigger

java.lang.Object
  |
  +--com.klg.jclass.chart.EventTrigger
All Implemented Interfaces:
Serializable

public class EventTrigger
extends Object
implements Serializable

Class responsible for defining a mapping from a user event to a chart action. For example, EventTrigger can be used to map from a Shift+Left-mouse-button set of events to the rotate action.
Note: By default, all event triggers are mouse down-drag-up events (which occur as a single sequence of mouse events) -- the only elements that can vary are the modifiers.

See Also:
Serialized Form

Field Summary
protected  int action
           
static int CUSTOMIZE
           
static int DEPTH
           
static int EDIT
           
protected  int modifiers
           
static int NONE
           
static int PICK
           
static int ROTATE
           
static int TRANSLATE
           
protected static int USE_BUTTON1_ALWAYS
           
protected static int USE_BUTTON1_EXCEPT_META
           
protected static int USE_BUTTON1_NEVER
           
protected  int useButton1
           
static int ZOOM
           
 
Constructor Summary
EventTrigger(int mod, int act)
          A public constructor that creates a mapping from a series of modifiers to a chart action.
EventTrigger(int mod, int act, boolean ub1)
          A public constructor that creates a mapping from a series of modifiers to a chart action.
 
Method Summary
static int adjustModifier(int mod)
          Default adjust method.
static int adjustModifier(int mod, int useButton1)
          Adjusts the modifier as used by chart to be a real modifier akin to that used by Swing.
static int deAdjustModifier(int mod)
          Default de-adjust method.
static int deAdjustModifier(int mod, int useButton1)
          De-adjusts the modifier as used by Swing, adjusting it back to a modifier as used by chart.
 int getAction()
          Gets the value of the Action property for this EventTrigger instance.
 int getModifiers()
          Gets the value of the modifiers property for this EventTrigger instance.
 void setAction(int act)
          Sets the value of the action property for this EventTrigger instance.
 void setModifiers(int mod)
          Sets the value of the modifiers property for this EventTrigger instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_BUTTON1_ALWAYS

protected static final int USE_BUTTON1_ALWAYS
See Also:
Constant Field Values

USE_BUTTON1_EXCEPT_META

protected static final int USE_BUTTON1_EXCEPT_META
See Also:
Constant Field Values

USE_BUTTON1_NEVER

protected static final int USE_BUTTON1_NEVER
See Also:
Constant Field Values

useButton1

protected int useButton1

modifiers

protected int modifiers

action

protected int action

ROTATE

public static final int ROTATE
See Also:
Constant Field Values

ZOOM

public static final int ZOOM
See Also:
Constant Field Values

TRANSLATE

public static final int TRANSLATE
See Also:
Constant Field Values

EDIT

public static final int EDIT
See Also:
Constant Field Values

PICK

public static final int PICK
See Also:
Constant Field Values

DEPTH

public static final int DEPTH
See Also:
Constant Field Values

CUSTOMIZE

public static final int CUSTOMIZE
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values
Constructor Detail

EventTrigger

public EventTrigger(int mod,
                    int act)
A public constructor that creates a mapping from a series of modifiers to a chart action.

Parameters:
mod - Bitfield of modifiers from Event. Can include Event.SHIFT_MASK, Event.CTRL_MASK, Event.META_MASK, and Event.ALT_MASK. If META_MASK is not included (which is the same as the third mouse button 3 mask), it is assumed that the bitfield is intended to be applied to the button 1 (the left mouse button).
act - action enum; one of ROTATE, ZOOM, TRANSLATE, EDIT, PICK, DEPTH, or CUSTOMIZE

EventTrigger

public EventTrigger(int mod,
                    int act,
                    boolean ub1)
A public constructor that creates a mapping from a series of modifiers to a chart action.

Parameters:
mod - Bitfield of modifiers from Event. Can include Event.SHIFT_MASK, Event.CTRL_MASK, Event.META_MASK, and Event.ALT_MASK.
act - action enum; one of ROTATE, ZOOM, TRANSLATE, EDIT, PICK, DEPTH, or CUSTOMIZE
ub1 - if true, the bitfield will be adjusted to include mouse button 1 (the left mouse button); if false, the bitfield will stand as set
Method Detail

getModifiers

public int getModifiers()
Gets the value of the modifiers property for this EventTrigger instance. The modifiers property specifies the modifier keys that are pressed during mouse down-drag-up that trigger the action.

Returns:
Bitfields set using Event.ALT_MASK, Event.CTRL_MASK, Event.META_MASK, and Event.SHIFT_MASK

setModifiers

public void setModifiers(int mod)
Sets the value of the modifiers property for this EventTrigger instance. The modifiers property specifies the modifier keys that are pressed during mouse down-drag-up that trigger the action. If the constructor has specified to NOT assume that mouse button 1 is to be used, a modifier of Event.ALT_MASK can be used to specify the use of the middle mouse button for the trigger. If the constructor has specified to NOT assume mouse button 1 or if the default behaviour was specified, a modifier of Event.META_MASK can be used to specify the use of the right mouse button for the trigger. If the constructor has specified that mouse button 1 will always be used, any specified masks will be adjusted to include the button 1 mask.

Parameters:
mod - bit fields set using Event.ALT_MASK, Event.CTRL_MASK, Event.META_MASK, and Event.SHIFT_MASK
Throws:
IllegalArgumentException - If the modifier is not either 0, Event.SHIFT_MASK, Event.ALT_MASK, Event.META_MASK or Event.CTRL_MASK

getAction

public int getAction()
Gets the value of the Action property for this EventTrigger instance. The Action property determines what action will be performed when the specified AWT event occurs -- one of ROTATE, ZOOM, TRANSLATE, EDIT, PICK, DEPTH, or CUSTOMIZE.

Returns:
enum specifying chart action

adjustModifier

public static int adjustModifier(int mod)
Default adjust method. Calls main adjust method with default button 1 rules.

Parameters:
mod -
Returns:

adjustModifier

public static int adjustModifier(int mod,
                                 int useButton1)
Adjusts the modifier as used by chart to be a real modifier akin to that used by Swing. This might involve performing a bitwise "or" action on the modifier (usually the Shift, Alt, or Ctrl mask) with the Swing InputEvent.BUTTON1_MASK so that the correct combination -- the user clicking on the left mouse button accompanied by the appropriate key -- triggers the action. Whether this is done or not depends on the constructor used and whether the "use mouse button 1" boolean was set.

Parameters:
mod -
useButton1 -
Returns:

deAdjustModifier

public static int deAdjustModifier(int mod)
Default de-adjust method. Calls main de-adjust method with default button 1 rules.

Parameters:
mod -
Returns:

deAdjustModifier

public static int deAdjustModifier(int mod,
                                   int useButton1)
De-adjusts the modifier as used by Swing, adjusting it back to a modifier as used by chart. This generally involves removing the Swing InputEvent.BUTTON1_MASK. Whether this is done or not depends on the constructor used and whether the "use mouse button 1" boolean was set.

Parameters:
mod -
useButton1 -
Returns:

setAction

public void setAction(int act)
Sets the value of the action property for this EventTrigger instance. The action property determines what action will be performed when the specified AWT event occurs. One of ROTATE, EDIT, ZOOM, TRANSLATE, PICK, DEPTH, or CUSTOMIZE.

Parameters:
act - enum specifying chart action
Throws:
IllegalArgumentException - If the action is not one of ROTATE, ZOOM, TRANSLATE, EDIT, PICK, DEPTH, or CUSTOMIZE

Copyright © 2004 Quest Software Inc..
All rights reserved.