de.esprit.appsuite.gui.task

## Class AbstractSwingTask<C extends ApplicationContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.task.AbstractAsyncExecutable<C>
      - - de.esprit.appsuite.task.AbstractAsyncTask<C>
        - - de.esprit.appsuite.gui.task.AbstractSwingTask<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncExecutable<C>, AsyncTask<C>, CancellableTask, LocalCancellableTask, TaskMonitorSupport, TaskEvent.Source, TaskIdHolder, ErrorHandlerSupport, Renderable, SimpleLogSupport, Dumpable, Executable, java.lang.Runnable
  Direct Known Subclasses:
    AbstractWFT, AbstractWorkflow, AsciiParserTask, ClientCommandTask, DataParserTask, FileTransferClientTask

      public abstract class AbstractSwingTask<C extends ApplicationContext>
      extends AbstractAsyncTask<C>
      implements Renderable, ErrorHandlerSupport, TaskEvent.Source

  This is an `AsyncTask` supposed to be run in a Swing GUIs environment. It runs with a `SwingTaskMonitor` that translates direct task state notifications into `TaskEvent`s which you can register for. These events can be used to drive GUI components such as a ProgressBar. Furthermore you may override any of the doneTaskXXX() methods for performing GUI-synchronous actions driven by the asynchronous task. Note that the running task is registered within the context's `ActiveTasksListModel` which allows for observing the task's `RunStateFlag` in an `ActiveTasksList`.
  Author:
    Rainer Buesch

- - ### Field Summary

    - ### Fields inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `childTaskRef, isTestMode, monitorController, resultRef, stateFlag`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSwingTask(C ctx)`
    `AbstractSwingTask(C ctx, LogChannel logCh)`
    `AbstractSwingTask(C ctx, LogChannel logCh, java.lang.String taskName, TaskType taskType)`
    `AbstractSwingTask(C ctx, java.lang.String taskName)`
    `AbstractSwingTask(C ctx, java.lang.String taskName, TaskType taskType)`
    `AbstractSwingTask(C ctx, TaskType taskType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMonitor(TaskMonitor newMonitor)` Adds a `TaskMonitor` which is notified about `RunStateFlag` changes
    `void` | `addTaskListener(TaskEvent.Listener l)`
    `void` | `awaitEventsDone()` Provides a means to synchronize on the state that all `TaskEvent`s of this task have been actually processed by the event dispatcher Thread.
    `protected void` | `doneChildFinished(TaskEvent e)`
    `protected void` | `doneChildStarted(TaskEvent e)`
    `protected void` | `doneTaskCancelled(TaskEvent e)`
    `protected void` | `doneTaskFailed(TaskEvent e)`
    `protected void` | `doneTaskFinished(TaskEvent e)`
    `protected void` | `doneTaskProceeded(TaskEvent e)`
    `protected void` | `doneTaskStarted(TaskEvent e)`
    `protected void` | `doneTaskStateChanged(TaskEvent e)`
    `protected void` | `doneTaskSucceeded(TaskEvent e)`
    `TaskCancelAction` | `getActionCancel()`
    `java.awt.Color` | `getRenderColor()`
    `javax.swing.Icon` | `getRenderIcon()`
    `java.lang.String` | `getRenderText()`
    `SwingTaskMonitor` | `getSwingTaskMonitor()`
    `protected boolean` | `isRegisterInTaskList()`
    `void` | `removeTaskListener(TaskEvent.Listener l)`
    `void` | `showError(java.lang.Exception e)`
    `void` | `showError(java.lang.String message, java.lang.Exception e)`
    `void` | `showError(java.lang.String message, java.lang.String details, java.lang.Exception e)`
    `void` | `showInfo(java.lang.String message)`
    `void` | `showInfo(java.lang.String message, java.lang.String details)`
    `void` | `showWarning(java.lang.String message)`
    `void` | `showWarning(java.lang.String message, java.lang.String details)`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncTask

      `awaitFinished, awaitFinished, awaitStarted, cancel, createTaskId, deregisterTask, doOnFinish, doOnStart, doOnSuccess, executeAsync, executeChildTask, executeChildTask, getCurrentFuture, getMaxChildTasks, getPriority, getProcessingDuration, getStartTime, getStopWatch, handleFinish, handleStart, handleSuccess, isRegisterForCancel, isRunning, notifyProceeded, registerTask, releaseStart, run, setCurrentFuture, setMaxChildTasks, setPriority, setRegisterForCancel, setReleaseTimeout, submit, submit, submitInternal, toString, wasSucceeded`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, hasError, hasMonitor, isCancellable, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelled`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.appsuite.task.AsyncTask

      `getError, hasError, setName`

    - ### Methods inherited from interface de.esprit.appsuite.task.AsyncExecutable

      `checkCancelled, checkForErrorAndRethrow, executeSubTask, getName, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, isCancellable, setCancellable, setName, setResult, setRunStateFlag, sleepChecked`

    - ### Methods inherited from interface de.esprit.appsuite.launch.ApplicationObject

      `getApplicationContext`

    - ### Methods inherited from interface de.esprit.common.type.Executable

      `execute`

    - ### Methods inherited from interface de.esprit.appsuite.task.monitor.TaskMonitorSupport

      `clearMonitors, getMonitorCount, getMonitors, hasMonitor, removeMonitor`

    - ### Methods inherited from interface de.esprit.common.log.SimpleLogSupport

      `getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from interface de.esprit.appsuite.task.CancellableTask

      `wasCancelled`

    - ### Methods inherited from interface de.esprit.appsuite.task.TaskIdHolder

      `getTaskId`

    - ### Methods inherited from interface de.esprit.common.type.Dumpable

      `toDumpString, toDumpString, toString`

