Class SwtExec.Guarded

  • All Implemented Interfaces:
    RxSubscriber, java.util.concurrent.Executor
    Enclosing class:
    SwtExec

    public static class SwtExec.Guarded
    extends GuardedExecutor
    Executor and Rx for conducting actions which are guarded on an SWT widget. Obtained via SwtExec.guardOn(Widget) or SwtExec.guardOn(ControlWrapper).

     SwtExec.Guarded guarded = SwtExec.immediate().guardOn(textBox);
     // guaranteed to not cause "Widget is disposed" errors
     guarded.subscribe(serverResponse, txt -> textBox.setText(text));
     
    See Also:
    Rx
    • Method Detail

      • timerExec

        public void timerExec​(int delayMs,
                              java.lang.Runnable runnable)
        Runs the given runnable after the given delay iff the guard widget is not disposed.
      • schedule

        public java.util.concurrent.ScheduledFuture<?> schedule​(java.lang.Runnable command,
                                                                long delay,
                                                                java.util.concurrent.TimeUnit unit)
        Same as SwtExec.schedule(Runnable, long, TimeUnit) but automatically cancels when the guard is disposed. Identical behavior for `immediate()`, `async()`, etc.
      • scheduleWithFixedDelay

        public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay​(java.lang.Runnable command,
                                                                              long initialDelay,
                                                                              long delay,
                                                                              java.util.concurrent.TimeUnit unit)
        Same as SwtExec.scheduleWithFixedDelay(Runnable, long, long, TimeUnit) but automatically cancels when the guard is disposed. Identical behavior for `immediate()`, `async()`, etc.
      • scheduleAtFixedRate

        public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate​(java.lang.Runnable command,
                                                                           long initialDelay,
                                                                           long delay,
                                                                           java.util.concurrent.TimeUnit unit)
        Same as SwtExec.scheduleAtFixedRate(Runnable, long, long, TimeUnit) but automatically cancels when the guard is disposed. Identical behavior for `immediate()`, `async()`, etc.