Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [DataBinding] refreshing values in Tree/validate with ObservableMapLabelProvider
[DataBinding] refreshing values in Tree/validate with ObservableMapLabelProvider [message #332100] Thu, 02 October 2008 22:08
Thomas  ichstädt-Engelen is currently offline Thomas ichstädt-EngelenFriend
Messages: 50
Registered: July 2009
Member

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.
Previous Topic:[JDT] wrong source editor opened during debugging
Next Topic:Auto-expanding TreeView?
Goto Forum:
  


Current Time: Wed Sep 18 18:06:37 GMT 2024

Powered by FUDForum. Page generated in 0.02816 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top