- - ### Constructor Detail

    - #### AbstractSwingTask

          public AbstractSwingTask(C ctx)

    - #### AbstractSwingTask

          public AbstractSwingTask(C ctx,
                           TaskType taskType)

    - #### AbstractSwingTask

          public AbstractSwingTask(C ctx,
                           java.lang.String taskName)

    - #### AbstractSwingTask

          public AbstractSwingTask(C ctx,
                           LogChannel logCh)

    - #### AbstractSwingTask

          public AbstractSwingTask(C ctx,
                           java.lang.String taskName,
                           TaskType taskType)

    - #### AbstractSwingTask

          public AbstractSwingTask(C ctx,
                           LogChannel logCh,
                           java.lang.String taskName,
                           TaskType taskType)

  - ### Method Detail

    - #### awaitEventsDone

          public void awaitEventsDone()
                               throws java.lang.InterruptedException

      Provides a means to synchronize on the state that all `TaskEvent`s of this task have been actually processed by the event dispatcher Thread.
      Throws:
        `java.lang.InterruptedException`

    - #### addTaskListener

          public final void addTaskListener(TaskEvent.Listener l)

      Specified by:
        `addTaskListener` in interface `TaskEvent.Source`

    - #### removeTaskListener

          public final void removeTaskListener(TaskEvent.Listener l)

      Specified by:
        `removeTaskListener` in interface `TaskEvent.Source`

    - #### getActionCancel

          public final TaskCancelAction getActionCancel()

    - #### getSwingTaskMonitor

          public final SwingTaskMonitor getSwingTaskMonitor()

    - #### addMonitor

          public final void addMonitor(TaskMonitor newMonitor)

      Description copied from interface: `TaskMonitorSupport`
      Adds a `TaskMonitor` which is notified about `RunStateFlag` changes
      Specified by:
        `addMonitor` in interface `TaskMonitorSupport`
      Overrides:
        `addMonitor` in class `AbstractAsyncExecutable<C extends ApplicationContext>`

    - #### doneTaskStateChanged

          protected void doneTaskStateChanged(TaskEvent e)

    - #### doneTaskStarted

          protected void doneTaskStarted(TaskEvent e)

    - #### doneTaskProceeded

          protected void doneTaskProceeded(TaskEvent e)

    - #### doneTaskCancelled

          protected void doneTaskCancelled(TaskEvent e)

    - #### doneTaskSucceeded

          protected void doneTaskSucceeded(TaskEvent e)

    - #### doneTaskFailed

          protected void doneTaskFailed(TaskEvent e)

    - #### doneTaskFinished

          protected void doneTaskFinished(TaskEvent e)

    - #### doneChildStarted

          protected void doneChildStarted(TaskEvent e)

    - #### doneChildFinished

          protected void doneChildFinished(TaskEvent e)

    - #### getRenderColor

          public java.awt.Color getRenderColor()

      Specified by:
        `getRenderColor` in interface `Renderable`

    - #### getRenderIcon

          public javax.swing.Icon getRenderIcon()

      Specified by:
        `getRenderIcon` in interface `Renderable`

    - #### getRenderText

          public java.lang.String getRenderText()

      Specified by:
        `getRenderText` in interface `Renderable`

    - #### showError

          public final void showError(java.lang.Exception e)

      Specified by:
        `showError` in interface `ErrorHandlerSupport`

    - #### showError

          public final void showError(java.lang.String message,
                       java.lang.Exception e)

      Specified by:
        `showError` in interface `ErrorHandlerSupport`

    - #### showError

          public final void showError(java.lang.String message,
                       java.lang.String details,
                       java.lang.Exception e)

      Specified by:
        `showError` in interface `ErrorHandlerSupport`

    - #### showInfo

          public final void showInfo(java.lang.String message,
                      java.lang.String details)

      Specified by:
        `showInfo` in interface `ErrorHandlerSupport`

    - #### showInfo

          public final void showInfo(java.lang.String message)

      Specified by:
        `showInfo` in interface `ErrorHandlerSupport`

    - #### showWarning

          public final void showWarning(java.lang.String message,
                         java.lang.String details)

      Specified by:
        `showWarning` in interface `ErrorHandlerSupport`

    - #### showWarning

          public final void showWarning(java.lang.String message)

      Specified by:
        `showWarning` in interface `ErrorHandlerSupport`

    - #### isRegisterInTaskList

          protected boolean isRegisterInTaskList()

Copyright © 2014 EsprIT-Systems. All Rights Reserved.