Class Task

    • Field Summary

      Fields 
      ChangeModifier and Type Field Description
      NEWprotected boolean waitForTaskCompleted  
    • Constructor Summary

      Constructors 
      ChangeConstructor Description
      Task​(java.lang.String title)
      Creates new Task.
      Task​(java.lang.String title, boolean canCancel, boolean hasProgress, boolean isModal)
      Construct a new Task.
      Task​(java.lang.String title, boolean canCancel, boolean hasProgress, boolean isModal, boolean waitForTaskCompleted)
      Construct a new Task.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      ChangeModifier and Type Method Description
      void addTaskListener​(TaskListener listener)
      Sets the task listener on this task.
      boolean canCancel()
      Returns true if the task can be canceled.
      void cancel()  
      int getStatusTextAlignment()
      Returns the alignment of the text displayed in the modal dialog.
      java.lang.String getTaskTitle()
      Get the title associated with the task
      boolean hasProgress()
      Return true if the task has a progress indicator.
      boolean isForgettable()
      Returns true if this task should be left alone to die when cancelled, as opposed to being interrupted
      boolean isInterruptible()  
      boolean isModal()
      Returns true if the dialog associated with the task is modal.
      void monitoredRun​(TaskMonitor monitor)
      When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread
      NEWprotected void notifyTaskListeners​(boolean wasCancelled)  
      abstract void run​(TaskMonitor monitor)
      This is the method that will be called to do the work
      void setForgettable​(boolean isForgettable)  
      void setHasProgress​(boolean b)
      Sets this task to have progress or not.
      void setInterruptible​(boolean interruptible)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • waitForTaskCompleted NEW

        protected boolean waitForTaskCompleted

Constructor Detail

  • Method Detail

    • getTaskTitle

      public final java.lang.String getTaskTitle()
      Get the title associated with the task
      Returns:
      String title shown in the dialog
    • getStatusTextAlignment

      public int getStatusTextAlignment()
      Returns the alignment of the text displayed in the modal dialog. The default is SwingConstants.CENTER. For status updates where the initial portion of the text does not change, SwingConstants.LEADING is recommended. To change the default value, simply override this method and return one of SwingConstants CENTER, LEADING or TRAILING.
      Returns:
      the alignment of the text displayed
    • monitoredRun

      public final void monitoredRun​(TaskMonitor monitor)
      When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread
      Specified by:
      monitoredRun in interface MonitoredRunnable
      Parameters:
      monitor - The TaskMonitor
    • cancel

      public void cancel()
    • notifyTaskListeners NEW

      protected void notifyTaskListeners​(boolean wasCancelled)
    • hasProgress

      public boolean hasProgress()
      Return true if the task has a progress indicator.
      Returns:
      boolean true if the task shows progress
    • setHasProgress

      public void setHasProgress​(boolean b)
      Sets this task to have progress or not. Note: changing this value after launching the task will have no effect.
      Parameters:
      b - true to show progress, false otherwise.
    • canCancel

      public boolean canCancel()
      Returns true if the task can be canceled.
      Returns:
      boolean true if the user can cancel the task
    • isModal

      public boolean isModal()
      Returns true if the dialog associated with the task is modal.
      Returns:
      boolean true if the associated dialog is modal
    • isInterruptible

      public boolean isInterruptible()
    • setInterruptible

      public void setInterruptible​(boolean interruptible)
    • isForgettable

      public boolean isForgettable()
      Returns true if this task should be left alone to die when cancelled, as opposed to being interrupted
      Returns:
      true if forgettable
    • setForgettable

      public void setForgettable​(boolean isForgettable)
    • addTaskListener

      public void addTaskListener​(TaskListener listener)
      Sets the task listener on this task. It is a programming error to call this method more than once or to call this method if a listener was passed into the constructor of this class.
      Parameters:
      listener - the listener