Top Description Inners Fields Constructors Methods
org.controlsfx.control

public Class PropertySheet

extends ControlsFXControl
Class Inheritance
Imports
impl.org.controlsfx.skin.PropertySheetSkin, java.util.Comparator, .Optional, javafx.beans.property.SimpleBooleanProperty, .SimpleObjectProperty, .SimpleStringProperty, javafx.beans.value.ObservableValue, javafx.collections.FXCollections, .ObservableList, javafx.scene.control.Skin, javafx.util.Callback, org.controlsfx.property.BeanPropertyUtils, org.controlsfx.property.editor.DefaultPropertyEditorFactory, .Editors, .PropertyEditor

The PropertySheet control is a powerful control designed to make it really easy for developers to present to end users a list of properties that the end user is allowed to manipulate. Commonly a property sheet is used in visual editors and other tools where a lot of properties exist.

To better describe what a property sheet is, please refer to the picture below:

Screenshot of PropertySheet

In this property sheet there exists two columns: the left column shows a label describing the property itself, whereas the right column provides a PropertyEditor that allows the end user the means to manipulate the property. In the screenshot you can see CheckEditor, ChoiceEditor, TextEditor and FontEditor, among the many editors that are available in the Editors package.

To create a PropertySheet is simple: you firstly instantiate an instance of PropertySheet, and then you pass in a list of Item instances, where each Item represents a single property that is to be editable by the end user.

Working with JavaBeans

Because a very common use case for a property sheet is editing properties on a JavaBean, there is convenience API for making this interaction easier. Refer to the class, in particular the BeanPropertyUtils#getProperties(Object) method that will return a list of Item instances, one Item instance per property on the given JavaBean.
See Also
Item, Mode

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PropertySheet.Item

A wrapper interface for a single property to be displayed in a PropertySheet control.

public static enum
PropertySheet.Mode

Specifies how the PropertySheet should be laid out.

Field Summary

Modifier and TypeField and Description
private final SimpleObjectProperty<Comparator<String>>
private static final String
DEFAULT_STYLE_CLASS

* Stylesheet Handling * *

private final ObservableList<PropertySheet.Item>
items

Private fields

private final SimpleObjectProperty<PropertySheet.Mode>
modeProperty

Properties

private final SimpleBooleanProperty
private final SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>>
private final SimpleBooleanProperty
private final SimpleStringProperty

Constructor Summary

AccessConstructor and Description
public
PropertySheet()

Creates a default PropertySheet instance with no properties to edit.

public
PropertySheet(ObservableList<PropertySheet.Item>
The items that should appear within the PropertySheet.
items
)

Creates a PropertySheet instance prepopulated with the items provided in the items ObservableList.

Method Summary

Modifier and TypeMethod and Description
public final SimpleObjectProperty<Comparator<String>>

Returns:

A SimpleObjectproperty.
categoryComparatorProperty
()

Used to represent how the categories should be laid out in the PropertySheet when using the Category mode (see Mode).

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final Comparator<String>
getCategoryComparator()

Returns: how the categories should be laid out in the PropertySheet.

public ObservableList<PropertySheet.Item>
getItems()

Returns: An ObservableList of properties that will be displayed to the user to allow for them to be edited.

public final PropertySheet.Mode
getMode()

Returns: how the properties should be laid out in the PropertySheet.

public final Callback<PropertySheet.Item, PropertyEditor<?>>
getPropertyEditorFactory()

Returns: The editor factory used by the PropertySheet to determine which PropertyEditor to use for a given Item.

public final String
getTitleFilter()

Returns: the filter for filtering the options shown on screen

public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final boolean
isModeSwitcherVisible()

Returns: whether a visual option is presented to users to switch between the various modes available.

public final boolean
isSearchBoxVisible()

Returns: whether a text field should be presented to users to allow for them to filter the properties in the property sheet to only show ones matching the typed input.

public final SimpleObjectProperty<PropertySheet.Mode>

Returns:

A SimpleObjectproperty.
modeProperty
()

Used to represent how the properties should be laid out in the PropertySheet.

public final SimpleBooleanProperty

Returns:

A SimpleBooleanproperty.
modeSwitcherVisibleProperty
()

This property represents whether a visual option should be presented to users to switch between the various modes available.

public final SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>>

Returns:

A SimpleObjectproperty.
propertyEditorFactory
()

The property editor factory is used by the PropertySheet to determine which PropertyEditor to use for a given Item.

public final SimpleBooleanProperty

Returns:

A SimpleBooleanProperty.
searchBoxVisibleProperty
()

This property represents whether a text field should be presented to users to allow for them to filter the properties in the property sheet to only show ones matching the typed input.

public final void
setCategoryComparator(Comparator<String> categoryComparator)

Set how the categories should be laid out in the PropertySheet.

public final void
setMode(PropertySheet.Mode mode)

Set how the properties should be laid out in the PropertySheet.

public final void
setModeSwitcherVisible(boolean visible)

Set whether a visual option should be presented to users to switch between the various modes available.

