public class BogusEvent extends Object implements Copyable
Agent
.
Every BogusEvent encapsulates a Shortcut
which may be bound
to an user-defined action (see shortcut()
). Gesture initialization and
termination, which may be of the interest of Grabber
objects, are reported by fired()
and flushed()
, respectively.
The following are the main class specializations:
MotionEvent
, ClickEvent
, and
KeyboardEvent
. Please refer to their documentation for
details.
If you ever need to define you're own bogus-event type, derive from this class, declare
a shortcut type for your event (for details refer to the
Shortcut
), and override the shortcut()
and
get()
methods. If your custom event class defines it's own attributes, its
hashCode()
, equals(Object)
and get()
methods should be
overridden as well.
Note BogusEvent detection/reduction could happened in several different ways.
For instance, in the context of Java-based application, it typically takes place when
implementing a mouse listener interface. In Processing, it does it when registering at
the PApplet the so called mouseEvent and KeyEvent methods. Moreover, the
Agent.handleFeed()
provides a callback alternative when none
of these mechanisms are available (as it often happens when dealing with specialized,
non-default input hardware).
Modifier and Type | Field and Description |
---|---|
static int |
ALT |
static int |
ALT_GRAPH |
static int |
CTRL |
static int |
META |
static int |
NO_ID |
static int |
NO_MODIFIER_MASK |
static int |
SHIFT |
Constructor and Description |
---|
BogusEvent()
Constructs an event with an "empty"
Shortcut . |
BogusEvent(int modifiers,
int id)
Constructs an event taking the given
modifiers as a
Shortcut . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
BogusEvent |
fire()
Same as
this.get() but sets the fired() flag to true. |
boolean |
fired()
Returns true if this is a 'fired' event.
|
BogusEvent |
flush()
Same as
this.get() but sets the flushed() flag to true. |
boolean |
flushed()
Returns true if this is a 'flushed' event.
|
BogusEvent |
get()
Returns a deep copy of the object.
|
int |
hashCode() |
int |
id()
Returns the id defining the event's
Shortcut . |
boolean |
isAltDown() |
boolean |
isAltGraph() |
boolean |
isControlDown() |
boolean |
isMetaDown() |
boolean |
isNull()
Only
MotionEvent s may be null. |
boolean |
isShiftDown() |
int |
modifiers() |
static String |
modifiersText(int mask) |
Shortcut |
shortcut() |
long |
timestamp() |
public static final int NO_MODIFIER_MASK
public static final int NO_ID
public static final int SHIFT
public static final int CTRL
public static final int META
public static final int ALT
public static final int ALT_GRAPH
public BogusEvent()
Shortcut
.public BogusEvent(int modifiers, int id)
modifiers
as a
Shortcut
.public BogusEvent get()
Copyable
Typical implementation should simple look like: return new Object(this)
.
public BogusEvent flush()
this.get()
but sets the flushed()
flag to true. Only agents
may call this.flushed()
public BogusEvent fire()
this.get()
but sets the fired()
flag to true. Only agents
may call this.flushed()
public boolean flushed()
fired()
public boolean fired()
flushed()
public Shortcut shortcut()
Shortcut
public int modifiers()
Shortcut
.public int id()
Shortcut
.public long timestamp()
public boolean isNull()
MotionEvent
s may be null.public boolean isShiftDown()
public boolean isControlDown()
public boolean isMetaDown()
public boolean isAltDown()
public boolean isAltGraph()
public static String modifiersText(int mask)
mask
- of modifiersProcessing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia