de.esprit.netsuite.client.activity.command

## Class ClientCommandTask<C extends ClientContext>

- 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>
          - - de.esprit.netsuite.client.activity.command.ClientCommandTask<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncExecutable<C>, AsyncTask<C>, CancellableTask, LocalCancellableTask, TaskMonitorSupport, TaskEvent.Source, TaskIdHolder, ErrorHandlerSupport, Renderable, SimpleLogSupport, Dumpable, Executable, ClientObject<C>, java.lang.Runnable

      public class ClientCommandTask<C extends ClientContext>
      extends AbstractSwingTask<C>
      implements ClientObject<C>

  This class performs the execution of an async ClientCommand
  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
    `ClientCommandTask(C clientCtx, ClientCommand cmd)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` This is special: Because the command may be queued but not running yet it will never react after a cancel neither will it ever run.
    `protected void` | `doneTaskFinished()` Ensure it is removed from the running commands list after execution
    `protected void` | `doneTaskStarted(TaskEvent e)` Enforces a repaint of the list in order to render the just started command as running
    `void` | `executeAsync()` Must be overridden to perform the async part.
    `ClientCommand` | `getClientCommand()`
    `C` | `getClientContext()` Returns the the client runtime environment
    `java.lang.String` | `getCommandId()`
    `java.awt.Color` | `getRenderColor()` Overridden to render queued commands in gray
    `javax.swing.Icon` | `getRenderIcon()`
    `DumpString` | `toDumpString(DumpString s)` This method allows subclasses to add values to the existing DumpString of the superclass.
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.

    - ### Methods inherited from class de.esprit.appsuite.gui.task.AbstractSwingTask

      `addMonitor, addTaskListener, awaitEventsDone, doneChildFinished, doneChildStarted, doneTaskCancelled, doneTaskFailed, doneTaskFinished, doneTaskProceeded, doneTaskStateChanged, doneTaskSucceeded, getActionCancel, getRenderText, getSwingTaskMonitor, isRegisterInTaskList, removeTaskListener, showError, showError, showError, showInfo, showInfo, showWarning, showWarning`

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

      `awaitFinished, awaitFinished, awaitStarted, createTaskId, deregisterTask, doOnFinish, doOnStart, doOnSuccess, 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, 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, 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, toString`

- - ### Constructor Detail

    - #### ClientCommandTask

          public ClientCommandTask(C clientCtx,
                           ClientCommand cmd)

  - ### Method Detail

    - #### getClientContext

          public final C getClientContext()

      Description copied from interface: `ClientObject`
      Returns the the client runtime environment
      Specified by:
        `getClientContext` in interface `ClientObject<C extends ClientContext>`

    - #### getCommandId

          public java.lang.String getCommandId()

    - #### getClientCommand

          public ClientCommand getClientCommand()

    - #### executeAsync

          public void executeAsync()
                            throws java.lang.Exception

      Description copied from class: `AbstractAsyncTask`
      Must be overridden to perform the async part. From within this method you may directly call `AbstractAsyncTask.notifyProceeded(Object, int, int, String)` in order to notify about task progress. Note: the running task should periodically call `AbstractAsyncExecutable.checkCancelled()` in order to detect cancellation.
      Specified by:
        `executeAsync` in interface `AsyncExecutable<C extends ClientContext>`
      Specified by:
        `executeAsync` in class `AbstractAsyncTask<C extends ClientContext>`
      Throws:
        `java.lang.Exception`
      See Also:
        `for synchronous execution`

    - #### cancel

          public void cancel()

      This is special: Because the command may be queued but not running yet it will never react after a cancel neither will it ever run. Therefore we must remove it manually.
      Specified by:
        `cancel` in interface `LocalCancellableTask`
      Overrides:
        `cancel` in class `AbstractAsyncTask<C extends ClientContext>`

    - #### doneTaskStarted

          protected void doneTaskStarted(TaskEvent e)

      Enforces a repaint of the list in order to render the just started command as running
      Overrides:
        `doneTaskStarted` in class `AbstractSwingTask<C extends ClientContext>`

    - #### doneTaskFinished

          protected void doneTaskFinished()

      Ensure it is removed from the running commands list after execution

    - #### getRenderIcon

          public javax.swing.Icon getRenderIcon()

      Specified by:
        `getRenderIcon` in interface `Renderable`
      Overrides:
        `getRenderIcon` in class `AbstractSwingTask<C extends ClientContext>`

    - #### getRenderColor

          public java.awt.Color getRenderColor()

      Overridden to render queued commands in gray
      Specified by:
        `getRenderColor` in interface `Renderable`
      Overrides:
        `getRenderColor` in class `AbstractSwingTask<C extends ClientContext>`

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `AbstractAsyncTask<C extends ClientContext>`

    - #### toDumpString

          public DumpString toDumpString(DumpString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing DumpString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toDumpString` in interface `Dumpable`
      Overrides:
        `toDumpString` in class `DumpableObject`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.