public final void
setPropertyEditorFactory(Callback<PropertySheet.Item, PropertyEditor<?>> factory)

Sets a new editor factory used by the PropertySheet to determine which PropertyEditor to use for a given Item.

public final void
setSearchBoxVisible(boolean visible)

Sets whether a text field should be presented to users to allow for them to filter the properties in the property sheet to only show ones matching the typed input.

public final void
setTitleFilter(String filter)

Sets the filter for filtering the options shown on screen.

public final SimpleStringProperty

Returns:

A SimpleStringProperty.
titleFilter
()

Regardless of whether the search box is visible or not, it is possible to filter the options shown on screen using this title filter property.

Inherited from org.controlsfx.control.ControlsFXControl:
getUserAgentStylesheet

Field Detail

categoryComparatorPropertyback to summary
private final SimpleObjectProperty<Comparator<String>> categoryComparatorProperty
DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS

* Stylesheet Handling * *

itemsback to summary
private final ObservableList<PropertySheet.Item> items

Private fields

modePropertyback to summary
private final SimpleObjectProperty<PropertySheet.Mode> modeProperty

Properties

modeSwitcherVisibleback to summary
private final SimpleBooleanProperty modeSwitcherVisible
propertyEditorFactoryback to summary
private final SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>> propertyEditorFactory
searchBoxVisibleback to summary
private final SimpleBooleanProperty searchBoxVisible
titleFilterPropertyback to summary
private final SimpleStringProperty titleFilterProperty

Constructor Detail

PropertySheetback to summary
public PropertySheet()

Creates a default PropertySheet instance with no properties to edit.

PropertySheetback to summary
public PropertySheet(ObservableList<PropertySheet.Item> items)

Creates a PropertySheet instance prepopulated with the items provided in the items ObservableList.

Parameters
items:ObservableList<PropertySheet.Item>

The items that should appear within the PropertySheet.

Method Detail

categoryComparatorPropertyback to summary
public final SimpleObjectProperty<Comparator<String>> categoryComparatorProperty()

Used to represent how the categories should be laid out in the PropertySheet when using the Category mode (see Mode). Thus allowing user to sort categories by other ways than alphabetical or numerical order.

Returns:SimpleObjectProperty<Comparator<String>>

A SimpleObjectproperty.

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
getCategoryComparatorback to summary
public final Comparator<String> getCategoryComparator()
Returns:Comparator<String>

how the categories should be laid out in the PropertySheet.

See Also
Mode
getItemsback to summary
public ObservableList<PropertySheet.Item> getItems()
Returns:ObservableList<PropertySheet.Item>

An ObservableList of properties that will be displayed to the user to allow for them to be edited.

getModeback to summary
public final PropertySheet.Mode getMode()
Returns:PropertySheet.Mode

how the properties should be laid out in the PropertySheet.

See Also
Mode
getPropertyEditorFactoryback to summary
public final Callback<PropertySheet.Item, PropertyEditor<?>> getPropertyEditorFactory()
Returns:Callback<PropertySheet.Item, PropertyEditor<?>>

The editor factory used by the PropertySheet to determine which PropertyEditor to use for a given Item.

getTitleFilterback to summary
public final String getTitleFilter()
Returns:String

the filter for filtering the options shown on screen

See Also
titleFilter()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
isModeSwitcherVisibleback to summary
public final boolean isModeSwitcherVisible()
Returns:boolean

whether a visual option is presented to users to switch between the various modes available.

isSearchBoxVisibleback to summary
public final boolean isSearchBoxVisible()
Returns:boolean

whether a text field should be presented to users to allow for them to filter the properties in the property sheet to only show ones matching the typed input.

modePropertyback to summary
public final SimpleObjectProperty<PropertySheet.Mode> modeProperty()

Used to represent how the properties should be laid out in the PropertySheet. Refer to the Mode enumeration to better understand the available options.

Returns:SimpleObjectProperty<PropertySheet.Mode>

A SimpleObjectproperty.

modeSwitcherVisiblePropertyback to summary
public final SimpleBooleanProperty modeSwitcherVisibleProperty()

This property represents whether a visual option should be presented to users to switch between the various modes available. By default this is true, so setting it to false will hide these buttons.

Returns:SimpleBooleanProperty

A SimpleBooleanproperty.

propertyEditorFactoryback to summary
public final SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>> propertyEditorFactory()

The property editor factory is used by the PropertySheet to determine which PropertyEditor to use for a given Item. By default the DefaultPropertyEditorFactory is used, but this may be replaced or extended by developers wishing to add in (or substitute) their own property editors.

Returns:SimpleObjectProperty<Callback<PropertySheet.Item, PropertyEditor<?>>>

A SimpleObjectproperty.

searchBoxVisiblePropertyback to summary
public final SimpleBooleanProperty searchBoxVisibleProperty()

This property represents whether a text field should be presented to users to allow for them to filter the properties in the property sheet to only show ones matching the typed input. By default this is true, so setting it to false will hide this search field.

Returns:SimpleBooleanProperty

