Class ClickTrigger

All Implemented Interfaces:
Serializable

public class ClickTrigger extends DomEventTrigger
Fires on the host component's click DOM event and exposes the click coordinates and modifier-key state as Action.Inputs for downstream actions.

Example:


 ClickTrigger click = new ClickTrigger(button);
 click.triggers(new SetPropertyAction<>(xField, "value", click.screenX()),
         new SetPropertyAction<>(yField, "value", click.screenY()));
 

For internal use only. May be renamed or removed in a future release.

See Also:
  • Constructor Details

    • ClickTrigger

      public ClickTrigger(Component host)
      Creates a click trigger on the given host component's root element.
      Parameters:
      host - the component to listen on, not null
  • Method Details

    • screenX

      public Action.Input<Integer> screenX()
      event.screenX — X coordinate relative to the screen.
    • screenY

      public Action.Input<Integer> screenY()
      event.screenY — Y coordinate relative to the screen.
    • clientX

      public Action.Input<Integer> clientX()
      event.clientX — X coordinate relative to the viewport.
    • clientY

      public Action.Input<Integer> clientY()
      event.clientY — Y coordinate relative to the viewport.
    • shiftKey

      public Action.Input<Boolean> shiftKey()
      event.shiftKey — whether shift was held during the click.
    • ctrlKey

      public Action.Input<Boolean> ctrlKey()
      event.ctrlKey — whether ctrl was held during the click.
    • altKey

      public Action.Input<Boolean> altKey()
      event.altKey — whether alt was held during the click.
    • metaKey

      public Action.Input<Boolean> metaKey()
      event.metaKey — whether meta was held during the click.