[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: StringBinding and null
From: Michael Heinrichs <michael.heinrichs () netopyr ! com>
Date: 2016-01-20 7:21:25
Message-ID: 8B51FD96-9CCD-421D-9D9D-7809E3E67D61 () netopyr ! com
[Download RAW message or body]
Hi Scott,
if I remember correctly, the behavior you observe and would like to change is \
actually not defined in StringBinding, but in the method asString(). You can fix it \
by defining your own StringBinding. It is a one-liner, guess you are way better off \
doing it yourself than waiting for such a change to make it into the official \
release. ;)
Cheers,
Michael
> On 19 Jan 2016, at 17:09, Scott Palmer <swpalmer@gmail.com> wrote:
>
> So I just discovered that:
>
> ObjectProperty<String> objectPropertyString = new
> SimpleObjectProperty<>(null);
> StringBinding stringBinding = objectPropertyString.asString();
>
> stringBinding.get() == null --> FALSE
>
> stringBinding.get().equals("null") --> TRUE
>
>
> I care because this fails to do what I want:
>
> Button okayButton;
> ComboBox<String> combo;
> //...
> BooleanBinding dontHaveValue =
> Bindings.isEmpty(combo.valueProperty().asString());
> okayButton.disableProperty().bind(dontHaveValue);
>
> The behaviour is understandable and obviously too late to change even if we
> wanted to (which we probably don't). But I wonder if StringBinding can be
> tweaked so you can enable the pass through of null if you choose to?
>
> If others agree I will open an issue.
>
> Scott
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic