• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Event handling

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rangers,
All my actions extend from following ExceptionHandledAction :

My actions implement the abstract processAction method.
Doing so, I never have to worry about catching exceptions. ExceptionHandledAction will take care of this.
Now, I wrote a DoubleClickTable that fires a DoubleClickEvent to DoubleClickListeners in case a user doubleclicks a tablerow in order to book a seat.
DoubleClickEvent extends EventObject and DoubleClickListener implements EventListener.
Since DoubleClickListener is not an Action I cannot fit my DoubleClick in the ExceptionHandled framework, so here I still have to deal with exception handling.
I'm trying to refactor things so that even my doubleClick event gets handled by the ExceptionHandled framework but I don't get it done.
Can any of you give me advice ?
Thanks.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see two workarounds:
* You can have a DoubleClickListener whose only purpose would be to translate DoubleClickEvents into ActionEvents and call your desired Action.
* I suppose your DoubleClickListener interface just have one method like
doubleClicked(DoubleClickEvent anEvent)
you could delete you DoubleClickListener and DoubleClickEvent classes and make you DoubleClickTable accept ActionListeners
addDoubleClickListener(ActionListener aCL)
This doesn't conforms with the JavaBeans naming convention but I don't find it important.

One more think: in your ExceptionHandledAction I would catch Throwable instead of Exception, just in case ...
 
Andrew Collins
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eduard,
In the mean time I implemented your first workaround myself. It feels good to see that someone else comes up with exact the same solution.
BTW, thanks for the Throwable advice.
reply
    Bookmark Topic Watch Topic
  • New Topic