org.openbp.jaspira.event
Class JaspiraEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.openbp.jaspira.event.JaspiraEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AskEvent, BreakoutEvent, DebuggerServerEvent, ErrorEvent, InteractionEvent, ItemEvent, JaspiraActionEvent, KeySequenceEvent, MiniViewEvent, ModelEvent, OpenEvent, PropertyBrowserSaveEvent, PropertyBrowserSetEvent, QualifierEvent, RequestEvent, StackActionEvent, StatusBarComponentEvent, StatusBarTextEvent, VetoableEvent

public class JaspiraEvent
extends java.util.EventObject

A client event represents a high level event in the Jaspira framework. It contains Informations about the source, kind of event and if possible the original event created by a java component.

Author:
Jens Ferchland
See Also:
Serialized Form

Field Summary
static int CONSUMED
          Event status flag: The event has been consumed by a listener
static int HANDELED
          Event status flag: The event has been handled by at least one listener
static int STACKABLE
          Event flag: The event can be stacked with events of the same type.
static int TYPE_BOTTOM_UP
          Event type: Bottom up event (passed from child to parent)
static int TYPE_DIRECT
          Event type: Handle by target plugin only (does not get passed to other plugins)
static int TYPE_FLOOD
          Event type: Flood event (passed to all children, then to parent - the most common event type)
static int TYPE_GLOBAL
          Event type: Global event, passed only to the JaspiraEventMgr
static int UNCONSUMABLE
          Event flag: An unconsumable event that can't be consumed by a listener
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
JaspiraEvent(Plugin source, java.lang.String eventName)
          Creates a standard event with no data object, flood passing mode, application level and no flags.
JaspiraEvent(Plugin source, java.lang.String eventName, int type, int level)
          Creates an event with the given level and type and no data object.
JaspiraEvent(Plugin source, java.lang.String eventName, java.lang.Object object)
          Creates an application wide flood event with the given data object.
JaspiraEvent(Plugin source, java.lang.String eventName, java.lang.Object object, int type, int level)
          Creates an event with the given level, type and data object.
JaspiraEvent(Plugin source, java.lang.String eventName, java.lang.Object object, int type, int level, int flags)
          Creates a new event with all possible parameters.
 
Method Summary
 void brand(Plugin brand)
          Sets the brand.
 Plugin getBrand()
          Gets the brand.
 java.lang.String getEventGroup()
          Returns the event group.
 java.lang.String getEventName()
          Gets event name.
 int getFlags()
          Gets the event flags.
 int getLevel()
          Returns the propagation level up to which this event is to be passed.
 java.lang.Object getObject()
          Gets the event object.
 java.util.EventObject getOriginalEvent()
          Gets the original event.
 Plugin getSourcePlugin()
          Gets source plug in.
 java.lang.String getTargetClassName()
          Gets the classs name of possible receivers of this event.
 java.lang.String getTargetPluginId()
          Gets the plugin id of the receiver plugin of this event.
 int getType()
          Returns the event type.
 boolean isConsumed()
          Checks if the event has been consumed by a listener.
 boolean isStackable()
          Checks if the event can be stacked.
 boolean isUnconsumable()
          Checks if the event is unconsumable.
 void setObject(java.lang.Object object)
          Sets the event object.
 void setTargetClassName(java.lang.String targetClassName)
          Sets the classs name of possible receivers of this event.
 void setTargetPluginId(java.lang.String targetPluginId)
          Sets the plugin id of the receiver plugin of this event.
 java.lang.String toString()
          Returns a String which describes the object.
 void updateFlags(int flag)
          Updates the event flags.
 boolean updateFlags(JaspiraEventHandlerCode returnCode)
          Updates the event flags using the given module event handler return code.
 
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

TYPE_DIRECT

public static final int TYPE_DIRECT
Event type: Handle by target plugin only (does not get passed to other plugins)

See Also:
Constant Field Values

TYPE_BOTTOM_UP

public static final int TYPE_BOTTOM_UP
Event type: Bottom up event (passed from child to parent)

See Also:
Constant Field Values

TYPE_FLOOD

public static final int TYPE_FLOOD
Event type: Flood event (passed to all children, then to parent - the most common event type)

See Also:
Constant Field Values

TYPE_GLOBAL

public static final int TYPE_GLOBAL
Event type: Global event, passed only to the JaspiraEventMgr

See Also:
Constant Field Values

UNCONSUMABLE

public static final int UNCONSUMABLE
Event flag: An unconsumable event that can't be consumed by a listener

See Also:
Constant Field Values

STACKABLE

public static final int STACKABLE
Event flag: The event can be stacked with events of the same type. Only the most recent event of this type will be kept and will be executed by the Swing event queue. A typical example is the global.environment.update event.

See Also:
Constant Field Values

