Class TLspClickActionController

All Implemented Interfaces:
ILcdAWTEventListener, ILspController

public class TLspClickActionController extends ALspActionController

This controller will execute a given action based on MOUSE_CLICKED events. Only when the number of clicks reaches the chosen click count, will the action be executed. There will be a slight delay to make sure no further click is received. As soon as is apparent that the required number of clicks is not going to be reached or is going to be exceeded, all relevant events (MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_CLICKED)are passed to the next controller in the chain. Note that the value of the AWT toolkit property "awt.multiClickInterval" is used to check the exact number of clicks. Increasing this value might make it easier to pull off multi-clicks.

Note: This controller only handles MouseEvents. All other events are immediately passed to the next controller in the chain.

Note: If you append more then one controller of this kind, to avoid consecutive multi click delays, append them in order of click count, for instance first the double click controller, then the triple click controller.

Warning: This controller will only behave correctly if it receives all relevant mouse events. For instance if it gets a MOUSE_PRESSED, it needs to receive all MOUSE_DRAGGED, MOUSE_RELEASED and MOUSE_CLICKED events that correspond with it. This means you have be careful when applying filters, or when appending this controller after other chainable controllers which might consume some of these events.

Since:
2012.0
  • Constructor Details

    • TLspClickActionController

      public TLspClickActionController(ILcdAction aAction, int aClickCount)
      Constructor for TLspClickActionController. The passed action will be triggered after a number of mouse clicks corresponding to the passed click count.
      Parameters:
      aAction - The action to trigger.
      aClickCount - How many clicks it takes to trigger the action.
  • Method Details

    • getAction

      public ILcdAction getAction()
      Returns the action that will be triggered once the configured click count is reached.
      Returns:
      the action to trigger.
    • setAction

      public void setAction(ILcdAction aAction)
      Sets the action that wil be triggered once the configured click count is reached.
      Parameters:
      aAction - the action to trigger.
    • handleAWTEventImpl

      public AWTEvent handleAWTEventImpl(AWTEvent aAWTEvent)
      Description copied from class: ALspController
      Called by handleAWTEvent. Returns null when the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen with TLcdTouchEvents). When the controller did not use the given event, it is returned unaltered.
      Specified by:
      handleAWTEventImpl in class ALspController
      Parameters:
      aAWTEvent - the event to be handled.
      Returns:
      null when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.