TreeTableRidget: Bind model to modifiable value [message #538670] |
Tue, 08 June 2010 07:40  |
Eclipse User |
|
|
|
Hi,
i need to bind a TreeTableRidget to a global modifiable value. So far changes on that value doesn't force a change in the TreeTable automatically. Only if reassign the binding after the value has changed, the TreeTable displays the new value.
Isn't there a way to bind the TreeTableRidget to an modifiable value like e.g. ITableRidget.bindToModel(IObservableList, ...)?
thanks, matthias
|
|
|
|
|
|
|
|
Re: TreeTableRidget: Bind model to modifiable value [message #539952 is a reply to message #539663] |
Mon, 14 June 2010 07:40  |
Eclipse User |
|
|
|
Meanwhile i came to the same solution. I work with ExtendedTreeNodes which holds a reference to my value object. In a PropertyChangeListener i call:
public void propertyChange(PropertyChangeEvent evt) {
updateRoot((ExtendedTreeNode) input[0]);
tree.updateFromModel();
}
private void updateRoot(ExtendedTreeNode rootNode){
MyVal mv = ValueManager.getInstance().getValue();
rootNode.setReference(mv);
}
this works, thanks
|
|
|
Re: TreeTableRidget: Bind model to modifiable value [message #585739 is a reply to message #538683] |
Tue, 08 June 2010 09:11  |
Eclipse User |
|
|
|
then i did something wrong with the binding:
input = createInput();
tree.bindToModel(input, MyTreeNode.class, MyTreeNode.PROPERTY_CHILDREN, MyTreeNode.PROPERTY_PARENT, columnPropertyNames, columnHeaders);
The thing is that createInput() creates a new array of TreeNodes out of my model structure. And because this new array has another id, it can't be bound. Am i right?
|
|
|
|
|
Re: TreeTableRidget: Bind model to modifiable value [message #585808 is a reply to message #585753] |
Fri, 11 June 2010 14:16  |
Eclipse User |
|
|
|
Hi Matthias,
sorry, you can't to that this way... The ridget does not keep the array reference (bad style - breaks encapsulation) only the values in the array. So changing the array after you invoke bindToModel(...) has no effect.
You can either invoke r.bindToModel(...); r.updateFromModel() or better:
1. Invoke ridget.setRootsVisible(false)
2. The root you bind to should be a dummy node that returns the real roots as it's children
3. Change the values returned by the getChildren method of the root >> children are updated. No re-binding or update needed.
Hope this helps. If you need a snippet let me know.
Elias.
--
Elias Volanakis | http://eclipsesource.com
elias (AT) eclipsesource.com | @evolanakis
|
|
|
Re: TreeTableRidget: Bind model to modifiable value [message #585835 is a reply to message #585808] |
Mon, 14 June 2010 07:40  |
Eclipse User |
|
|
|
Meanwhile i came to the same solution. I work with ExtendedTreeNodes which holds a reference to my value object. In a PropertyChangeListener i call:
public void propertyChange(PropertyChangeEvent evt) {
updateRoot((ExtendedTreeNode) input[0]);
tree.updateFromModel();
}
private void updateRoot(ExtendedTreeNode rootNode){
MyVal mv = ValueManager.getInstance().getValue();
rootNode.setReference(mv);
}
this works, thanks
|
|
|
Powered by
FUDForum. Page generated in 0.11591 seconds