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 09:17 Go to next message
Roded Bahat is currently offline Roded BahatFriend
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 18:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
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 10:16 Go to previous message
Roded Bahat is currently offline Roded BahatFriend
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: Mon Dec 22 17:02:25 GMT 2014

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

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