How to respond to a filter change by the user

(I’m not sure if this belongs in the Filtering Table Addon thread, but here goes.)

I’m using the Addon Filter Table which gives the user a GUI component to filter by attached to a table property (column). I want to do something (recalculate totals) when the user changes any filter. Do filters send a “filter changed” event? If they do, how would I listen for that? If they don’t, what would you suggest I do?


yes, this is possible. Please look at the interface org.tepi.filtertable.FilterGenerator. You can implement that and add it to your FilterTable via the setFilterGenerator(…) method. After that you will have the filterAdded(…) and filterRemoved(…) methods called at corresponding events.

One thing to note is that if the user changes the filter value (e.g . textfield content from “foo” to “foobar”) you will only receive a call to the filterAdded(…) method, while in reality the previous filter is removed from the container and a new one is added. This is done to keep things simple, and anyway FilterTable will only apply one filter at a time per property.


I’m halfway there. I’ve implemented FilterGenerator and and done a setFilterGenerator() in my table. Now where do I have filterAdded() and filterRemoved()?

Those two methods are defined in the FilterGenerator interface. If you implement that you should get method stubs for them in your implementation class. Don’t you get them?

Here’s a
link to the source code
of the FilterGenerator interface, you can see them there.