[DataBinding] refreshing values in Tree/validate with ObservableMapLabelProvider [message #332100] |
Thu, 02 October 2008 22:08 |
Eclipse User |
|
|
|
Hi All,
my question is around refreshing values of adjacent rows in a Tree
(TreeViewer). I have a little spreadsheet-like application which presents
it's data in a tree. Each node represents the sum of it's children and
there is one row with the total over all detail rows.
root +
|
+ subtotal +
| |
| + row with detail data 1
| |
| + row with detail data 1
| |
| + row with detail data 1
|
+ subtotal +
| |
| + row with detail data 1
| + row with detail data 1
|
+ total
What i managed so far is that the values in each row are calculated
correctly (some of the fields in the row are input fields and some are
calculated) after editing values. What i did not manage is to refresh the
values of the subtotal and total row automatically. If i hit a manual
refresh-action which calls treeViewer.refresh() all values are refreshed
gracefully.
My initDatabinding-method looks like this:
------
ObservableListTreeContentProvider contentProvider = new
ObservableListTreeContentProvider(
BeansObservables.listFactory(Realm.getDefault(), "children",
IPlanzeile.class), null);
treeViewer.setContentProvider(contentProvider);
IObservableMap[] attributeMap = BeansObservables.observeMaps(
contentProvider.getKnownElements(), IPlanzeile.class, new
String[]{"fieldx", "fieldx", "fieldx", "fieldx", "fieldx", "fieldx",
"fieldx", "fieldx", "fieldx", "fieldx", "fieldx", "fieldx", "fieldx",
"fieldx", "fieldx", "fieldx", "fieldx", "fieldx", "fieldx", "fieldx"});
treeViewer.setLabelProvider(new ObservableMapLabelProvider(attributeMap));
treeViewer.setInput(model.getRootNode());
------
My next problem with this configuration is how can i access a Validator or
Converter. Some of the fields are double values with many fraction digits.
I'd like to have a getText() with a rounded value (2 fractions) and a
getToolTipText() with all fractions. I even tried to use a
DecoratedLabelProvider which does not work either. In that case each
column shows the value of the first column.
Could you give some pointers where to search? Any help is appreciated,
Cheers,
Thomas E.-E.
|
|
|
Powered by
FUDForum. Page generated in 0.04568 seconds