Another question I had is what strategies have you found useful in handling lots of events. I'm working on a fairly complicated swing application and we continue to add new events to the system. This ends up to the point where the user clicks one button and so many events start flying that it is hard to debug and begins to impact performance. How have you approached this problem?
posted 10 years ago
Events can be trick. One thing I like to do is have application level events so you separate out item loaded from say a mouse clicked event. This causes only the appropriate listeners to listen to the right things instead of having 100 different mouse listeners. Also it may be helpful to have levels of events so that all your events don't propogate everywhere. This usually ties in with some event consolidation logic that will collapse say the last 10 notifies down into one event if many are fired. I've also seen systems that intelligently figure out that events A+B are equivelant to event C and therefore collapse things that way as well.