XEventRegistration er = (XEventRegistration)registrations.get( typeStr );
if ( er != null ) {
if ( typeStr.indexOf( '.' ) > 0 ) {
try {
XEventAdapter xea = (XEventAdapter)Class.forName( er.interfaceName.trim()).newInstance();
xea.setEventHandler( this );
addHandler( targetComp, methodName, xea.getAddMethodName(), xea.getListenerInterfaceName(), xea.getEventMask(), xea );
return;
}
catch ( Exception ex ) {
ex.printStackTrace();
}
}
String adder = "add" + er.interfaceName.substring( er.interfaceName.lastIndexOf( '.' ) + 1 );
addHandler( targetComp, methodName, adder, er.interfaceName, er.mask, this );
return;
}
//
// String adderMethod;
// String ifaceName;
// long mask;
// String types[] = { "MouseHandler", "MouseMotionHandler", "ActionHandler", "FocusHandler", "ItemHandler", "KeyHandler", "TextHandler", "MenuHandler" };
// String iface[] = { "java.awt.event.MouseListener", "java.awt.event.MouseMotionListener", "java.awt.event.ActionListener", "java.awt.event.FocusListener",
// "java.awt.event.ItemListener", "java.awt.event.KeyListener", "java.awt.event.TextListener", "java.awt.event.ActionListener" };
// long masks[] = { AWTEvent.MOUSE_EVENT_MASK, AWTEvent.MOUSE_MOTION_EVENT_MASK, AWTEvent.ACTION_EVENT_MASK, AWTEvent.FOCUS_EVENT_MASK,
// AWTEvent.ITEM_EVENT_MASK, AWTEvent.KEY_EVENT_MASK, AWTEvent.TEXT_EVENT_MASK, AWTEvent.ACTION_EVENT_MASK };
// for ( int i = 0; i < types.length; i++ ) {
// if ( typeStr.equals( types[ i ] )) {
// String adder = "add" + iface[ i ].substring( iface[ i ].lastIndexOf( '.' ) + 1 );
// addHandler( targetComp, methodName, adder, iface[ i ], masks[ i ], this );
// return;
// }
// }
//
/**
* @todo handle this in a more generic way
*/
// if ( targetComp.getClass().getName().indexOf( "Button" ) > -1 )
// WidgetAdapter.getInstance().setCursor( targetComp, XPageHelper.hand );
if ( typeStr.indexOf( '.' ) > 0 ) {
try {
XEventAdapter xea = (XEventAdapter)Class.forName( typeStr.trim()).newInstance();
xea.setEventHandler( this );
addHandler( targetComp, methodName, xea.getAddMethodName(), xea.getListenerInterfaceName(), xea.getEventMask(), xea );
}
catch ( Exception ex ) {
ex.printStackTrace();
}
}