org.geotools.util
Class SubProgressListener

Object
  extended by DelegateProgressListener
      extended by SubProgressListener
All Implemented Interfaces:
ProgressListener

public class SubProgressListener
extends DelegateProgressListener

A sub progress monitor, used to delegate a portion of work to a separate process.

Example:


 if( progress == null ) progress = new NullProgressListener();
 progress.started();
 progress.setDecsription("Connect");
 ..connect to data store and obtain feature collection...
 progress.progress( 20 ); // connecting represents 20% of the work
 progress.setDescription("Process features");
 featureCollection.accepts( visitor, new SubProgress( progress, 80 ) );
 progress.completed();
 

Author:
Jody

Field Summary
 
Fields inherited from class DelegateProgressListener
delegate
 
Constructor Summary
SubProgressListener(ProgressListener progress, float amount)
          Create a sub progress monitor, used to delegate work to a separate process.
 
Method Summary
 void complete()
          Notifies this listener that the operation has finished.
 float getProgress()
          Returns the current progress as a percent completed.
 void progress(float progress)
          Notifies this listener of progress in the lengthly operation.
 void started()
          Notifies this listener that the operation begins.
 
Methods inherited from class DelegateProgressListener
dispose, exceptionOccurred, getDescription, getTask, isCanceled, setCanceled, setDescription, setTask, warningOccurred
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubProgressListener

public SubProgressListener(ProgressListener progress,
                           float amount)
Create a sub progress monitor, used to delegate work to a separate process.

Parameters:
progress - parent progress to notify as we get work done
amount - amount of progress represented
Method Detail

started

public void started()
Description copied from interface: ProgressListener
Notifies this listener that the operation begins.

Specified by:
started in interface ProgressListener
Overrides:
started in class DelegateProgressListener

complete

public void complete()
Description copied from interface: ProgressListener
Notifies this listener that the operation has finished. The progress indicator will shows 100% or disappears, at implementor choice. If warning messages were pending, they will be displayed now.

Specified by:
complete in interface ProgressListener
Overrides:
complete in class DelegateProgressListener

getProgress

public float getProgress()
Description copied from interface: ProgressListener
Returns the current progress as a percent completed.

Specified by:
getProgress in interface ProgressListener
Overrides:
getProgress in class DelegateProgressListener
Returns:
Percent completed between 0 and 100 inclusive.

progress

public void progress(float progress)
Description copied from interface: ProgressListener
Notifies this listener of progress in the lengthly operation. Progress are reported as a value between 0 and 100 inclusive. Values out of bounds will be clamped.

Specified by:
progress in interface ProgressListener
Overrides:
progress in class DelegateProgressListener
Parameters:
progress - The progress as a value between 0 and 100 inclusive.


Copyright © 1996-2014 Geotools. All Rights Reserved.