|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpt.ua.gboard.GBoardInputHandler
public abstract class GBoardInputHandler
This module implements input handling for GBoard.
An input handler class should inherit from this (abstract) class, call the constructor with the desired mask, and implement the run procedure. To activate input handler a pushInputHandler on the GBoard object is required.
invariant: validInputMask(mask())
This class follows DbC(tm) methodology. Where possible, contracts are implement with JML and native's Java assert.
Field Summary | |
---|---|
static int |
gboardClosingMask
|
static int |
keyEventType
|
static int |
keyPressedMask
|
static int |
keyReleasedMask
|
static int |
keyTypedMask
|
static int |
maxMaskValue
|
static int |
mouseClickedMask
|
static int |
mouseEventType
|
static int |
mousePressedMask
|
static int |
mouseReleasedMask
|
static int |
windowEventType
|
Constructor Summary | |
---|---|
GBoardInputHandler(int mask)
Constructs a new GBoardInputHandler accepting the events defined by the mask. |
Method Summary | |
---|---|
boolean |
activated(int event)
Is current input handler object activated by event? |
int |
mask()
The current mask value. |
abstract void |
run(GBoard board,
int line,
int column,
int layer,
int type,
int code,
Gelem gelem)
Procedure to be automatically executed by GBoard when
the input handler object is activated. |
void |
setMask(int mask)
Defines a new input mask. |
boolean |
validEventType(int type)
|
static boolean |
validInputMask(int mask)
Checks if input mask is valid. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int keyPressedMask
public static final int keyReleasedMask
public static final int keyTypedMask
public static final int mousePressedMask
public static final int mouseReleasedMask
public static final int mouseClickedMask
public static final int gboardClosingMask
public static final int maxMaskValue
public static final int keyEventType
public static final int mouseEventType
public static final int windowEventType
Constructor Detail |
---|
public GBoardInputHandler(int mask)
requires: validInputMask(mask)
ensures: mask() == mask
mask
- the desired maskMethod Detail |
---|
public static boolean validInputMask(int mask)
mask
- the mask
boolean
true if mask okpublic boolean validEventType(int type)
public int mask()
int
maskpublic void setMask(int mask)
requires: validInputMask(mask)
ensures: mask() == mask
mask
- the new maskpublic boolean activated(int event)
event
- the event mask value
boolean
true if activated, false otherwisepublic abstract void run(GBoard board, int line, int column, int layer, int type, int code, Gelem gelem)
GBoard
when
the input handler object is activated.
board
- GBoard objectline
- the line numbercolumn
- the column numberlayer
- the layer numbertype
- the event type (keyEventType or mouseEventType or windowEventType)code
- the event code (KeyEvent.getKeyCode() or MouseEvent.getButton() or WindowEvent.WINDOW_CLOSED)gelem
- object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |