FireGlow
7 Jul 2009, 12:51 PM
Hey Guys!
I migrated my project vom 1.2.4. to 2.0 but I have a problem with the event system....
I tried to add the Events like this
registerEventTypes( new EventType(NUMBER_XYZ));
Then I fire a dispatch:
registerEventTypes(new EventType(NUMBER_XYZ));
But the canHandle()-method doesn't find the event (core-code) :
/**
* Determines if the controller can handle the particular event. Default
* implementation checks against registered event types then queries all child
* controllers.
*
* @param event the event
* @return <code>true</code> if event can be handled, <code>false</code>
* otherwise
*/
public boolean canHandle(AppEvent event) {
if (supportedEvents != null && supportedEvents.contains(event.getType()))
return true;
if (children != null) {
for (Controller c : children) {
if (c.canHandle(event)) return true;
}
}
return false;
}
And I know why:
supportedEvents.contains(event.getType()))
This code directly compares the 2 Objects and not the eventCodeNumbers()... because EventType doesn't implemented an own equal/compareTo-Method....
Am I Doing anything wrong? I don't want to create a class for every EventType....
I migrated my project vom 1.2.4. to 2.0 but I have a problem with the event system....
I tried to add the Events like this
registerEventTypes( new EventType(NUMBER_XYZ));
Then I fire a dispatch:
registerEventTypes(new EventType(NUMBER_XYZ));
But the canHandle()-method doesn't find the event (core-code) :
/**
* Determines if the controller can handle the particular event. Default
* implementation checks against registered event types then queries all child
* controllers.
*
* @param event the event
* @return <code>true</code> if event can be handled, <code>false</code>
* otherwise
*/
public boolean canHandle(AppEvent event) {
if (supportedEvents != null && supportedEvents.contains(event.getType()))
return true;
if (children != null) {
for (Controller c : children) {
if (c.canHandle(event)) return true;
}
}
return false;
}
And I know why:
supportedEvents.contains(event.getType()))
This code directly compares the 2 Objects and not the eventCodeNumbers()... because EventType doesn't implemented an own equal/compareTo-Method....
Am I Doing anything wrong? I don't want to create a class for every EventType....