[Databinding] POLICY_CONVERT with TableViewer and EditingSupport [message #332525] |
Sun, 26 October 2008 13:23  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03504 seconds