DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page Tableviewer and Databinding, how does it work ?
Notices
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Aug 2010
Post Tableviewer and Databinding, how does it work ? - 08-02-2010, 07:17 AM

Hi all,

I use jface databinding in a standalone SWT application.

The databinding famework works well with Texts, Combos and even radio buttons.
I know how to add Validator, use them to display ControlDecoration and even use UpdateValueStrategy.POLICY_CONVERT to update my model only when the user press the save button on my dialog.

But, I can't make it works with TableViewer. I try to have the same functionnalities on the viewer :

I want to :
- track adds
- track removes
- track changes on the objects in the input
- and update the model only when call to getBindingContext().updateModels();

With the code below, and can only track adds and removes. And this is done in real time (the model is updated instantly)
Code:
ViewerSupport.bind(peopleViewer, new WritableList(viewModel
					.getPeople(), Person.class), BeanProperties.value(
					Person.class, "name"));

Just for the test, I add a double click listener on the table viewer :
Code:
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
	public void doubleClick(DoubleClickEvent arg0) {
		Person person =
				(Person) ((IStructuredSelection) arg0.getSelection()).getFirstElement();

		person.setName("new name");
	}
});
The table is never refresh. (The call to tableViewer.refresh() doesn't work). "new name" is never displayed.

Do you have examples on how to do this ? I googled a lot and doesn't find what I want...

Thanks in advance

Fluminis
Reply With Quote
Reply

Tags
databinding, jface, swt, tableviewer

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TableViewer Text formatting help bowmanmc Eclipse 2 06-30-2009 03:17 AM
JEE 5 MDB example does not work josealvarezdelara Eclipse 0 02-07-2009 03:42 PM
TableViewer and ViewerFilter matt.blye@gmail.com Eclipse 0 08-08-2008 02:01 PM
ComboBoxCellEditor in TableViewer CBMMelb Eclipse 2 05-16-2008 01:22 AM
Getting Qt and eclipse with CDT to work AnthonyArde Eclipse 0 03-30-2008 02:07 PM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com