com.transmote.nest.events
Class Event

java.lang.Object
  extended by com.transmote.nest.events.Event
Direct Known Subclasses:
KeyEvent, MouseEvent

public class Event
extends Object

Event instances represent generic events dispatched by the Nest framework; Event can be subclassed for custom event development.

Author:
Eric Socolofsky
See Also:
EventDispatcher

Nested Class Summary
static class Event.PHASE
          Enumerated display list event phase.
 
Field Summary
static int ADDED
          Event type dispatched when a NestSprite is added as a child to another NestSprite, via NestSprite.addChild(com.transmote.nest.NestSprite).
static int ADDED_TO_STAGE
          Event type dispatched by a NestSprite and each of its descendants when it is added to the display list and becomes visible on-screen.
static int DISPATCHER_DISPOSE
          Event type dispatched when EventDispatcher.dispose() is called.
static int ERROR
          Event type dispatched when a caught error is handled within the Nest framework.
static int INIT
          Event type dispatched when a NestSprite is initialized, NOTE: not currently used.
static int REMOVED
          Event type dispatched when a NestSprite is removed from its parent, via NestSprite.removeChild(com.transmote.nest.NestSprite).
 
Constructor Summary
Event(int type)
          A generic Nest event instance.
Event(int type, boolean bubbles)
          A generic Nest event instance.
 
Method Summary
 boolean bubbles()
          Specifies whether or not the event will bubble up the display list.
 EventDispatcher currentTarget()
          The EventDispatcher currently processing this Event Instance.
 boolean isPropagationStopped()
          Returns true if stopPropagation() has been called.
 Event.PHASE phase()
          Enumerated display list event phase.
 processing.event.Event processingEvent()
          The Processing Event instance generated by Processing, if applicable (if this Event instance was generated in response to a mouse or keyboard action).
 void stopPropagation()
          Stop an Event instance traveling through the display list.
 Object target()
          If dispatched by an EventDispatcher, the EventDispatcher instance that dispatched this Event instance.
 String toString()
           
 int type()
          The event type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISPATCHER_DISPOSE

public static final int DISPATCHER_DISPOSE
Event type dispatched when EventDispatcher.dispose() is called.

See Also:
Constant Field Values

ADDED

public static final int ADDED
Event type dispatched when a NestSprite is added as a child to another NestSprite, via NestSprite.addChild(com.transmote.nest.NestSprite).

See Also:
Constant Field Values

ADDED_TO_STAGE

public static final int ADDED_TO_STAGE
Event type dispatched by a NestSprite and each of its descendants when it is added to the display list and becomes visible on-screen.

See Also:
Constant Field Values

REMOVED

public static final int REMOVED
Event type dispatched when a NestSprite is removed from its parent, via NestSprite.removeChild(com.transmote.nest.NestSprite).

See Also:
Constant Field Values

ERROR

public static final int ERROR
Event type dispatched when a caught error is handled within the Nest framework. NOTE: not currently used.

See Also:
Constant Field Values

INIT

public static final int INIT
Event type dispatched when a NestSprite is initialized, NOTE: not currently used.

See Also:
Constant Field Values
Constructor Detail

Event

public Event(int type)
A generic Nest event instance.

Parameters:
type - The event type.

Event

public Event(int type,
             boolean bubbles)
A generic Nest event instance.

Parameters:
type - The event type.
bubbles - Whether or not the event will bubble up the display list.
Method Detail

type

public int type()
The event type. Handlers should switch on this type to respond accordingly to the event.


bubbles

public boolean bubbles()
Specifies whether or not the event will bubble up the display list. Defaults to .


phase

public Event.PHASE phase()
Enumerated display list event phase. As an Event instance travels through the Nest display list, its phase changes. If the Event instance is not on the display list, phase is set to Event.PHASE.NOT_ON_DISPLAY_LIST.


target

public Object target()
If dispatched by an EventDispatcher, the EventDispatcher instance that dispatched this Event instance. Otherwise, the Object that dispatched this Event instance.


currentTarget

public EventDispatcher currentTarget()
The EventDispatcher currently processing this Event Instance.


processingEvent

public processing.event.Event processingEvent()
The Processing Event instance generated by Processing, if applicable (if this Event instance was generated in response to a mouse or keyboard action).


stopPropagation

public void stopPropagation()
Stop an Event instance traveling through the display list. Note: Unlike AS3, Nest does not offer a stopImmediatePropagation() method, as each node in the display list (e.g. each NestSprite instance) can only have one event handler.


isPropagationStopped

public boolean isPropagationStopped()
Returns true if stopPropagation() has been called. else, returns false.


toString

public String toString()
Overrides:
toString in class Object


Processing library Nest by Eric Socolofsky. (C) Eric Socolofsky 2011-2013