de.esprit.appsuite.task

## Class ProgressFireAdapter

- java.lang.Object
- - de.esprit.appsuite.task.ProgressFireAdapter

- All Implemented Interfaces:
    CancellableTask, Resettable

      public final class ProgressFireAdapter
      extends java.lang.Object
      implements CancellableTask, Resettable

  This class delegates PROGRESS messages to a target task. It ensures that not more than 100 PROGRESS events are being sent no matter how often fireProgress(...) was called.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProgressFireAdapter()`
    `ProgressFireAdapter(AsyncExecutable targetTask)`
    `ProgressFireAdapter(AsyncExecutable targetTask, long maxSteps)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `fireProgress(long step)`
    `boolean` | `fireProgress(long step, java.lang.String message)`
    `boolean` | `fireProgress(java.lang.Object result, long step, java.lang.String message)` Delegates the PROGRESS call to the progressorTask.
    `int` | `getFireCount()`
    `long` | `getMaxSteps()`
    `int` | `getPercentageDone()`
    `AsyncExecutable` | `getProgressorTask()`
    `void` | `reset()` This method is called by the ResetButton on it's registered target.
    `void` | `setMaxSteps(long maxSteps)` Set the maximum number of steps expected.
    `void` | `setProgressorTask(AsyncExecutable targetTask)` Sets the target task that fires it's progress to this adapter.
    `boolean` | `wasCancelled()` Tells whether ever an attempt has been made to cancel this task.

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

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

- - ### Constructor Detail

    - #### ProgressFireAdapter

          public ProgressFireAdapter()

    - #### ProgressFireAdapter

          public ProgressFireAdapter(AsyncExecutable targetTask)

    - #### ProgressFireAdapter

          public ProgressFireAdapter(AsyncExecutable targetTask,
                             long maxSteps)

  - ### Method Detail

    - #### setMaxSteps

          public final void setMaxSteps(long maxSteps)

      Set the maximum number of steps expected. If progressCount is zero, no PROGRESS events will be fired at all.

    - #### reset

          public final void reset()

      Description copied from interface: `Resettable`
      This method is called by the ResetButton on it's registered target.
      Specified by:
        `reset` in interface `Resettable`

    - #### getPercentageDone

          public final int getPercentageDone()

    - #### getMaxSteps

          public final long getMaxSteps()

    - #### fireProgress

          public final boolean fireProgress(long step)

    - #### fireProgress

          public final boolean fireProgress(long step,
                             java.lang.String message)

    - #### fireProgress

          public final boolean fireProgress(java.lang.Object result,
                             long step,
                             java.lang.String message)

      Delegates the PROGRESS call to the progressorTask.
      Returns:
        true if the progress was actually fired.

    - #### getFireCount

          public final int getFireCount()

    - #### setProgressorTask

          public final void setProgressorTask(AsyncExecutable targetTask)

      Sets the target task that fires it's progress to this adapter.

    - #### getProgressorTask

          public AsyncExecutable getProgressorTask()

    - #### wasCancelled

          public final boolean wasCancelled()

      Description copied from interface: `CancellableTask`
      Tells whether ever an attempt has been made to cancel this task.
      Specified by:
        `wasCancelled` in interface `CancellableTask`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.