jezuch.utils.starmapper2.event
Class ImageEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--java.awt.AWTEvent
              |
              +--jezuch.utils.starmapper2.event.ImageEvent
All Implemented Interfaces:
java.awt.ActiveEvent, java.io.Serializable

public class ImageEvent
extends java.awt.AWTEvent
implements java.awt.ActiveEvent

An event that indicates progress of image drawing process. This event is passed to both ProgressListeners and ImageProgressListeners.

Since:
2.0
Version:
2.0
Author:
Krzysztof Sobolewski
See Also:
ImageProgressListener, ProgressListener, Serialized Form

Field Summary
static int IMAGE_ERROR
          Event ID indicating an error during drawing
static int IMAGE_FINISH
          Event ID indicating that image drawing has finished
static int IMAGE_IN_PROGRESS
          Event ID indicating that image is being drawn
static int IMAGE_START
          Event ID indicating that image drawing is about to start
 
Fields inherited from class java.awt.AWTEvent
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ImageEvent(Starmapper source, RawImage image, int eventCode, int pixelsProduced, int pixelsToProduce)
          Constructs an ImageEvent from it's source (Starmapper), the image being processed, event ID and information about pixels produced and to be produced.
ImageEvent(Starmapper source, RawImage image, int eventCode, int pixelsProduced, int pixelsToProduce, java.lang.Exception ex)
          Constructs an ImageEvent for image error events.
 
Method Summary
 void dispatch()
          Dispatches this event.
 java.lang.Exception getException()
           
 RawImage getImage()
           
 int getPixelsProduced()
           
 int getPixelsToProduce()
           
 
Methods inherited from class java.awt.AWTEvent
consume, getID, isConsumed, paramString, setSource, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IMAGE_ERROR

public static final int IMAGE_ERROR
Event ID indicating an error during drawing

See Also:
Constant Field Values

IMAGE_FINISH

public static final int IMAGE_FINISH
Event ID indicating that image drawing has finished

See Also:
Constant Field Values

IMAGE_IN_PROGRESS

public static final int IMAGE_IN_PROGRESS
Event ID indicating that image is being drawn

See Also:
Constant Field Values

IMAGE_START

public static final int IMAGE_START
Event ID indicating that image drawing is about to start

See Also:
Constant Field Values
Constructor Detail

ImageEvent

public ImageEvent(Starmapper source,
                  RawImage image,
                  int eventCode,
                  int pixelsProduced,
                  int pixelsToProduce)
Constructs an ImageEvent from it's source (Starmapper), the image being processed, event ID and information about pixels produced and to be produced. It accepts all event IDs defined in this class except IMAGE_ERROR.

Parameters:
source - Starmapper that fired the event
image - image being processed
eventCode - event's code
pixelsProduced - number of pixels already produced
pixelsToProduce - number of pixels to be produced

ImageEvent

public ImageEvent(Starmapper source,
                  RawImage image,
                  int eventCode,
                  int pixelsProduced,
                  int pixelsToProduce,
                  java.lang.Exception ex)
Constructs an ImageEvent for image error events. This constructor is the same as ImageEvent(Starmapper, RawImage, int, int, int), but also accepts an exception and the only event ID allowed is IMAGE_ERROR.

Parameters:
source - Starmapper that fired the event
image - image being processed
eventCode - event's code
pixelsProduced - number of pixels already produced
pixelsToProduce - number of pixels to be produced
ex - Exception that caused image error event to be fired
Method Detail

dispatch

public void dispatch()
Dispatches this event. The full route is like this:
  1. Starmapper fires the event and passes this event to EventQueue.postEvent(AWTEvent)
  2. When the event reaches top of the event queue, the queue dispathes the event by calling its dispatch() method (as it implements ActiveEvent)
  3. The event calls Starmapper.dispatchEvent(ImageEvent) method of Starmapper that fired this event
  4. Starmapper passes the event to registered listeners

Specified by:
dispatch in interface java.awt.ActiveEvent
See Also:
ActiveEvent.dispatch()

getException

public java.lang.Exception getException()
Returns:
Exception that caused the image error event to be fired or null if the event type is not image error.

getImage

public RawImage getImage()
Returns:
the image being processed

getPixelsProduced

public int getPixelsProduced()
Returns:
number of pixels produced in the image

getPixelsToProduce

public int getPixelsToProduce()
Returns:
total number of pixels that is to be produced in the image