Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Purpose of DataBindingContext's validation realm
Purpose of DataBindingContext's validation realm [message #334106] Wed, 21 January 2009 08:19 Go to next message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Hi,
the question below was asked in Topic "Databinding and
ISelectionChanged" in Newsgroup eclipse.tools.emf, where it was OT.

Tom Schindl wrote:
> Hi Jan,
>
> Well the purpose of Realms is to sync between different threads for
> example if you set a Model-Value from a none-ui-thread the purpose of
> the Realm used by SWT-Observable is to sync back to the UI-Thread when
> setting the attribute on the SWT widget.

Hi Tom,
I still don't understand the purpose of the DataBindingContext's
validation realm. Could you explain, please?

Kind regards, Sebastian
Re: Purpose of DataBindingContext's validation realm [message #334127 is a reply to message #334106] Wed, 21 January 2009 15:42 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
This is the realm you must be in to interact with the DataBindingContext
itself, including adding / removing / querying bindings and getting the
validation status.

Matthew

Sebastian Paul wrote:
> Hi,
> the question below was asked in Topic "Databinding and
> ISelectionChanged" in Newsgroup eclipse.tools.emf, where it was OT.
>
> Tom Schindl wrote:
> > Hi Jan,
> >
> > Well the purpose of Realms is to sync between different threads for
> > example if you set a Model-Value from a none-ui-thread the purpose of
> > the Realm used by SWT-Observable is to sync back to the UI-Thread when
> > setting the attribute on the SWT widget.
>
> Hi Tom,
> I still don't understand the purpose of the DataBindingContext's
> validation realm. Could you explain, please?
>
> Kind regards, Sebastian
Re: Purpose of DataBindingContext's validation realm [message #334151 is a reply to message #334127] Thu, 22 January 2009 08:53 Go to previous messageGo to next message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Matthew Hall wrote:
> This is the realm you must be in to interact with the DataBindingContext
> itself, including adding / removing / querying bindings and getting the
> validation status.

Hi Matthew,
thanks for the explanation.
But where do I know which Realm I have to use for it? Currently my calls
run on the display thread, so everything works. But I don't know why.

What happens when there are Bindings between SWT (needs the display
thread) and an arbitrary model that runs in another thread?

Is it possible to mix bindings of any type, or does this depend on the
Realm of the DBC?

Sorry for asking this again, but previous answers and documentation
(http://wiki.eclipse.org/Category:Data_Binding) still didn't help me to
understand.


Regards, Sebastian
Re: Purpose of DataBindingContext's validation realm [message #334160 is a reply to message #334151] Thu, 22 January 2009 17:25 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Sebastian Paul wrote:
> But where do I know which Realm I have to use for it? Currently my calls
> run on the display thread, so everything works. But I don't know why.

You can use any realm, but it's usually easier to use the display realm
since some of our support classes aren't yet designed to cope with other
realms (WizardPageSupport for example).

> What happens when there are Bindings between SWT (needs the display
> thread) and an arbitrary model that runs in another thread?

Bindings are designed to handle this. Here is how the update pipeline
works:

Assuming the following:

Realm displayRealm = SWTObservables.getRealm(text.getDisplay());
Realm workerRealm = new WorkerRealm(workerThread); // custom realm
bindingContext.bindValue(
// displayRealm is implied for SWT and Viewer observables
SWTObservables.observeText(text, SWT.Modify),
BeansObservables.observeValue(workerRealm, company, "name"));

When a user makes changes in the text field, here is what happens:

display realm:
get new value from text observable (source)
validate value using after-get validator (see UpdateValueStrategy)
convert value if there is a convert
validate converted value using after-convert validator
validate again using before-set validator
jump to the other realm using realm.exec()
worker realm:
set the new, converted value on the bean observable (target)

This same process works in reverse if the model observable changes.
(Note that Realm.exec() is asynchronous--this is how we avoid deadlocks)

> Is it possible to mix bindings of any type, or does this depend on the
> Realm of the DBC?

Any combination of realms is allowed for the model observable, target
observable and validation realm of the DataBindingContext.

Hope this helps,

Matthew
Re: Purpose of DataBindingContext's validation realm [message #334173 is a reply to message #334160] Fri, 23 January 2009 08:55 Go to previous message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
> Hope this helps,
>
> Matthew

Thank you Matthew, that helps a lot!

Regards, Sebastian
Previous Topic:Drag and Drop between 2 opened editors
Next Topic:Maximize workbench window
Goto Forum:
  


Current Time: Fri Jul 05 02:29:18 GMT 2024

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

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

Back to the top