Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [Databinding] Can a bound bean be null?
[Databinding] Can a bound bean be null? [message #760085] Thu, 01 December 2011 04:17 Go to next message
Roded Bahat is currently offline Roded Bahat
Messages: 152
Registered: August 2011
Senior Member
Hello,
I'm playing around with JFace databinding, and I've encountered the following problem:
I've bound a org.w3c.dom.Element to a Text widget, by binding the Text's "text" property and the Element's firstChild.nodeValue (<element>thevalue</element>).
This works well, except for the case when the Element variable is null, in which case the generated PojoObservables.observeValue call throws a NPE.
Further more, in case it variable IS null and the Text's value is changed, I would like to created the Element object and assign the new value to it.

Is there a way around this? or perhaps my method can be better?
This is probably a trivial matter, but I can't seem to find documentation on the matter.
Would appreciate any help.
Thanks a lot,
Roded
Re: [Databinding] Can a bound bean be null? [message #760279 is a reply to message #760085] Thu, 01 December 2011 13:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5210
Registered: July 2009
Senior Member
Hi,

Well this is not easily doable out of the box yet. You need to have an
intermediate broker kind of thing.

Can you please show us exactly how your observable creation is done at
the moment?

Tom

Am 01.12.11 10:17, schrieb Roded:
> Hello,
> I'm playing around with JFace databinding, and I've encountered the
> following problem:
> I've bound a org.w3c.dom.Element to a Text widget, by binding the Text's
> "text" property and the Element's firstChild.nodeValue
> (<element>thevalue</element>).
> This works well, except for the case when the Element variable is null,
> in which case the generated PojoObservables.observeValue call throws a NPE.
> Further more, in case it variable IS null and the Text's value is
> changed, I would like to created the Element object and assign the new
> value to it.
>
> Is there a way around this? or perhaps my method can be better?
> This is probably a trivial matter, but I can't seem to find
> documentation on the matter.
> Would appreciate any help.
> Thanks a lot,
> Roded
Re: [Databinding] Can a bound bean be null? [message #765046 is a reply to message #760279] Tue, 13 December 2011 05:16 Go to previous message
Roded Bahat is currently offline Roded Bahat
Messages: 152
Registered: August 2011
Senior Member
Sorry for neglecting this post.
I have relocated my efforts to Sapphire.
Thanks
Previous Topic:Can I press F1 and see JavaDocs for SWT/JFace class?
Next Topic:Questions about JFace Menus
Goto Forum:
  


Current Time: Tue Jul 22 05:25:18 EDT 2014

Powered by FUDForum. Page generated in 0.01542 seconds