strokes.listeners
Class StrokeEvent

java.lang.Object
  extended by java.util.EventObject
      extended by fr.lri.swingstates.events.VirtualEvent
          extended by strokes.listeners.StrokeEvent
All Implemented Interfaces:
java.io.Serializable

public class StrokeEvent
extends fr.lri.swingstates.events.VirtualEvent

A stroke event.

Author:
Caroline Appert
See Also:
Serialized Form

Field Summary
static short SHORTCUT_RECOGNIZED
          The constant used for type field of events occurring when a stroke ends and has been recognized as a shortcut.
static short STROKE_BEGUN
          The constant used for type field of events occurring when a stroke begins.
static short STROKE_NON_RECOGNIZED
          The constant used for type field of events occurring when a stroke begins ends and has not been recognized..
static short STROKE_POINT_ADDED
          The constant used for type field of events occurring when a point is added to a stroke.
static short STROKE_RECOGNIZED
          The constant used for type field of events occurring when a stroke ends and has been recognized.
 
Constructor Summary
StrokeEvent(java.lang.Object source, java.awt.event.MouseEvent event, short type, fr.lri.swingstates.gestures.Gesture gesture)
          Builds a StrokeEvent.
StrokeEvent(java.lang.Object source, java.lang.String command, java.awt.event.MouseEvent event, short type, fr.lri.swingstates.gestures.Gesture gesture)
          Builds a StrokeEvent.
 
Method Summary
 java.lang.String getCommand()
           
 java.awt.event.MouseEvent getMouseEvent()
           
 java.awt.Point getPointInComponent(java.awt.Component component)
          Recturns the last point of the stroke that causes this stroke event in a component coordinate systems.
 fr.lri.swingstates.gestures.Gesture getStroke()
           
 fr.lri.swingstates.gestures.Gesture getStrokeInComponent(java.awt.Component component)
          Returns, the stroke of this stroke event as a gesture (i.e., a collection of points with their input time) in a component's coordinate system.
 short getType()
           
 void setStroke(fr.lri.swingstates.gestures.Gesture gesture)
           
 
Methods inherited from class fr.lri.swingstates.events.VirtualEvent
getMatchingTransitions, getNameEvent, setNameEvent, setSource
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STROKE_BEGUN

public static short STROKE_BEGUN
The constant used for type field of events occurring when a stroke begins.

See Also:
strokes.listeners

STROKE_POINT_ADDED

public static short STROKE_POINT_ADDED
The constant used for type field of events occurring when a point is added to a stroke.

See Also:
strokes.listeners

STROKE_RECOGNIZED

public static short STROKE_RECOGNIZED
The constant used for type field of events occurring when a stroke ends and has been recognized.

See Also:
strokes.listeners

SHORTCUT_RECOGNIZED

public static short SHORTCUT_RECOGNIZED
The constant used for type field of events occurring when a stroke ends and has been recognized as a shortcut.

See Also:
strokes.listeners

STROKE_NON_RECOGNIZED

public static short STROKE_NON_RECOGNIZED
The constant used for type field of events occurring when a stroke begins ends and has not been recognized..

See Also:
strokes.listeners
Constructor Detail

StrokeEvent

public StrokeEvent(java.lang.Object source,
                   java.lang.String command,
                   java.awt.event.MouseEvent event,
                   short type,
                   fr.lri.swingstates.gestures.Gesture gesture)
Builds a StrokeEvent.

Parameters:
source - The source of the event
command - The name of the command recognized for the stroke underlying this event
event - The mouse event that causes this stroke event
type - The event type: STROKE_BEGUN, STROKE_POINT_ADDED, STROKE_RECOGNIZED, SHORTCUT_RECOGNIZED or STROKE_NON_RECOGNIZED.
gesture - The gesture, i.e. the stroke points with their input time

StrokeEvent

public StrokeEvent(java.lang.Object source,
                   java.awt.event.MouseEvent event,
                   short type,
                   fr.lri.swingstates.gestures.Gesture gesture)
Builds a StrokeEvent.

Parameters:
source - The source of the event
event - The mouse event that causes this stroke event
type - The event type: STROKE_BEGUN, STROKE_POINT_ADDED, STROKE_RECOGNIZED, SHORTCUT_RECOGNIZED or STROKE_NON_RECOGNIZED.
gesture - The gesture, i.e. the stroke points with their input time
Method Detail

getMouseEvent

public java.awt.event.MouseEvent getMouseEvent()
Returns:
The mouse event that causes this stroke event

getPointInComponent

public java.awt.Point getPointInComponent(java.awt.Component component)
Recturns the last point of the stroke that causes this stroke event in a component coordinate systems.

Parameters:
component - The component
Returns:
The stroke's last point relative to component

getType

public short getType()
Returns:
The type of this event: STROKE_BEGUN, STROKE_POINT_ADDED, STROKE_RECOGNIZED, SHORTCUT_RECOGNIZED or STROKE_NON_RECOGNIZED.

getStroke

public fr.lri.swingstates.gestures.Gesture getStroke()
Returns:
The stroke of this stroke event as a gesture, i.e., a collection of points with their input time.

getStrokeInComponent

public fr.lri.swingstates.gestures.Gesture getStrokeInComponent(java.awt.Component component)
Returns, the stroke of this stroke event as a gesture (i.e., a collection of points with their input time) in a component's coordinate system.

Parameters:
component - The component
Returns:
The stroke relative to component

setStroke

public void setStroke(fr.lri.swingstates.gestures.Gesture gesture)

getCommand

public java.lang.String getCommand()
Returns:
The name of the recognized command for stroke events of type SHORTCUT_RECOGNIZED and STROKE_RECOGNIZED, null otherwise.