I am not aware of anything within Pivot that covers this sort of thing, but you might find some of the Component Explorer tutorial source code useful. Specifically the use of proxies for 'dynamic' notification & filtering of events in the org.apache.pivot.tutorials.explorer.tools.EventLogger class.
A similar approach might work for you depending on your definition of dirty. You would need Pivot to provide events that cover every possible 'mutation' of your data model (assuming that is what you mean by dirty). If the events do not exist, I think you would have to create your own event(s) for each Component, although I suppose you could wrap the entire Component in a proxy and use that to intercept the calls to its 'mutating' methods.
While an event/notification based solution is probably cleaner, you might also consider polling the target Components' state and comparing to a known 'clean' state. Something like this might be workable if the Components are only every manually changed (and therefore made dirty) and you track and monitor the focused Component for changes (and/or maybe track mouse position / mouseover)
Finally, BeanAdapter and BeanMonitor might also be useful at some point.
On 4 June 2011 05:32, Edvin Syse <firstname.lastname@example.org>
I have a toolbar with a global Save-button that I would like to enable only when I detect one or more components that are dirty within the active "editor". The editor is just a component that contains other components, mostly inside a Form.
I'm thinking about traversing the component hiararchy in my "editor", and adding listeners for all components like for example TextInputContentListener for TextInput fields and ListButtonSelectionListener for ListButton etc.
Is there something in the framework I can use to achieve this?