Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] POLICY_CONVERT with TableViewer and EditingSupport
[Databinding] POLICY_CONVERT with TableViewer and EditingSupport [message #332525] Sun, 26 October 2008 13:23 Go to next message
Dariush Forouher is currently offline Dariush ForouherFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I have a TableViewer connected to an ObservableSet. The ObservableSet
contains simple Beans with two fields ("key" and "value"). Each field
represents a column in the Table. The "value"-column is editeble.

My forms are designed to only store changes into the model when the user
presses the "Apply"-button. Thus I use POLICY_CONVERT for all fields on
my form.

Unfortunatly this approach fails on TableViewers. If the user modifies a
cell of the TableViewer, the modification is stored to the model as soon
as the user leaves the cell (e.g. presses Enter).

After some looking I found that in

ObservableValueEditingSupport.saveCellEditorValue(CellEditor ,ViewerCell)

updateTargetToModel() is called on the binding. Unfortunatly this method
is final, so I cannot overwrite it in my implementation of
ObservableValueEditingSupport.

Does anyone know a way to archieve the desired behavior? Due to the
flexibility of Jface databinding I suspect there is one, but I haven't
found it yet.

regards
Dariush Forouher
Re: [Databinding] POLICY_CONVERT with TableViewer and EditingSupport [message #332532 is a reply to message #332525] Mon, 27 October 2008 14:33 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
TableViewers do not work well with POLICY_CONVERT for the reasons you
have discovered. The way I get around this is to bind the table to a
copy of the dataset--so you are doing live updates to the dummy dataset.
Only when the user clicks Apply or Ok do you synchronize the changes
in the dummy dataset with the original dataset.

Hope this helps,

Matthew

Dariush Forouher wrote:
> Hi,
>
> I have a TableViewer connected to an ObservableSet. The ObservableSet
> contains simple Beans with two fields ("key" and "value"). Each field
> represents a column in the Table. The "value"-column is editeble.
>
> My forms are designed to only store changes into the model when the user
> presses the "Apply"-button. Thus I use POLICY_CONVERT for all fields on
> my form.
>
> Unfortunatly this approach fails on TableViewers. If the user modifies a
> cell of the TableViewer, the modification is stored to the model as soon
> as the user leaves the cell (e.g. presses Enter).
>
> After some looking I found that in
>
> ObservableValueEditingSupport.saveCellEditorValue(CellEditor ,ViewerCell)
>
> updateTargetToModel() is called on the binding. Unfortunatly this method
> is final, so I cannot overwrite it in my implementation of
> ObservableValueEditingSupport.
>
> Does anyone know a way to archieve the desired behavior? Due to the
> flexibility of Jface databinding I suspect there is one, but I haven't
> found it yet.
>
> regards
> Dariush Forouher
Re: [Databinding] POLICY_CONVERT with TableViewer and EditingSupport [message #332537 is a reply to message #332532] Mon, 27 October 2008 15:50 Go to previous message
Dariush Forouher is currently offline Dariush ForouherFriend
Messages: 2
Registered: July 2009
Junior Member
Matthew Hall schrieb:
> TableViewers do not work well with POLICY_CONVERT for the reasons you
> have discovered. The way I get around this is to bind the table to a
> copy of the dataset--so you are doing live updates to the dummy dataset.
> Only when the user clicks Apply or Ok do you synchronize the changes in
> the dummy dataset with the original dataset.
>
> Hope this helps,

Hi Matthew,

thanks for the clarification. I'll do this workaround then.

regards
Dariush Forouher
Previous Topic:image decorator problem on table viewer .
Next Topic:Plugin properties from external plugins
Goto Forum:
  


Current Time: Thu Dec 26 11:56:15 GMT 2024

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

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

Back to the top