net.xoetrope.xui.events
Interface XuiEventHandler

All Known Implementing Classes:
XEventHandler, XSwtEventHandler

public interface XuiEventHandler

Specifies an event handler for XUI. Most of the common events are handled. The class's implementations are intended as a mixin for a panel class such as XPage and should not be used directly

Copyright (c) Xoetrope Ltd., 2002-2003

License: see license.txt

$Revision: 1.7 $


Method Summary
 void addActionHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for action events
 void addFocusHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for focus events
 XMethodReference addHandler(java.lang.Object comp, long eventType, java.lang.String methodName)
          Adds an event handler.
 XMethodReference addHandler(java.lang.Object srcObj, java.lang.String methodName, java.lang.String adderMethod, java.lang.String listenerInterface, long eventMask, java.lang.Object listener)
          Adds a handler for action events
 void addItemHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for item events
 void addKeyHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for key events
 void addListener(java.lang.Object comp, java.lang.String listenerName, java.lang.String argType, java.lang.Object listener)
          Adds a listener for an event type.
 void addMenuHandler(java.lang.Object menuItem, java.lang.String methodName)
          Adds a handler for action events
 void addMouseHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for mouse events
 void addMouseMotionHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for mouse motion events
 void addTextHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for text events
 java.lang.reflect.Method findEvent(java.lang.Object src, long eventType)
          Lookup an event for a component.
 java.util.EventObject getCurrentEvent()
          Get the current event
 XValidationHandler getValidationHandler()
          Get the validation handler reference.
 void invoke(long eventType, java.util.EventObject evt)
          Invokes an event.
 boolean isFocusChangeSuppressed()
          Check the focus change status
 void removeHandlers(java.lang.Object comp)
          Remove all the event handlers for a particular object
 void suppressFocusEvents(boolean suppress)
          Used by messageboxes and other dialogs to prevent the display of the dialog causing extra focus events from being fired.
 boolean wasMouseClicked()
          A utility method used to determine if the last event corrseponds to a mouse click.
 boolean wasMouseDoubleClicked()
          A utility method used to determine if the last event corrseponds to a mouse double click.
 boolean wasMouseRightClicked()
          A utility method used to determine if the last event corrseponds to a mouse right click.
 

Method Detail

getValidationHandler

XValidationHandler getValidationHandler()
Get the validation handler reference. Note that the caller should not hold a reference to this value as it will probably cause a memory leak.

Returns:
the current validation handler

invoke

void invoke(long eventType,
            java.util.EventObject evt)
Invokes an event. Called in response to an event. If a handler has been added for the event it will be invoked.

Parameters:
eventType - the event type
evt - the event object

removeHandlers

void removeHandlers(java.lang.Object comp)
Remove all the event handlers for a particular object

Parameters:
comp - the object whose events are being removed

addHandler

XMethodReference addHandler(java.lang.Object comp,
                            long eventType,
                            java.lang.String methodName)
                            throws java.lang.ClassNotFoundException,
                                   java.lang.NoSuchMethodException
Adds an event handler. A specific handler such as the addActionHandler should be used instead of calling this method

Parameters:
eventType - long value indicating the mask of the event to be handled
comp - the component that fires the event
methodName - the method to be invoked in response to the object
Throws:
java.lang.ClassNotFoundException - throw if the class cannot be located
java.lang.NoSuchMethodException - throw if the named method cannot be located

addHandler

XMethodReference addHandler(java.lang.Object srcObj,
                            java.lang.String methodName,
                            java.lang.String adderMethod,
                            java.lang.String listenerInterface,
                            long eventMask,
                            java.lang.Object listener)
Adds a handler for action events

Parameters:
srcObj - the menu item that fires the events
methodName - the method to be invoked in response to the action event
adderMethod - the adder method name e.g. addActionListener
listenerInterface - the listener interface e.g. java.awt.event.ActionListener
eventMask - the event mask e.g. AWTEvent.ACTION_EVENT_MASK
listener - the listener implementation, usually the page's this pointer
See Also:
ActionListener, ActionEvent

