org.geotools.utils.progress
Class ProgressManager

java.lang.Object
  extended by org.geotools.utils.progress.ProgressManager
Direct Known Subclasses:
BaseArgumentsManager

public abstract class ProgressManager
extends java.lang.Object

Author:
Simone Giannecchini, GeoSolutions.

Nested Class Summary
protected static class ProgressManager.ProgressEventDispatchThreadEventLauncher
          Private Class which simply fires the events using a copy of the listeners list in order to avoid problems with listeners that remove themselves or are removed by someone else
 
Constructor Summary
ProgressManager()
          Default constructor.
ProgressManager(boolean sendDelayedMessages)
           
 
Method Summary
 void addProcessingEventListener(ProcessingEventListener listener)
          Adding a listener to the ProcessingEventListeners' list.
 void dispose()
          Perform proper clean up.
 void fireEvent(java.lang.String string, double percentage)
          Firing an event to listeners in order to inform them about what we are doing and about the percentage of work already carried out.
 void fireException(java.lang.Exception ex)
          Firing an exception event to listeners in order to inform them that processing broke and we can no longer proceed.
 void fireException(java.lang.String string, double percentage, java.lang.Exception ex)
          Firing an exception event to listeners in order to inform them that processing broke and we can no longer proceed
 boolean getStopThread()
          Should this thread be stopped?
 void removeAllProcessingEventListeners()
          Removing all the listeners.
 void removeProcessingEventListener(ProcessingEventListener listener)
          Removing a ProcessingEventListener from the listeners' list.
abstract  void run()
          This method is responsible for doing the actual processing.
 void stopThread()
          Stop this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressManager

public ProgressManager(boolean sendDelayedMessages)

ProgressManager

public ProgressManager()
Default constructor.

Method Detail

addProcessingEventListener

public final void addProcessingEventListener(ProcessingEventListener listener)
Adding a listener to the ProcessingEventListeners' list.

Parameters:
listener - to add to the list of listeners.

removeProcessingEventListener

public final void removeProcessingEventListener(ProcessingEventListener listener)
Removing a ProcessingEventListener from the listeners' list.

Parameters:
listener - ProcessingEventListener to remove from the list of listeners.

removeAllProcessingEventListeners

public final void removeAllProcessingEventListeners()
Removing all the listeners.


fireEvent

public void fireEvent(java.lang.String string,
                      double percentage)
Firing an event to listeners in order to inform them about what we are doing and about the percentage of work already carried out.

Parameters:
string - The message to show.
percentage - The percentage for the process.

fireException

public void fireException(java.lang.String string,
                          double percentage,
                          java.lang.Exception ex)
Firing an exception event to listeners in order to inform them that processing broke and we can no longer proceed

Parameters:
string - The message to show.
percentage - The percentage for the process.
ex - the actual exception occurred

fireException

public void fireException(java.lang.Exception ex)
Firing an exception event to listeners in order to inform them that processing broke and we can no longer proceed. This is a convenience method, it will call fireException(String, double, Exception) with the exception message and -1 as percentage.

Parameters:
ex - the actual exception occurred

getStopThread

public final boolean getStopThread()
Should this thread be stopped?


stopThread

public final void stopThread()
Stop this thread.

Parameters:
stop -

dispose

public void dispose()
Perform proper clean up.


run

public abstract void run()
                  throws java.lang.Throwable
This method is responsible for doing the actual processing.

Throws:
java.lang.Throwable


Copyright © 1996-2010 Geotools. All Rights Reserved.