|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.xoetrope.html.XHtmlEventHandler
public class XHtmlEventHandler
Implements an event handler for XUI. Most of the common events are handled. The class is 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.2 $
| Field Summary | |
|---|---|
protected java.util.Hashtable |
classInstances
|
protected java.lang.Object |
container
|
protected static java.util.EventObject |
currentEvt
|
protected XProject |
currentProject
|
protected java.util.Hashtable |
handlers
|
protected static java.lang.Object |
mouseDownComponent
|
protected static boolean |
mouseEventInvoked
|
protected static int |
suppressFocusEvents
|
protected XValidationHandler |
xValidationHandler
|
| Constructor Summary | |
|---|---|
XHtmlEventHandler(XProject project,
java.lang.Object c,
XValidationHandler vh)
|
|
| Method Summary | |
|---|---|
XMethodReference |
addHandler(java.lang.Object comp,
long eventType,
java.lang.String methodStr)
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 |
addHandler(PageSupport xpage,
java.lang.Object targetComp,
java.lang.String typeStr,
java.lang.String methodName)
Adds an event handler. |
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. |
java.lang.reflect.Method |
findEvent(java.lang.Object src,
long eventType)
Lookup an event for a component. |
void |
focusGained(java.awt.event.FocusEvent e)
|
void |
focusLost(java.awt.event.FocusEvent e)
|
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 |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDoubleClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseHover(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static java.util.EventObject currentEvt
protected java.lang.Object container
protected XProject currentProject
protected java.util.Hashtable handlers
protected java.util.Hashtable classInstances
protected static java.lang.Object mouseDownComponent
protected static boolean mouseEventInvoked
protected static int suppressFocusEvents
protected XValidationHandler xValidationHandler
| Constructor Detail |
|---|
public XHtmlEventHandler(XProject project,
java.lang.Object c,
XValidationHandler vh)
| Method Detail |
|---|
public XValidationHandler getValidationHandler()
getValidationHandler in interface XuiEventHandler
public void invoke(long eventType,
java.util.EventObject evt)
invoke in interface XuiEventHandlereventType - the event typeevt - the event object
public java.lang.reflect.Method findEvent(java.lang.Object src,
long eventType)
findEvent in interface XuiEventHandlerevt - the event object
public boolean isFocusChangeSuppressed()
isFocusChangeSuppressed in interface XuiEventHandlerpublic java.util.EventObject getCurrentEvent()
getCurrentEvent in interface XuiEventHandler
public XMethodReference addHandler(java.lang.Object comp,
long eventType,
java.lang.String methodStr)
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
The handler can also be defined in classes other than the current page or classes derived from XPage. The syntax for such expressions is as follows:
mypackage.MyClass[referenceName].myMethod for a named
object instancemypackage.MyClass[].myMethod to create a new instance
of the class on each evaluationmypackage.MyClass.myMethod to invoke a static methodmyMethod[referenceName] for a method contained with the
invoking pagewhere mypackage is the name of the Java package containing the class MyClass. The value of referenceName is a user defined value that identifies the instance of the class. The application instantiates an instance of the class when the expression is first encountered and thereafter maintains the instance with each subsequent call retrieving the same instance of the class.
The page may also reference scripts with the expression
${script.XXXXX()} where XXXXX is the name of
the script method to be invoked.
addHandler in interface XuiEventHandlereventType - the event typemethodStr - the method to be invoked in response to the objectcomp - the component that fires the event
java.lang.ClassNotFoundException - The class cannot be found
java.lang.NoSuchMethodException - The specified method does not exist in the class
public XMethodReference addHandler(java.lang.Object srcObj,
java.lang.String methodName,
java.lang.String adderMethod,
java.lang.String listenerInterface,
long eventMask,
java.lang.Object listener)
addHandler in interface XuiEventHandlersrcObj - the menu item that fires the eventsmethodName - the method to be invoked in response to the action eventadderMethod - the adder method name e.g. addActionListenerlistenerInterface - the listener interface e.g. java.awt.event.ActionListenereventMask - the event mask e.g. AWTEvent.ACTION_EVENT_MASKlistener - the listener implementation, usually the page's this pointerActionListener,
ActionEventpublic void removeHandlers(java.lang.Object comp)
removeHandlers in interface XuiEventHandlercomp - the object whose events are being removed
public void addListener(java.lang.Object comp,
java.lang.String listenerName,
java.lang.String argType,
java.lang.Object listener)
addListener in interface XuiEventHandlercomp - the component that fires eventslistenerName - the name of the listener interfaceargType - the listener argumentslistener - the listener implementation, usually the page's this pointerpublic boolean wasMouseClicked()
wasMouseClicked in interface XuiEventHandlerpublic boolean wasMouseDoubleClicked()
wasMouseDoubleClicked in interface XuiEventHandlerpublic boolean wasMouseRightClicked()
wasMouseRightClicked in interface XuiEventHandlerpublic void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenerpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseDoubleClicked(java.awt.event.MouseEvent e)
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseHover(java.awt.event.MouseEvent e)
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void suppressFocusEvents(boolean suppress)
suppressFocusEvents in interface XuiEventHandlersuppress - true to suppress focus events
public void addHandler(PageSupport xpage,
java.lang.Object targetComp,
java.lang.String typeStr,
java.lang.String methodName)
addHandler in interface XuiEventHandlerxpage - The page that contains the response methodstargetComp - the component to which the event handler is addedtypeStr - the type of handlermethodName - the name of the response method
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||