public final class TLcdAWTEventFilterBuilder extends Object
A builder to create AWTEvent
filters. Event filters can be useful when constructing
controller chains (see ALspController.setAWTFilter(ILcdFilter)
).
Filters can be combined using the operators
and()
and or()
. By using openBrackets()
and closeBrackets()
it is possible to control which operators will be evaluated first. Operators between brackets
will be evaluated before any others, otherwise and
will be evaluated before
or
. For instance the following statement:
TLcdAWTEventFilterBuilder
.newBuilder()
.openBrackets().leftMouseButton().or().rightMouseButton().closeBrackets()
.and()
.altFilter(true)
.build();
will return a filter that will let both left or right mouse button events pass, but only if
alt is down too. Without the brackets, left mouse button events would
always pass but right mouse button events only when alt is down.
The JavaFX equivalent of this class is TLcdFXEventFilterBuilder
.
Modifier and Type | Method and Description |
---|---|
TLcdAWTEventFilterBuilder |
altFilter(boolean aAltDown)
Adds a alt down InputEvent filter.
|
TLcdAWTEventFilterBuilder |
and()
Operator to be called between two filter calls to indicate the event must pass both filters.
|
ILcdFilter<AWTEvent> |
build()
Builds the filter.
|
TLcdAWTEventFilterBuilder |
closeBrackets()
Ends a new subfilter, all filters and operators called between this call and the previous call to
openBrackets will be evaluated together before operators and filters
outside the brackets are evaluated. |
TLcdAWTEventFilterBuilder |
ctrlFilter(boolean aCtrlDown)
Adds a ctrl (cmd on macOS) down InputEvent filter.
|
TLcdAWTEventFilterBuilder |
customFilter(ILcdFilter<AWTEvent> aFilter)
Adds a custom filter.
|
TLcdAWTEventFilterBuilder |
keyEvents()
A filter that only allows key events to pass.
|
TLcdAWTEventFilterBuilder |
leftMouseButton()
Adds a left mouse button filter.
|
TLcdAWTEventFilterBuilder |
middleMouseButton()
Adds a middle mouse button filter.
|
TLcdAWTEventFilterBuilder |
mouseEvents()
A filter that only allows mouse events to pass.
|
TLcdAWTEventFilterBuilder |
mouseWheelFilter()
A filter that only allows mouse wheel events to pass.
|
static TLcdAWTEventFilterBuilder |
newBuilder()
Returns a new AWT event filter builder.
|
TLcdAWTEventFilterBuilder |
openBrackets()
Starts a new subfilter, all filters and operators called between this call and the next call to
closeBrackets will be evaluated together before operators and filters
outside the brackets are evaluated. |
TLcdAWTEventFilterBuilder |
or()
Operator to be called between two filter calls to indicate the event must pass one of the two filters.
|
TLcdAWTEventFilterBuilder |
rightMouseButton()
Adds a right mouse button filter.
|
TLcdAWTEventFilterBuilder |
shiftFilter(boolean aShiftDown)
Adds a shift down InputEvent filter.
|
TLcdAWTEventFilterBuilder |
touchEvents()
A filter that only allows touch events to pass.
|
public static TLcdAWTEventFilterBuilder newBuilder()
public TLcdAWTEventFilterBuilder or()
public TLcdAWTEventFilterBuilder and()
public TLcdAWTEventFilterBuilder openBrackets()
closeBrackets
will be evaluated together before operators and filters
outside the brackets are evaluated.public TLcdAWTEventFilterBuilder closeBrackets()
openBrackets
will be evaluated together before operators and filters
outside the brackets are evaluated.public ILcdFilter<AWTEvent> build()
public TLcdAWTEventFilterBuilder customFilter(ILcdFilter<AWTEvent> aFilter)
aFilter
- the filter to add to this builder.public TLcdAWTEventFilterBuilder leftMouseButton()
public TLcdAWTEventFilterBuilder middleMouseButton()
public TLcdAWTEventFilterBuilder rightMouseButton()
public TLcdAWTEventFilterBuilder ctrlFilter(boolean aCtrlDown)
aCtrlDown
- if true only events with a ctrl down mask pass, otherwise only events without
ctrl down mask.public TLcdAWTEventFilterBuilder altFilter(boolean aAltDown)
aAltDown
- if true only events with a alt down mask pass, otherwise only events without
alt down mask.public TLcdAWTEventFilterBuilder shiftFilter(boolean aShiftDown)
aShiftDown
- if true only events with a shift down mask pass, otherwise only events without
shift down mask.public TLcdAWTEventFilterBuilder mouseWheelFilter()
public TLcdAWTEventFilterBuilder touchEvents()
public TLcdAWTEventFilterBuilder mouseEvents()
public TLcdAWTEventFilterBuilder keyEvents()