Class PropertySheet

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class PropertySheet extends Control
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 PropertySheet.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:
  • Property Details

  • Constructor Details

    • PropertySheet

      public PropertySheet()
      Creates a default PropertySheet instance with no properties to edit.
    • PropertySheet

      public PropertySheet(ObservableList<PropertySheet.Item> items)
      Creates a PropertySheet instance prepopulated with the items provided in the items ObservableList.
      Parameters:
      items - The items that should appear within the PropertySheet.
  • Method Details

    • getItems

      public ObservableList<PropertySheet.Item> getItems()
      Returns:
      An ObservableList of properties that will be displayed to the user to allow for them to be edited.
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Control
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • modeProperty

      public final SimpleObjectProperty<PropertySheet.Mode> modeProperty()
      Used to represent how the properties should be laid out in the PropertySheet. Refer to the PropertySheet.Mode enumeration to better understand the available options.
      See Also:
    • getMode

      public final PropertySheet.Mode getMode()
      Returns:
      how the properties should be laid out in the PropertySheet.
      See Also:
    • setMode

      public final void setMode(PropertySheet.Mode mode)
      Set how the properties should be laid out in the PropertySheet.
      Parameters:
      mode -
    • propertyEditorFactory

      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 PropertySheet.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:
      A SimpleObjectproperty.
    • getPropertyEditorFactory

      public final Callback<PropertySheet.Item,PropertyEditor<?>> getPropertyEditorFactory()
      Returns:
      The editor factory used by the PropertySheet to determine which PropertyEditor to use for a given PropertySheet.Item.
    • setPropertyEditorFactory

      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 PropertySheet.Item.
      Parameters:
      factory -
    • modeSwitcherVisibleProperty

      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.
      See Also:
    • isModeSwitcherVisible

      public final boolean isModeSwitcherVisible()
      Returns:
      whether a visual option is presented to users to switch between the various modes available.
    • setModeSwitcherVisible

      public final void setModeSwitcherVisible(boolean visible)
      Set whether a visual option should be presented to users to switch between the various modes available.
      Parameters:
      visible -
    • searchBoxVisibleProperty

      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.
      See Also:
    • isSearchBoxVisible

      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.
    • setSearchBoxVisible

      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.
      Parameters:
      visible -
    • titleFilter

      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:
      A SimpleStringProperty.
    • getTitleFilter

      public final String getTitleFilter()
      Returns:
      the filter for filtering the options shown on screen
      See Also:
    • setTitleFilter

      public final void setTitleFilter(String filter)
      Sets the filter for filtering the options shown on screen.
      Parameters:
      filter -
      See Also:
    • categoryComparatorProperty

      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 PropertySheet.Mode). Thus allowing user to sort categories by other ways than alphabetical or numerical order.
      See Also:
    • getCategoryComparator

      public final Comparator<String> getCategoryComparator()
      Returns:
      how the categories should be laid out in the PropertySheet.
      See Also:
    • setCategoryComparator

      public final void setCategoryComparator(Comparator<String> categoryComparator)
      Set how the categories should be laid out in the PropertySheet.
      Parameters:
      mode -
    • getUserAgentStylesheet

      protected final String getUserAgentStylesheet(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once. Caches the external form of the resource.
      Parameters:
      clazz - the class used for the resource lookup
      fileName - the name of the user agent stylesheet
      Returns:
      the external form of the user agent stylesheet (the path)