Is it possible to apply the idea of filters to Swing event handlers? i.e. execute certain code before listnener code e.g. actionPerformed(ActionEvent event) and another piece of code after the listener has finished.
Not really. I mean, the only way you can capture an event is in the actionPerformed method. You can do whatever you want in that method. So you could say Do A, Then B, Then C, just like in any other method. Where A and C were your before and after events?
What exactly are you trying to do? Maybe that will help clarify and we can come up with a viable solution for you.
I'm looking for a way to insert services before and after events exactly like you would do for JSPs i.e. so i want to be know when my actionperformed method is going to be called and when it has been called.
the reason for not putting things in my actionperformed method is for the same as the reason you would use filters i.e. you don't want code that has nothing to do with the job of the servlet to clutter things in your doPost or doGet method
One way i could use is the awteventlistener which notifies you before an event is dispatched but i don't think there is any guarantee in the when the event will be dipatched after you've been notified. also there is nothing similar for when an event has been handled.
Originally posted by Ernest Friedman-Hill: I'm thinking you could use an AOP (aspect-oriented programming) tool like AspectJ to do this.
You know, I would have suggested that. But I have no idea what Aspect Oriented Programming is. Guess I should read up. Ahh, something else to put in my brain. I guess I'll have to see what knowledge is expendable.
Joined: Nov 02, 2003
Thanks. I'll have a look at AOP...
When does the learning stop and enjoying the fruits of ones labour start???