What is the smoothest (easy and good in design) way to refresh all data after some changed? I have an application, where may be opened multiple windows showing the same data. The user may edit one node in one of the windows, but I need to refresh that node (or its children) in every view.
Example: I have ExplorerView using the OutlineView in my TopComponent and it shows all Chapters in tree structure. But I can open this window many times (like "new window" in MS Word, which is another "view" on the same data). When I change the title of one chapter, I need to refresh it everywhere, where it is visible (in all expanded nodes).
I see one solution, but it has some pros and cons: Make my own lookup and store in it all opened root nodes of all opened ExplorerViews. Then on every edit, just cycle through all opened root nodes and call some method on them to recreate the viewed structure (call setChildren... like when showing for the first time). But the tree view collapses. And if I would create some mechanism, some my implementation of the OutlineView, which would remember all the expanded nodes, so it would recreate the expanded tree (but not the whole tree, only as it was), it might take some time, when having too much data, right?
Each view is built with a set of nodes. If you modify the data in one node then the modification is reflected in the view containing the node, but not in the other views (not the other nodes) :-(.
When I architect a NB RCP based application I build a model with "entities". These entities have "abilities" that I model with the NetBeans Lookup. These are usually plain POJOs.
Then when I want to "see" an entity I create a "Node" for it. You can have as many nodes you want (as many "MS Word" views as you want), but you want to keep a single "tree" with your model.
If I change a property in an "entity" this change is propagated to all the nodes listening to it. You may want to see how to relate 'abilities' with 'actions'.