Class DelayedNotificator

java.lang.Object
org.csstudio.ui.util.DelayedNotificator

public class DelayedNotificator extends Object
A utility class to throttle actions caused by user interaction.

In some cases, user interaction may trigger actions that require some time to complete. Multiple interactions will need to cancel the previous submitted task in favor of the latest one. This class provides an easy implementation for that case.

  • Field Details

  • Constructor Details

    • DelayedNotificator

      public DelayedNotificator(long delay, TimeUnit unit)
      Creates a new notificator, with the delay given.

      Only one task per notificator can be queue at a time.

      Parameters:
      delay - the delay
      unit - the unit of the delay
  • Method Details

    • delayedExec

      public void delayedExec(Widget widget, Runnable command)
      Submits a command for the given widget. After the timeout, the command is executed on the display thread of the widget. If another command is submitted before the timeout, than the previous action is cancelled.
      Parameters:
      widget - the display thread of this widget will be used
      command - the command to execute