Is there a convenice way to monitor the propertysheet item status? Like textfield get focused, boolean status change, etc.
I've looked the javadoc,did't find one.
And there's an issue here, but the solution seems to let the editor know the change of a property.
What I want is just in the opposite, monitor the editor.
Anyone can help?
From PropertySheet:
/**
* Sets a new editor factory used by the PropertySheet to determine which
* {@link PropertyEditor} to use for a given {@link Item}.
* @param factory
*/
public final void setPropertyEditorFactory( Callback<Item, PropertyEditor<?>> factory ) {
propertyEditorFactory.set( factory == null? new DefaultPropertyEditorFactory(): factory );
}
If you create a callback to a PropertyEditor you can add listeners to the editor.
For example:
SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>> propertyEditorFactory = new SimpleObjectProperty<>(this, "propertyEditor", new DefaultPropertyEditorFactory());
projectSheet.setPropertyEditorFactory(getItemPropertyEditorCallback(propertyEditorFactory));
private Callback<PropertySheet.Item, PropertyEditor<?>> getItemPropertyEditorCallback(SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>> propertyEditorFactory) {
return param -> {
PropertyEditor<?> editor = propertyEditorFactory.get().call(param);
//Add listeners to editor
editor.getEditor().focusedProperty().addListener((observable, oldValue, newValue) -> System.out.println(newValue));
return editor;
};
}