| Author |
Filters
|
Eddie Long
Ranch Hand
Joined: Nov 02, 2003
Posts: 69
|
|
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. Thanks in advance
|
...and so help me God.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
|
Moved to Swing.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
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.
|
 |
Eddie Long
Ranch Hand
Joined: Nov 02, 2003
Posts: 69
|
|
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.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
|
I'm thinking you could use an AOP (aspect-oriented programming) tool like AspectJ to do this.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
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.
|
 |
Eddie Long
Ranch Hand
Joined: Nov 02, 2003
Posts: 69
|
|
Thanks. I'll have a look at AOP... When does the learning stop and enjoying the fruits of ones labour start???
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Originally posted by Eddie Long: Thanks. I'll have a look at AOP... When does the learning stop and enjoying the fruits of ones labour start???
You know that instant when you are just about to die and you see your life pass before your eyes? That's when.
|
 |
 |
|
|
subject: Filters
|
|
|