|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.xoetrope.xui.XEventHandler
public class XEventHandler
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: 2.26 $
| Field Summary | |
|---|---|
protected static int |
changeCounter
A counter for changes to the registry. |
protected static java.util.Hashtable |
configFiles
The config files used to build the set of component adapters. |
protected java.lang.Object |
container
The page or object whose event is being handled |
protected static java.util.EventObject |
currentEvt
The current event, valid until processed |
protected XProject |
currentProject
The current project, the project that ultimately owns this event handler |
protected java.util.Hashtable |
handlers
The collection of event handlers that are known |
protected static int |
localChangeCounter
Used for tracking changes to the registry spec. |
protected java.lang.Object |
mouseDownComponent
The component that owned the mouse pressed event |
protected boolean |
mouseEventInvoked
A flagh indicating if the mouse event has been invoked yet |
protected static java.util.Hashtable |
registrations
The collection of registered event handlers that are known |
protected int |
suppressFocusEvents
A flag to dictate how focus event are processed in the event of a message display |
protected XValidationHandler |
xValidationHandler
The validation handler |
| Constructor Summary | |
|---|---|
XEventHandler(XProject project,
java.lang.Object c,
XValidationHandler vh)
Create an event handler |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Adds the specified action listener to receive action events from this button. |
static void |
addConfigFile(java.lang.String key,
java.lang.Object resource,
boolean overwrite)
Add a configuration file. |
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. |
void |
checkRegistration()
Check that all the registered components are loaded |
protected void |
doRead(java.lang.String key,
java.lang.Object configFile)
Read the component registry. |
protected void |
doRead(java.lang.String key,
java.lang.String configFile)
Read the component registry. |
protected void |
doRead(java.lang.String key,
java.net.URL configFileURL)
Read the component registry. |
java.lang.reflect.Method |
findEvent(java.lang.Object src,
long eventType)
Lookup an event for a component. |
void |
focusGained(java.awt.event.FocusEvent e)
This event indicates that the Component is now the focus owner. |
void |
focusLost(java.awt.event.FocusEvent e)
This event indicates that the Component is no longer the focus owner. |
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 |
itemStateChanged(java.awt.event.ItemEvent e)
This event indicates that an item's state changed. |
void |
keyPressed(java.awt.event.KeyEvent e)
A key has been pressed |
void |
keyReleased(java.awt.event.KeyEvent e)
A key has been released |
void |
keyTyped(java.awt.event.KeyEvent e)
A key was types |
void |
mouseClicked(java.awt.event.MouseEvent e)
The mouse was clicked |
void |
mouseDragged(java.awt.event.MouseEvent e)
The mouse was dragged |
void |
mouseEntered(java.awt.event.MouseEvent e)
The mouse has been moved over the component |
void |
mouseExited(java.awt.event.MouseEvent e)
The mouse has moved beyond the bounds of the component |
void |
mouseMoved(java.awt.event.MouseEvent e)
The mouse has moved |
void |
mousePressed(java.awt.event.MouseEvent e)
The mouse button has been pressed |
void |
mouseReleased(java.awt.event.MouseEvent e)
The mouse button has been released |
protected void |
read()
Read the component registry. |
void |
read(java.lang.String key,
java.io.Reader reader)
Read the component registry. |
protected void |
read(java.lang.String key,
java.lang.String configFile)
Read the component registry. |
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. |
void |
textValueChanged(java.awt.event.TextEvent e)
This event indicates that object's text changed. |
void |
updateConfig()
Signal that the configuration has been updated. |
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.Hashtable configFiles
protected static int changeCounter
protected static int localChangeCounter
protected static java.util.Hashtable registrations
protected static java.util.EventObject currentEvt
protected java.lang.Object container
protected XProject currentProject
protected java.util.Hashtable handlers
protected java.lang.Object mouseDownComponent
protected boolean mouseEventInvoked
protected int suppressFocusEvents
protected XValidationHandler xValidationHandler
| Constructor Detail |
|---|
public XEventHandler(XProject project,
java.lang.Object c,
XValidationHandler vh)
project - the owner projectc - the container/pagevh - the validation handler| Method Detail |
|---|
public void removeHandlers(java.lang.Object comp)
removeHandlers in interface XuiEventHandlercomp - the object whose events are being removedpublic 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 XuiEventHandlersrc - the event source componenteventType - the event type
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 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 pointer
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 boolean wasMouseClicked()
wasMouseClicked in interface XuiEventHandlerpublic boolean wasMouseDoubleClicked()
wasMouseDoubleClicked in interface XuiEventHandlerpublic boolean wasMouseRightClicked()
wasMouseRightClicked in interface XuiEventHandlerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - the eventpublic void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenere - the eventpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenere - the eventpublic void textValueChanged(java.awt.event.TextEvent e)
textValueChanged in interface java.awt.event.TextListenere - the eventpublic void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged in interface java.awt.event.ItemListenere - the eventpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenere - the eventpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenere - the eventpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenere - the eventpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenere - the eventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenere - the eventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenere - the eventpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - the eventpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenere - the eventpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenere - the eventpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - the eventpublic 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
public static void addConfigFile(java.lang.String key,
java.lang.Object resource,
boolean overwrite)
key - the name by which the configuration file is referencedresource - the name/path of the configuration file or the URL for the fileoverwrite - true to overwrite and existing entry matching the specified keypublic void updateConfig()
protected void read()
protected void read(java.lang.String key,
java.lang.String configFile)
configFile - the name of the configuration filekey - the name by which the configuration file is referenced
protected void doRead(java.lang.String key,
java.lang.Object configFile)
configFile - the name of the configuration filekey - the name by which the configuration file is referenced
protected void doRead(java.lang.String key,
java.lang.String configFile)
configFile - the name of the configuration filekey - the name by which the configuration file is referenced
protected void doRead(java.lang.String key,
java.net.URL configFileURL)
configFileURL - the URL of the configuration filekey - the name by which the configuration file is referenced
public void read(java.lang.String key,
java.io.Reader reader)
key - the name by which the configuration file is referencedreader - the reader from which to read the filepublic void checkRegistration()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||