[Databinding] Can a bound bean be null? [message #760085] |
Thu, 01 December 2011 09:17 |
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 18:16 |
Thomas Schindl Messages: 6651 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03165 seconds