Class ActionWorker<R,​P>

java.lang.Object
javax.swing.SwingWorker<R,​P>
jaxx.runtime.swing.application.ActionWorker<R,​P>
All Implemented Interfaces:
java.lang.Runnable, java.util.concurrent.Future<R>, java.util.concurrent.RunnableFuture<R>

public class ActionWorker<R,​P>
extends javax.swing.SwingWorker<R,​P>
Action worker to execute a incoming action.
Since:
2.1
Author:
Tony Chemit - chemit@codelutin.com
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  ActionWorker.ActionStatus
    State of a running action

    Nested classes/interfaces inherited from class javax.swing.SwingWorker

    javax.swing.SwingWorker.StateValue
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.lang.String actionLabel  
    protected long endTime  
    protected java.lang.Exception error  
    protected long startTime  
    protected ActionWorker.ActionStatus status  
    protected java.util.concurrent.Callable<R> target  
  • Constructor Summary

    Constructors
    Constructor Description
    ActionWorker​(java.lang.String actionLabel)  
    ActionWorker​(java.lang.String actionLabel, java.lang.Runnable target)  
  • Method Summary

    Modifier and Type Method Description
    protected R doInBackground()  
    protected void done()  
    java.lang.String getActionLabel()  
    long getEndTime()  
    java.lang.Exception getError()  
    long getStartTime()  
    ActionWorker.ActionStatus getStatus()  
    java.util.concurrent.Callable<R> getTarget()  
    java.lang.String getTime()  
    boolean isFailed()  
    void setTarget​(java.lang.Runnable target)  
    void setTarget​(java.util.concurrent.Callable<R> target)
    Set the target to execute.

    Methods inherited from class javax.swing.SwingWorker

    addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress

    Methods inherited from class java.lang.Object

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

    • actionLabel

      protected final java.lang.String actionLabel
    • target

      protected java.util.concurrent.Callable<R> target
    • status

      protected ActionWorker.ActionStatus status
    • error

      protected java.lang.Exception error
    • startTime

      protected long startTime
    • endTime

      protected long endTime
  • Constructor Details

    • ActionWorker

      public ActionWorker​(java.lang.String actionLabel)
    • ActionWorker

      public ActionWorker​(java.lang.String actionLabel, java.lang.Runnable target)
  • Method Details

    • getTarget

      public java.util.concurrent.Callable<R> getTarget()
    • setTarget

      public void setTarget​(java.lang.Runnable target)
    • setTarget

      public void setTarget​(java.util.concurrent.Callable<R> target)
      Set the target to execute.
      Parameters:
      target - the target to execute
      Since:
      2.5.1
    • doInBackground

      protected R doInBackground() throws java.lang.Exception
      Specified by:
      doInBackground in class javax.swing.SwingWorker<R,​P>
      Throws:
      java.lang.Exception
    • isFailed

      public boolean isFailed()
    • getError

      public java.lang.Exception getError()
    • getStatus

      public ActionWorker.ActionStatus getStatus()
    • getActionLabel

      public java.lang.String getActionLabel()
    • done

      protected void done()
      Overrides:
      done in class javax.swing.SwingWorker<R,​P>
    • getTime

      public java.lang.String getTime()
    • getStartTime

      public long getStartTime()
    • getEndTime

      public long getEndTime()