|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.canvas.interactor.AbstractInteractor
diva.sketch.BasicInterpreter
diva.sketch.MultiStateInterpreter
public class MultiStateInterpreter
A MultiStateInterpreter inherits from BasicInterpreter. It implements a FSM (finite state machine) in order to keep track of mouse states, for example, whether or not the mouse has been hold down in place for a while (hold listeners), how many clicks have been registered so far (click listeners), or it's simply a drawing event (stroke listeners). Different listeners can be added to receive different notification from the interpreter. For instance, a click listener will be notified only when mouse clicks happen whereas a hold listener will be notified only when the mouse has been hold for a while.
Field Summary | |
---|---|
static int |
CLICK_TIMEOUT
The timeout for single/double/triple/.. |
static int |
HOLD_TIMEOUT
The timeout for the popup hold, in milliseconds. |
static int |
MIN_DRAG_DISTANCE
The distance beyond which a click becomes a drag. |
Fields inherited from class diva.sketch.BasicInterpreter |
---|
_controller, _curStroke, _curSymbol, _strokeBuffer |
Constructor Summary | |
---|---|
MultiStateInterpreter(SketchController c)
Create a BasicInterpreter which is used by the specified controller to interpret sketch input. |
Method Summary | |
---|---|
void |
addClickListener(Interactor l)
Add a listener of clicks. |
void |
addHoldListener(Interactor l)
Add a listener of hold invokations. |
void |
addStrokeListener(Interactor l)
Add a stroke listener that gets mouse-down, mouse-moved, and mouse-released events for drawing strokes. |
int |
getClickCount()
|
void |
mouseDragged(LayerEvent e)
Consume the event so it doesn't get passed down to the layer below. |
void |
mousePressed(LayerEvent e)
Consume the event so it doesn't get passed down to the * layer below. |
void |
mouseReleased(LayerEvent e)
Consume the event. |
void |
removeClickListener(Interactor l)
Removes a click listener that was added with addClickListener(). |
void |
removeHoldListener(Interactor l)
Removes a hold listener that was added with addHoldListener(). |
void |
removeStrokeListener(Interactor l)
Removes a stroke listener that was added with addStrokeListener(). |
void |
timeout()
Respond to the mouse released event. |
Methods inherited from class diva.sketch.BasicInterpreter |
---|
appendStroke, finishStroke, getController, getCurrentStroke, getCurrentSymbol, isMotionEnabled, mouseEntered, mouseExited, mouseMoved, removeCurrentSymbol, startStroke |
Methods inherited from class diva.canvas.interactor.AbstractInteractor |
---|
accept, getMouseFilter, isConsuming, isEnabled, mouseClicked, setConsuming, setEnabled, setMotionEnabled, setMouseFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MIN_DRAG_DISTANCE
public static final int HOLD_TIMEOUT
public static final int CLICK_TIMEOUT
Constructor Detail |
---|
public MultiStateInterpreter(SketchController c)
Method Detail |
---|
public void addClickListener(Interactor l)
public void addHoldListener(Interactor l)
public void addStrokeListener(Interactor l)
public int getClickCount()
public void mouseDragged(LayerEvent e)
mouseDragged
in interface LayerListener
mouseDragged
in class BasicInterpreter
public void mousePressed(LayerEvent e)
mousePressed
in interface LayerListener
mousePressed
in class BasicInterpreter
public void mouseReleased(LayerEvent e)
mouseReleased
in interface LayerListener
mouseReleased
in class BasicInterpreter
public void timeout()
public void removeClickListener(Interactor l)
#addClickListener(MouseListener)
public void removeHoldListener(Interactor l)
#addHoldListener(ActionListener)
public void removeStrokeListener(Interactor l)
#addStrokeListener(MouseInputListener)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |