How to trigger property invalidation?

Will Hoover java.whoover at
Fri Nov 2 11:46:39 PDT 2012

...or you could use a BeanPathAdapter that handles all your POJO field to
JFX property conversions for you ( and listen for
changes to the bean:

BeanPathAdapter<MyPojo> myPojoAdapter = new BeanPathAdapter<>(myPojo);
TextField tf = new TextField();
 	new ChangeListener<FieldPathValue>() {
 	public void changed(
 		final ObservableValue<? extends FieldPathValue> observable,
 		final FieldPathValue oldValue, final FieldPathValue
newValue) {
 			System.out.println("Value changed from path: " +
oldValue.getPath() + " value: " + oldValue.getValue()
 				+ " to path: " + newValue.getPath() + "
value: " + newValue.getValue());

... another shameless plug ;)

-----Original Message-----
From: openjfx-dev-bounces at
[mailto:openjfx-dev-bounces at] On Behalf Of Martin Sladecek
Sent: Friday, November 02, 2012 2:13 PM
To: openjfx-dev at
Subject: Re: How to trigger property invalidation?

Hi Werner,
maybe an ObjectProperty isn't really what you are looking for. If you have
single bean with an non-observable property (BTW, how do you know it has
changed?) and you want to convert it to an FX property, why not using a
property of the same type as MyBean.myProperty and set FX property when
myProperty changes?


On 11/02/2012 04:25 PM, Werner Lehmann wrote:
> Pavel,
> unfortunately I cannot listen to changes on myProperty because it is 
> not an observable property: MyBean is a domain bean provided by the 
> server and those beans do not have observable properties. Thanks for 
> the clarification though.
> In my case this means that I have to clone the bean everytime when a 
> slider position changes so that I can replace the property value I am 
> actually observing (the MyBean property). Seems to be quick enough but 
> is hardly elegant...
> Werner
> On 02.11.2012 15:50, Pavel Safrata wrote:
>> Hi Werner,
>> I think that you cannot trigger invalidation manually by design. The 
>> property holds a reference and should not be concerned with changes 
>> of anything else than the reference. There would be various issues 
>> with it, for example there are change notifications bound to the 
>> invalidation, which would produce a weird notification of the 
>> property being changed to the same value. I think the right approach 
>> is to listen directly on the myProperty instead of tweaking the
invalidation mechanism.
>> With Regards,
>> Pavel
>> On 2.11.2012 12:55, Werner Lehmann wrote:
>>> Hi,
>>> for an ObjectProperty<MyBean>, is it possible to trigger 
>>> invalidation manually when MyBean.myProperty changes? Basically I'd 
>>> like to call
>>> markInvalid() but it is private. And set() compares old and new 
>>> value by reference before invalidating, so won't see the change either.
>>> Workaround seems to be to copy the bean to another instance and 
>>> assign the new instance to the object property.
>>> Rgds
>>> Werner

More information about the openjfx-dev mailing list