A SimpleBooleanProperty.

setCategoryComparatorback to summary
public final void setCategoryComparator(Comparator<String> categoryComparator)

Set how the categories should be laid out in the PropertySheet.

setModeback to summary
public final void setMode(PropertySheet.Mode mode)

Set how the properties should be laid out in the PropertySheet.

setModeSwitcherVisibleback to summary
public final void setModeSwitcherVisible(boolean visible)

Set whether a visual option should be presented to users to switch between the various modes available.

setPropertyEditorFactoryback to summary
public final void setPropertyEditorFactory(Callback<PropertySheet.Item, PropertyEditor<?>> factory)

Sets a new editor factory used by the PropertySheet to determine which PropertyEditor to use for a given Item.

setSearchBoxVisibleback to summary
public final void setSearchBoxVisible(boolean visible)

Sets whether a text field should be presented to users to allow for them to filter the properties in the property sheet to only show ones matching the typed input.

setTitleFilterback to summary
public final void setTitleFilter(String filter)

Sets the filter for filtering the options shown on screen.

See Also
titleFilter()
titleFilterback to summary
public final SimpleStringProperty titleFilter()

Regardless of whether the search box is visible or not, it is possible to filter the options shown on screen using this title filter property. If the search box is visible, it will manipulate this property to contain whatever the user types.

Returns:SimpleStringProperty

A SimpleStringProperty.

org.controlsfx.control back to summary

public Interface PropertySheet.Item

Known Direct Implementers
org.controlsfx.property.BeanProperty

A wrapper interface for a single property to be displayed in a PropertySheet control.
See Also
PropertySheet

Method Summary

Modifier and TypeMethod and Description
public String
getCategory()

Returns a String representation of the category of the property.

public String
getDescription()

A String that will be shown to the user as a tooltip.

public String
getName()

Returns the display name of the property, which should be short (i.e. less than two words).

public Optional<ObservableValue<? extends Object>>
getObservableValue()

Returns the underlying ObservableValue, where one exists, that the editor can monitor for changes.

public default Optional<Class<? extends PropertyEditor<?>>>
getPropertyEditorClass()

Returns an Optional wrapping the class of the PropertyEditor that should be used for editing this item.

public Class<?>
getType()

Returns the class type of the property.

public Object
getValue()

Returns the current value of the property.

public default boolean
isEditable()

Indicates whether the PropertySheet should allow editing of this property, or whether it is read-only.

public void
setValue(Object value)

Sets the current value of the property.

Method Detail

getCategoryback to summary
public String getCategory()

Returns a String representation of the category of the property. This is relevant when the PropertySheet mode property is set to Mode#CATEGORY - as then all properties with the same category will be grouped together visually.

getDescriptionback to summary
public String getDescription()

A String that will be shown to the user as a tooltip. This allows for a longer form of detail than what is possible with the getName() method.

getNameback to summary
public String getName()

Returns the display name of the property, which should be short (i.e. less than two words). This is used to explain to the end user what the property represents and is displayed beside the PropertyEditor. If you need to explain more detail to the user, consider placing it in the getDescription().

getObservableValueback to summary
public Optional<ObservableValue<? extends Object>> getObservableValue()

Returns the underlying ObservableValue, where one exists, that the editor can monitor for changes.

getPropertyEditorClassback to summary
public default Optional<Class<? extends PropertyEditor<?>>> getPropertyEditorClass()

Returns an Optional wrapping the class of the PropertyEditor that should be used for editing this item. The default implementation returns Optional.empty() The class must have a constructor that can accept a single argument of type PropertySheet.Item

getTypeback to summary
public Class<?> getType()

Returns the class type of the property.

getValueback to summary
public Object getValue()

Returns the current value of the property.

isEditableback to summary
public default boolean isEditable()

Indicates whether the PropertySheet should allow editing of this property, or whether it is read-only. The default implementation returns true.

setValueback to summary
public void setValue(Object value)

Sets the current value of the property.

org.controlsfx.control back to summary

public final Enum PropertySheet.Mode

extends Enum<PropertySheet.Mode>
Class Inheritance

Specifies how the PropertySheet should be laid out. Refer to the enumeration values to learn what each one means.

Field Summary

Modifier and TypeField and Description
public static final PropertySheet.Mode
CATEGORY

Groups the properties in the items list based on their category.

public static final PropertySheet.Mode
NAME

Simply displays the properties in the items list in the order they are in the list.

Constructor Summary

AccessConstructor and Description
private
Mode()

Method Summary

Modifier and TypeMethod and Description
public static PropertySheet.Mode
public static PropertySheet.Mode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CATEGORYback to summary
public static final PropertySheet.Mode CATEGORY

Groups the properties in the items list based on their category.

NAMEback to summary
public static final PropertySheet.Mode NAME

Simply displays the properties in the items list in the order they are in the list.

Constructor Detail

Modeback to summary
private Mode()

Method Detail

valueOfback to summary
public static PropertySheet.Mode valueOf(String name)
valuesback to summary
public static PropertySheet.Mode[] values()