Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Use DataBinding APIs to update model when contents of Table change
Use DataBinding APIs to update model when contents of Table change [message #114409] Thu, 04 December 2008 15:11 Go to next message
Eclipse UserFriend
Originally posted by: spanprevention-nursubscriptions.gmail.com

Hi,

The requirement is that when the contents of a table change (process
described below), DataBinding APIs should indicate that the model needs to
be updated.

I have a table that has 3 columns. The first column can be considered a
key and the other 2 columns are values (e.g. Column1 = 'ID', Column2 =
'DisplayName', Column3 = 'SomeValue'). When a row is selected, the idea is
to let the user change the values of columns 2 and 3 for that row. For
meet this end, when the row is selected, a couple of text boxes outside
the table are populated with the current values of columns 2 and 3 in the
selected row. The user can modify these values in the text box. When the
user clicks a button next to these text boxes, the values from the text
boxes are written to the respective columns of the selected row. This
works fine.

All of the above is in an editor that has some more widgets. There is a
Workbench SAVE action whose widget in the menu is to be enabled/disabled
using DataBinding APIs based on widgets in this editor.

The requirement is that when the contents of the table change (as a result
of actions described above), the DataBinding APIs should indicate that the
model needs to be updated by enabling the SAVE icon. I have been unable to
find a suitable SWTObservables API that i can use for this purpose. The
only API that i found applicable to the Table widget was the
SWTObservables.singleSelection() API, but this enables the SAVE icon when
a row is selected in the table, not when its contents change. This is not
what i want.

Any pointers/code snippets to resolve the above problem are much
appreciated.

TIA,
Best Regards,
- abhi
Re: Use DataBinding APIs to update model when contents of Table change [message #114444 is a reply to message #114409] Thu, 04 December 2008 16:21 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Well databinding is not the appropriate place to decide if your model is
dirty though you could simply register to all value bindings and listen
for change events (skipping those coming from a master-detail action).

The much better solution would be to solve this at the model level
though as long as you use POJOs you need to write such a thing your own :-(

The Best Solution would be to use EMF + EMFEditDatabinding which
automatically gives you a CommandStack (=Undo/Redo-List) which you can
query / listen to to decide whether your model is dirty or not + you get
undo/redo for free!

If you want a tutorial on how to use these things in a custom
RCP-Application take a look at an example application I published
(yes I know you want that you write an RAP-Application but the concepts
are the same for a RAP-Application) at [1] (it's the datacentric
application talk). I know it sounds a lot of work but it will save you
from a tremendous amount of headaches.

Once the RAP people solved the SWTObservables#observedDelayed problem I
will publish my application as RAP-Example.

Tom

[1] http://tom-eclipse-dev.blogspot.com/2008/11/back-from-ese.ht ml

abhi schrieb:
> Hi,
>
> The requirement is that when the contents of a table change (process
> described below), DataBinding APIs should indicate that the model needs
> to be updated.
>
> I have a table that has 3 columns. The first column can be considered a
> key and the other 2 columns are values (e.g. Column1 = 'ID', Column2 =
> 'DisplayName', Column3 = 'SomeValue'). When a row is selected, the idea
> is to let the user change the values of columns 2 and 3 for that row.
> For meet this end, when the row is selected, a couple of text boxes
> outside the table are populated with the current values of columns 2 and
> 3 in the selected row. The user can modify these values in the text box.
> When the user clicks a button next to these text boxes, the values from
> the text boxes are written to the respective columns of the selected
> row. This works fine.
> All of the above is in an editor that has some more widgets. There is a
> Workbench SAVE action whose widget in the menu is to be enabled/disabled
> using DataBinding APIs based on widgets in this editor.
> The requirement is that when the contents of the table change (as a
> result of actions described above), the DataBinding APIs should indicate
> that the model needs to be updated by enabling the SAVE icon. I have
> been unable to find a suitable SWTObservables API that i can use for
> this purpose. The only API that i found applicable to the Table widget
> was the SWTObservables.singleSelection() API, but this enables the SAVE
> icon when a row is selected in the table, not when its contents change.
> This is not what i want.
> Any pointers/code snippets to resolve the above problem are much
> appreciated.
>
> TIA,
> Best Regards,
> - abhi
>
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Use DataBinding APIs to update model when contents of Table change [message #114479 is a reply to message #114444] Thu, 04 December 2008 21:00 Go to previous message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

regarding the SWTObservables#observedDelayed():
its use in RAP is often unnecessary as UI events like ModifyEvents
are already delayed or accumulated before delivered to the server.

Tom Schindl wrote:
> Hi,
>
> Well databinding is not the appropriate place to decide if your model is
> dirty though you could simply register to all value bindings and listen
> for change events (skipping those coming from a master-detail action).
>
> The much better solution would be to solve this at the model level
> though as long as you use POJOs you need to write such a thing your own :-(
>
> The Best Solution would be to use EMF + EMFEditDatabinding which
> automatically gives you a CommandStack (=Undo/Redo-List) which you can
> query / listen to to decide whether your model is dirty or not + you get
> undo/redo for free!
>
> If you want a tutorial on how to use these things in a custom
> RCP-Application take a look at an example application I published
> (yes I know you want that you write an RAP-Application but the concepts
> are the same for a RAP-Application) at [1] (it's the datacentric
> application talk). I know it sounds a lot of work but it will save you
> from a tremendous amount of headaches.
>
> Once the RAP people solved the SWTObservables#observedDelayed problem I
> will publish my application as RAP-Example.
>
> Tom
>
> [1] http://tom-eclipse-dev.blogspot.com/2008/11/back-from-ese.ht ml
>
> abhi schrieb:
>> Hi,
>>
>> The requirement is that when the contents of a table change (process
>> described below), DataBinding APIs should indicate that the model needs
>> to be updated.
>>
>> I have a table that has 3 columns. The first column can be considered a
>> key and the other 2 columns are values (e.g. Column1 = 'ID', Column2 =
>> 'DisplayName', Column3 = 'SomeValue'). When a row is selected, the idea
>> is to let the user change the values of columns 2 and 3 for that row.
>> For meet this end, when the row is selected, a couple of text boxes
>> outside the table are populated with the current values of columns 2 and
>> 3 in the selected row. The user can modify these values in the text box.
>> When the user clicks a button next to these text boxes, the values from
>> the text boxes are written to the respective columns of the selected
>> row. This works fine.
>> All of the above is in an editor that has some more widgets. There is a
>> Workbench SAVE action whose widget in the menu is to be enabled/disabled
>> using DataBinding APIs based on widgets in this editor.
>> The requirement is that when the contents of the table change (as a
>> result of actions described above), the DataBinding APIs should indicate
>> that the model needs to be updated by enabling the SAVE icon. I have
>> been unable to find a suitable SWTObservables API that i can use for
>> this purpose. The only API that i found applicable to the Table widget
>> was the SWTObservables.singleSelection() API, but this enables the SAVE
>> icon when a row is selected in the table, not when its contents change.
>> This is not what i want.
>> Any pointers/code snippets to resolve the above problem are much
>> appreciated.
>>
>> TIA,
>> Best Regards,
>> - abhi
>>
>>
>
>
Previous Topic:HelpSystem in Tomcat + WAR
Next Topic:Unnecessary mouseup/mousedown events in Tables
Goto Forum:
  


Current Time: Wed Sep 25 12:48:14 GMT 2024

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

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

Back to the top