addListener

void addListener(java.lang.Object comp,
                 java.lang.String listenerName,
                 java.lang.String argType,
                 java.lang.Object listener)
Adds a listener for an event type. This method should not normally be called by an application

Parameters:
comp - the component that fires events
listenerName - the name of the listener interface
argType - the listener arguments
listener - the listener implementation, usually the page's this pointer

addMenuHandler

void addMenuHandler(java.lang.Object menuItem,
                    java.lang.String methodName)
Adds a handler for action events

Parameters:
menuItem - the menu item that fires the events
methodName - the method to be invoked in response to the action event
See Also:
ActionListener, ActionEvent

addActionHandler

void addActionHandler(java.lang.Object comp,
                      java.lang.String methodName)
Adds a handler for action events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the action event
See Also:
ActionListener, ActionEvent

addFocusHandler

void addFocusHandler(java.lang.Object comp,
                     java.lang.String methodName)
Adds a handler for focus events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the focus event
See Also:
FocusListener, FocusEvent

addTextHandler

void addTextHandler(java.lang.Object comp,
                    java.lang.String methodName)
Adds a handler for text events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the text event
See Also:
TextListener, TextEvent

addItemHandler

void addItemHandler(java.lang.Object comp,
                    java.lang.String methodName)
Adds a handler for item events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the item event
See Also:
ItemListener, ItemEvent

addKeyHandler

void addKeyHandler(java.lang.Object comp,
                   java.lang.String methodName)
Adds a handler for key events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the key event
See Also:
KeyListener, KeyEvent

addMouseHandler

void addMouseHandler(java.lang.Object comp,
                     java.lang.String methodName)
Adds a handler for mouse events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the mouse event
See Also:
MouseMotionListener, MouseEvent

addMouseMotionHandler

void addMouseMotionHandler(java.lang.Object comp,
                           java.lang.String methodName)
Adds a handler for mouse motion events

Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the mouse event
See Also:
MouseMotionListener, MouseEvent

wasMouseClicked

boolean wasMouseClicked()
A utility method used to determine if the last event corrseponds to a mouse click. The notion of a click is extended by assuming the a mouse press and release within a single component constitutes a click even if not at the same coordinate. A MouseEvent.MOUSE_CLICKED is only triggered when the press and release are at the same location and this is often inadequate for end-user interaction.

Returns:
true if the mouse was clicked

wasMouseDoubleClicked

boolean wasMouseDoubleClicked()
A utility method used to determine if the last event corrseponds to a mouse double click. The notion of a click is extended by assuming the a mouse press and release within a single component constitutes a click even if not at the same coordinate. A MouseEvent.MOUSE_CLICKED is only triggered when the press and release are at the same location and this is often inadequate for end-user interaction.

Returns:
true if the mouse was double clicked

wasMouseRightClicked

boolean wasMouseRightClicked()
A utility method used to determine if the last event corrseponds to a mouse right click. The notion of a click is extended by assuming the a mouse press and release within a single component constitutes a click even if not at the same coordinate. A MouseEvent.MOUSE_CLICKED is only triggered when the press and release are at the same location and this is often inadequate for end-user interaction.

Returns:
true if the mouse was right clicked

getCurrentEvent

java.util.EventObject getCurrentEvent()
Get the current event

Returns:
the AWTEvent that was last triggered

isFocusChangeSuppressed

boolean isFocusChangeSuppressed()
Check the focus change status

Returns:
true if the focus change events are being suppressed.

suppressFocusEvents

void suppressFocusEvents(boolean suppress)
Used by messageboxes and other dialogs to prevent the display of the dialog causing extra focus events from being fired.

Parameters:
suppress - true to suppress focus events

findEvent

java.lang.reflect.Method findEvent(java.lang.Object src,
                                   long eventType)
Lookup an event for a component.

Parameters:
src - The Object which contains the event
eventType - The id of the event required
Returns:
The Method object