org.openbp.jaspira.plugin
Class EventModule

java.lang.Object
  extended by org.openbp.jaspira.plugin.EventModule
All Implemented Interfaces:
JaspiraEventListener
Direct Known Subclasses:
AbstractPlugin.StandardPluginEvents, AbstractVisiblePlugin.StandardVisiblePluginEvents, ApplicationBase.CloseEvents, AssociationPlugin.AssociationEvents, ClipboardPlugin.Events, Cockpit.HelpEvents, ColorChooserPlugin.Events, DebuggerPlugin.ClientEvents, DebuggerPlugin.OptionEvents, DebuggerPlugin.ServerEvents, DecorationModule, DisplayObjectPlugin.Events, ErrorDialogPlugin.Events, ExternalAssociationPlugin.AssociationEvents, ExternalAssociationPlugin.ExternalAssociationEvents, ExternalEventModule, FinderPlugin.Events, FinderResultPlugin.Event, InfoPanelPlugin.Events, InspectorPlugin.ServerEvents, InteractionModule, ItemOpenDispatcherPlugin.Events, MiniViewPlugin.Events, ModelerPage.Events, ModelerUndoPlugin.Events, NodeItemEditorPlugin.Events, OptionMgr.Events, PropertyBrowserPlugin.Events, PropertyBrowserPlugin.SaveEvents, ServerConnectionPlugin.Events, SkinPlugin.SkinEvents, StackTracePlugin.ServerEvents, StatusBarPlugin.Events, ToolBoxPlugin.Events, VariablesPlugin.Events, VariablesPlugin.SaveEvents

public abstract class EventModule
extends java.lang.Object
implements JaspiraEventListener

A module is a group of event handlers for Jaspira events. Each module has a name which is the base name of all events it registers itself with. In order to activate a module, install () has to be called. This is usually done anonymously (new ModuleName ().install ()). A newly installed Module accepts only one event $MODULENAME.activate, which installs the other eventreaction methods. The names of receivable events are generated via introspection i.e. every public method that reveives a JaspiraEvent (or subclass) parameter and returns an Integer object is converted into a method receiver for "$MODULENAME.$Methodname". If the method name contains any underscore characters, they are converted into dots resulting in a noneNative event receiver WITHOUT prepending the Module-Name.
E.g.
public Integer model_model_selected (JaspiraEvent pe)
would be converted to a receiver for "model.model.selected". Note that while a method can be in mixed case, the resulting event will always be in lower case. Any event that is received but not dispatched to an eventHandler will be passed to handleUnaccountedEvent ().

Author:
Jens Ferchland

Field Summary
static JaspiraEventHandlerCode EVENT_CONSUMED
          Event handler return code: The Event was consumed.
static JaspiraEventHandlerCode EVENT_HANDLED
          Event handler return code: The Event was noted.
static JaspiraEventHandlerCode EVENT_IGNORED
          Event handler return code: The Event was ignored.
static int MODULE_POST_GLOBAL
          Denotes a module that is to be executed after actual event passing has ended
static int MODULE_PRE_GLOBAL
          Denotes a module that is to be executed before actual event passing begins
static int MODULE_TREE
          Denotes a module that is to be executed inside of the plugin tree.
 
Constructor Summary
EventModule()
          Create a new module.
 
Method Summary
 boolean eventFired(JaspiraEvent je)
          This method checks the incoming client event and forwards it to the corrresponding event handler method if there exists one.
 java.util.List getEventActionNames()
          Returns a list of names of event actions.
 java.util.List getForeignEventNames()
          Returns a list of the names of all foreign events that this module accepts.
 int getModuleType()
          The module type determines the way the events of this module are handled.
abstract  java.lang.String getName()
          The name of this module like "editor.file".
 int getPriority()
          Gets the module priority.
protected  JaspiraEventHandlerCode handleUnaccountedEvent(JaspiraEvent pe)
          This method is called when an event has been received that does not map to an event handler method of the module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODULE_TREE

public static final int MODULE_TREE
Denotes a module that is to be executed inside of the plugin tree.

See Also:
Constant Field Values

MODULE_PRE_GLOBAL

public static final int MODULE_PRE_GLOBAL
Denotes a module that is to be executed before actual event passing begins

See Also:
Constant Field Values

MODULE_POST_GLOBAL

public static final int MODULE_POST_GLOBAL
Denotes a module that is to be executed after actual event passing has ended

See Also:
Constant Field Values

EVENT_IGNORED

public static final JaspiraEventHandlerCode EVENT_IGNORED
Event handler return code: The Event was ignored.


EVENT_HANDLED

public static final JaspiraEventHandlerCode EVENT_HANDLED
Event handler return code: The Event was noted.


EVENT_CONSUMED

public static final JaspiraEventHandlerCode EVENT_CONSUMED
Event handler return code: The Event was consumed.

Constructor Detail

EventModule

public EventModule()
Create a new module.

Method Detail

getName

public abstract java.lang.String getName()
The name of this module like "editor.file". Decides which events will be received.


getForeignEventNames

public java.util.List getForeignEventNames()
Returns a list of the names of all foreign events that this module accepts.

Returns:
A list of strings or null if this module does not contain event handlers for foreign events

getEventActionNames

public java.util.List getEventActionNames()
Returns a list of names of event actions.

Returns:
A list of strings or null if this module does not contain action event handlers

getModuleType

public int getModuleType()
The module type determines the way the events of this module are handled.

Returns:
MODULE_TREE/MODULE_PRE_GLOBAL/MODULE_POST_GLOBAL

handleUnaccountedEvent

protected JaspiraEventHandlerCode handleUnaccountedEvent(JaspiraEvent pe)
This method is called when an event has been received that does not map to an event handler method of the module. Overwrite this if you want special functionality (i.e. react to events that are unknown at runtime).

Parameters:
pe - The client event
Returns:
The event status code (defaults to EVENT_IGNORED)

eventFired

public boolean eventFired(JaspiraEvent je)
This method checks the incoming client event and forwards it to the corrresponding event handler method if there exists one. Otherwise, the handleUnaccountedEvent(org.openbp.jaspira.event.JaspiraEvent) method will be called.

Specified by:
eventFired in interface JaspiraEventListener
Parameters:
je - The client event
Returns:
true The event has been consumed by an event handler.
false The event has not been consumed.

getPriority

public int getPriority()
Gets the module priority.

Specified by:
getPriority in interface JaspiraEventListener
Returns:
The standard implementation returns 50


Copyright © 2011. All Rights Reserved.