Class TLcdAWTEventFilterBuilder

java.lang.Object
com.luciad.view.TLcdAWTEventFilterBuilder

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.

Since:
2016.0
  • Method Details

    • newBuilder

      public static TLcdAWTEventFilterBuilder newBuilder()
      Returns a new AWT event filter builder.
      Returns:
      a new builder
    • or

      Operator to be called between two filter calls to indicate the event must pass one of the two filters.
      Returns:
      this builder.
    • and

      Operator to be called between two filter calls to indicate the event must pass both filters.
      Returns:
      this builder.
    • openBrackets

      public 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.
      Returns:
      the sub-filter.
    • closeBrackets

      public 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.
      Returns:
      the parent of the current sub-filter.
    • build

      public ILcdFilter<AWTEvent> build()
      Builds the filter.
      Returns:
      a AWTEvent filter.
    • customFilter

      public TLcdAWTEventFilterBuilder customFilter(ILcdFilter<AWTEvent> aFilter)
      Adds a custom filter.
      Parameters:
      aFilter - the filter to add to this builder.
      Returns:
      this builder.
    • leftMouseButton

      public TLcdAWTEventFilterBuilder leftMouseButton()
      Adds a left mouse button filter. On macOS, this does not filter ctrl + left mouse button, because this is interpreted as a right mouse button.
      Returns:
      this builder.
    • middleMouseButton

      public TLcdAWTEventFilterBuilder middleMouseButton()
      Adds a middle mouse button filter.
      Returns:
      this builder.
    • rightMouseButton

      public TLcdAWTEventFilterBuilder rightMouseButton()
      Adds a right mouse button filter. On macOS, this also filters ctrl + left mouse button.
      Returns:
      this builder.
    • ctrlFilter

      public TLcdAWTEventFilterBuilder ctrlFilter(boolean aCtrlDown)
      Adds a ctrl (cmd on macOS) down InputEvent filter.
      Parameters:
      aCtrlDown - if true only events with a ctrl down mask pass, otherwise only events without ctrl down mask.
      Returns:
      this builder.
    • altFilter

      public TLcdAWTEventFilterBuilder altFilter(boolean aAltDown)
      Adds a alt down InputEvent filter.
      Parameters:
      aAltDown - if true only events with a alt down mask pass, otherwise only events without alt down mask.
      Returns:
      this builder.
    • shiftFilter

      public TLcdAWTEventFilterBuilder shiftFilter(boolean aShiftDown)
      Adds a shift down InputEvent filter.
      Parameters:
      aShiftDown - if true only events with a shift down mask pass, otherwise only events without shift down mask.
      Returns:
      this builder.
    • mouseWheelFilter

      public TLcdAWTEventFilterBuilder mouseWheelFilter()
      A filter that only allows mouse wheel events to pass.
      Returns:
      this builder.
    • touchEvents

      public TLcdAWTEventFilterBuilder touchEvents()
      A filter that only allows touch events to pass.
      Returns:
      this builder.
    • mouseEvents

      public TLcdAWTEventFilterBuilder mouseEvents()
      A filter that only allows mouse events to pass.
      Returns:
      this builder.
    • keyEvents

      public TLcdAWTEventFilterBuilder keyEvents()
      A filter that only allows key events to pass.
      Returns:
      this builder.