com.dlsc.flexgantt.command

## Class SubProgressMonitor

- java.lang.Object
- - com.dlsc.flexgantt.command.ProgressMonitorWrapper
  - - com.dlsc.flexgantt.command.SubProgressMonitor

- All Implemented Interfaces:
    IProgressMonitor

      public class SubProgressMonitor
      extends ProgressMonitorWrapper

  A progress monitor that uses a given amount of work ticks from a parent monitor. It can be used as follows:

           try {
               pm.beginTask("Main Task", 100);
               doSomeWork(pm, 30);
               SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 40);
               try {
                   subMonitor.beginTask("", 300);
                   doSomeWork(subMonitor, 300);
               } finally {
                   subMonitor.done();
               }
               doSomeWork(pm, 30);
           } finally {
               pm.done();
           }

  This class may be instantiated or subclassed by clients.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `PREPEND_MAIN_LABEL_TO_SUBTASK` Style constant indicating that the main task label should be prepended to the subtask label.
    `static int` | `SUPPRESS_SUBTASK_LABEL` Style constant indicating that calls to `subTask` should not have any effect.

    - ### Fields inherited from interface com.dlsc.flexgantt.command.IProgressMonitor

      `UNKNOWN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SubProgressMonitor(IProgressMonitor monitor, int ticks)` Creates a new sub-progress monitor for the given monitor.
    `SubProgressMonitor(IProgressMonitor monitor, int ticks, int style)` Creates a new sub-progress monitor for the given monitor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginTask(String name, int totalWork)` This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor.
    `void` | `done()` This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor.
    `void` | `internalWorked(double work)` This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor.
    `void` | `subTask(String name)` This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor.
    `void` | `worked(int work)` This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor.

    - ### Methods inherited from class com.dlsc.flexgantt.command.ProgressMonitorWrapper

      `getWrappedProgressMonitor, isCanceled, setCanceled, setTaskName`

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

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

- - ### Field Detail

    - #### SUPPRESS_SUBTASK_LABEL

          public static final int SUPPRESS_SUBTASK_LABEL

      Style constant indicating that calls to `subTask` should not have any effect.
      See Also:
        `SubProgressMonitor(IProgressMonitor,int,int)`, Constant Field Values

    - #### PREPEND_MAIN_LABEL_TO_SUBTASK

          public static final int PREPEND_MAIN_LABEL_TO_SUBTASK

      Style constant indicating that the main task label should be prepended to the subtask label.
      See Also:
        `SubProgressMonitor(IProgressMonitor,int,int)`, Constant Field Values

  - ### Constructor Detail

    - #### SubProgressMonitor

          public SubProgressMonitor(IProgressMonitor monitor,
                                    int ticks)

      Creates a new sub-progress monitor for the given monitor. The sub progress monitor uses the given number of work ticks from its parent monitor.
      Parameters:
        `monitor` - the parent progress monitor
        `ticks` - the number of work ticks allocated from the parent monitor

    - #### SubProgressMonitor

          public SubProgressMonitor(IProgressMonitor monitor,
                                    int ticks,
                                    int style)

      Creates a new sub-progress monitor for the given monitor. The sub progress monitor uses the given number of work ticks from its parent monitor.
      Parameters:
        `monitor` - the parent progress monitor
        `ticks` - the number of work ticks allocated from the parent monitor
        `style` - one of
        - `SUPPRESS_SUBTASK_LABEL`
        - `PREPEND_MAIN_LABEL_TO_SUBTASK`
      See Also:
        `SUPPRESS_SUBTASK_LABEL`, `PREPEND_MAIN_LABEL_TO_SUBTASK`

  - ### Method Detail

    - #### beginTask

          public void beginTask(String name,
                                int totalWork)

      Description copied from class: `ProgressMonitorWrapper`
      This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor. Clients may override this method to do additional processing.
      Specified by:
        `beginTask` in interface `IProgressMonitor`
      Overrides:
        `beginTask` in class `ProgressMonitorWrapper`
      Parameters:
        `name` - the name (or description) of the main task
        `totalWork` - the total number of work units into which the main task is been subdivided. If the value is `UNKNOWN` the implementation is free to indicate progress in a way which doesn't require the total number of work units in advance.
      See Also:
        `IProgressMonitor.beginTask(String, int)`

    - #### done

          public void done()

      Description copied from class: `ProgressMonitorWrapper`
      This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor. Clients may override this method to do additional processing.
      Specified by:
        `done` in interface `IProgressMonitor`
      Overrides:
        `done` in class `ProgressMonitorWrapper`
      See Also:
        `IProgressMonitor.done()`

    - #### internalWorked

          public void internalWorked(double work)

      Description copied from class: `ProgressMonitorWrapper`
      This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor. Clients may override this method to do additional processing.
      Specified by:
        `internalWorked` in interface `IProgressMonitor`
      Overrides:
        `internalWorked` in class `ProgressMonitorWrapper`
      Parameters:
        `work` - the amount of work done
      See Also:
        `IProgressMonitor.internalWorked(double)`

    - #### subTask

          public void subTask(String name)

      Description copied from class: `ProgressMonitorWrapper`
      This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor. Clients may override this method to do additional processing.
      Specified by:
        `subTask` in interface `IProgressMonitor`
      Overrides:
        `subTask` in class `ProgressMonitorWrapper`
      Parameters:
        `name` - the name (or description) of the subtask
      See Also:
        `IProgressMonitor.subTask(String)`

    - #### worked

          public void worked(int work)

      Description copied from class: `ProgressMonitorWrapper`
      This implementation of a `IProgressMonitor` method forwards to the wrapped progress monitor. Clients may override this method to do additional processing.
      Specified by:
        `worked` in interface `IProgressMonitor`
      Overrides:
        `worked` in class `ProgressMonitorWrapper`
      Parameters:
        `work` - the number of work units just completed
      See Also:
        `IProgressMonitor.worked(int)`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.