org.geotoolkit.process
Class ProcessEvent

Object
  extended by EventObject
      extended by ProcessEvent
All Implemented Interfaces:
Serializable

public class ProcessEvent
extends EventObject

Event sent by a running process to its listeners. This event contains an optional user-friendly task description together with the task progression as a percentage. In addition the event can contains one of the following:

Since:
3.19
Version:
3.20
Author:
Johann Sorel (Geomatys)
See Also:
Serialized Form
Module:
utility/geotk-utility (download)    View source code for this class

Field Summary
 
Fields inherited from class EventObject
source
 
Constructor Summary
ProcessEvent(Process source)
          Creates a new event with the given source but no message, no exception and an undetermined progress state.
ProcessEvent(Process source, CharSequence task, float progress)
          Creates a new event with the given source, task and progress.
ProcessEvent(Process source, CharSequence task, float progress, Exception exception)
          Creates a new event with the given source, task, progress and exception.
ProcessEvent(Process source, CharSequence task, float progress, ParameterValueGroup output)
          Creates a new event with the given source, task, progress and output.
 
Method Summary
 Exception getException()
          Returns an error or warning that occurred while executing the task, or null if none.
 ParameterValueGroup getOutput()
          Returns the output, which may be an intermediate calculation or the final result.
 float getProgress()
          Returns the current progress as a percent completed, from 0 to 100 inclusive.
 Process getSource()
          Returns the source of this event.
 InternationalString getTask()
          Returns a message that describes the task under execution, or null if none.
 String toString()
          Returns a string representation of this event.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessEvent

public ProcessEvent(Process source)
Creates a new event with the given source but no message, no exception and an undetermined progress state.

Parameters:
source - The source of this event.

ProcessEvent

public ProcessEvent(Process source,
                    CharSequence task,
                    float progress)
Creates a new event with the given source, task and progress.

Parameters:
source - The source of this event.
task - A message that describe the task under execution, or null if none.
progress - The progress as a number between 0 and 100, or Float.NaN if undetermined.

ProcessEvent

public ProcessEvent(Process source,
                    CharSequence task,
                    float progress,
                    ParameterValueGroup output)
Creates a new event with the given source, task, progress and output. The output may be an intermediate calculation, or the final result.

Parameters:
source - The source of this event.
task - A message that describe the task under execution, or null if none.
progress - The progress as a number between 0 and 100, or Float.NaN if undetermined.
output - The output (intermediate calculation of final result), or null if none.
Since:
3.20

ProcessEvent

public ProcessEvent(Process source,
                    CharSequence task,
                    float progress,
                    Exception exception)
Creates a new event with the given source, task, progress and exception.

Parameters:
source - The source of this event.
task - A message that describe the task under execution, or null if none.
progress - The progress as a number between 0 and 100, or Float.NaN if undetermined.
exception - An error or warning that occurred while executing the task, or null if none.
Method Detail

getSource

public Process getSource()
Returns the source of this event.

Overrides:
getSource in class EventObject

getTask

public InternationalString getTask()
Returns a message that describes the task under execution, or null if none. The message may contain user friendly information provided by the process. This message may be show in a dialog box or elsewhere, at listener choice.

Returns:
A message that describe the tasks under execution, or null if none.

getProgress

public float getProgress()
Returns the current progress as a percent completed, from 0 to 100 inclusive. The NaN value means that the process is in an undetermined state.

Returns:
The current progress from 0 to 100 inclusive, or Float.NaN if undetermined.

getOutput

public ParameterValueGroup getOutput()
Returns the output, which may be an intermediate calculation or the final result. More specifically:

Returns:
The intermediate calculation (when progressing) or the final result (when completed), or null if none.
Since:
3.20

getException

public Exception getException()
Returns an error or warning that occurred while executing the task, or null if none. The exception is considered fatal if this ProcessEvent was given to the ProcessListener.failed(ProcessEvent) method. Otherwise the exception is considered as a warning only.

Returns:
Error or warning that occurred while executing the task, or null if none.

toString

public String toString()
Returns a string representation of this event.

Overrides:
toString in class EventObject


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.