CONSUMED

public static final int CONSUMED
Event status flag: The event has been consumed by a listener

See Also:
Constant Field Values

HANDELED

public static final int HANDELED
Event status flag: The event has been handled by at least one listener

See Also:
Constant Field Values
Constructor Detail

JaspiraEvent

public JaspiraEvent(Plugin source,
                    java.lang.String eventName,
                    java.lang.Object object,
                    int type,
                    int level,
                    int flags)
Creates a new event with all possible parameters. Usually it will be sufficient to use one of the shorter constructors below.

Parameters:
source - The plugin that dispatches this event. Must not be null. Will be converted to lower case.
eventName - The name of the event
object - An additional data object. Can be null.
type - The type of the event (i\.e\. the mode of passing the event).
level - The top level for passing of this event
flags - Flags for this event

JaspiraEvent

public JaspiraEvent(Plugin source,
                    java.lang.String eventName)
Creates a standard event with no data object, flood passing mode, application level and no flags.


JaspiraEvent

public JaspiraEvent(Plugin source,
                    java.lang.String eventName,
                    java.lang.Object object)
Creates an application wide flood event with the given data object.


JaspiraEvent

public JaspiraEvent(Plugin source,
                    java.lang.String eventName,
                    int type,
                    int level)
Creates an event with the given level and type and no data object.


JaspiraEvent

public JaspiraEvent(Plugin source,
                    java.lang.String eventName,
                    java.lang.Object object,
                    int type,
                    int level)
Creates an event with the given level, type and data object.

Method Detail

getOriginalEvent

public java.util.EventObject getOriginalEvent()
Gets the original event.

Returns:
The original event object (e.g. SelectionEvent, ActionEvent, ListChangedEvent, ...) if there is one or null

getSourcePlugin

public Plugin getSourcePlugin()
Gets source plug in.


getEventName

public java.lang.String getEventName()
Gets event name.


getFlags

public int getFlags()
Gets the event flags.


isUnconsumable

public boolean isUnconsumable()
Checks if the event is unconsumable. An unconsumable event that can't be consumed by a listener.


isConsumed

public boolean isConsumed()
Checks if the event has been consumed by a listener.


isStackable

public boolean isStackable()
Checks if the event can be stacked. A stackable event can be stacked with events of the same type. Only the most recent event of this type will be kept and will be executed by the Swing event queue. A typical example is the global.environment.update event.


updateFlags

public void updateFlags(int flag)
Updates the event flags.

Parameters:
flag - Flag bits to set

updateFlags

public boolean updateFlags(JaspiraEventHandlerCode returnCode)
Updates the event flags using the given module event handler return code.

Parameters:
returnCode - Event handler return code (EventModule.EVENT_HANDLED/EventModule.EVENT_IGNORED/EventModule.EVENT_CONSUMED)
Returns:
true The event has been consumed false The event is not consumed yet

getType

public int getType()
Returns the event type.

Returns:
TYPE_DIRECT/TYPE_BOTTOM_UP/TYPE_FLOOD/TYPE_GLOBAL

getLevel

public int getLevel()
Returns the propagation level up to which this event is to be passed.

Returns:
Plugin.LEVEL_APPLICATION/Plugin.LEVEL_FRAME/ Plugin.LEVEL_PAGE/Plugin.LEVEL_PLUGIN

getObject

public java.lang.Object getObject()
Gets the event object.

Returns:
The object to pass along with this event or null

setObject

public void setObject(java.lang.Object object)
Sets the event object.

Parameters:
object - The object to pass along with this event or null

getTargetClassName

public java.lang.String getTargetClassName()
Gets the classs name of possible receivers of this event.

Returns:
The class name or null if the event is not directed to a particular type of plugin

setTargetClassName

public void setTargetClassName(java.lang.String targetClassName)
Sets the classs name of possible receivers of this event.

Parameters:
targetClassName - The class name or null if the event is not directed to a particular type of plugin

getTargetPluginId

public java.lang.String getTargetPluginId()
Gets the plugin id of the receiver plugin of this event.

Returns:
The plugin id or null if the event is not directed to a particular plugin

setTargetPluginId

public void setTargetPluginId(java.lang.String targetPluginId)
Sets the plugin id of the receiver plugin of this event.

Parameters:
targetPluginId - The plugin id or null if the event is not directed to a particular plugin

toString

public java.lang.String toString()
Returns a String which describes the object.

Overrides:
toString in class java.util.EventObject

getBrand

public Plugin getBrand()
Gets the brand. Used to mark passed paths during event processing.


brand

public void brand(Plugin brand)
Sets the brand. Used to mark passed paths during event processing.


getEventGroup

public java.lang.String getEventGroup()
Returns the event group.

Returns:
The event name minus the last element


Copyright © 2011. All Rights Reserved.