Top Description Fields Constructors Methods
org.controlsfx.property.editor

public abstract Class AbstractObjectField<T>

extends HBox
Class Inheritance
Imports
javafx.beans.property.ObjectProperty, .SimpleObjectProperty, .StringProperty, javafx.scene.Cursor, javafx.scene.image.Image, .ImageView, javafx.scene.input.MouseButton, javafx.scene.layout.HBox, .Priority, .StackPane, org.controlsfx.control.textfield.CustomTextField

Helper class to create a custom editor for a type T. The example "how to do" will be found for the Font Editor in the class Editors#createFontEditor(org.controlsfx.control.PropertySheet.Item).
See also {@link DefaultPropertyEditorFactory how to integrate a custom type editor in the PropertySheet.
public static final PropertyEditor<?> createFontEditor( Item property ) {
       return new AbstractPropertyEditor<Font, AbstractObjectField<Font>>(property, new AbstractObjectField<Font>() {
                   {@literal @}Override protected Class<Font> getType() {
                       return Font.class;
                   }

                   {@literal @}Override protected String objectToString(Font font) {
                       return font == null? "": String.format("%s, %.1f", font.getName(), font.getSize()); //$NON-NLS-1$ //$NON-NLS-2$
                   }

                   {@literal @}Override protected Font edit(Font font) {
                       FontSelectorDialog dlg = new FontSelectorDialog(font);
                       Optional<Font> optionalFont = dlg.showAndWait();
                       return optionalFont.orElse(null);
                   }
               }) {

           {@literal @}Override protected ObservableValue<Font> getObservableValue() {
               return getEditor().getObjectProperty();
           }

           {@literal @}Override public void setValue(Font value) {
               getEditor().getObjectProperty().set(value);
           }
       };
   }

Field Summary

Modifier and TypeField and Description
private static final Image
private ObjectProperty<T>
private final CustomTextField

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract T
edit(T object)

public ObjectProperty<T>
protected abstract Class<T>
protected String
objectToString(T object)

protected StringProperty
Inherited from javafx.scene.layout.HBox:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthfillHeightPropertygetAlignmentgetBaselineOffsetgetClassCssMetaDatagetContentBiasgetCssMetaDatagetHgrowgetMargingetSpacingisFillHeightlayoutChildrenrequestLayoutsetAlignmentsetFillHeightsetHgrowsetMarginsetSpacingspacingProperty

Field Detail

imageback to summary
private static final Image image
objectPropertyback to summary
private ObjectProperty<T> objectProperty
textFieldback to summary
private final CustomTextField textField

Constructor Detail

AbstractObjectFieldback to summary
public AbstractObjectField()

Method Detail

editback to summary
protected abstract T edit(T object)
getObjectPropertyback to summary
public ObjectProperty<T> getObjectProperty()
getTypeback to summary
protected abstract Class<T> getType()
objectToStringback to summary
protected String objectToString(T object)
textPropertyback to summary
protected StringProperty textProperty()