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:
    PropertySheet.Item, PropertySheet.Mode
    • Constructor Detail

      • 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 Detail

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

        public final void setMode​(PropertySheet.Mode mode)
        Set how the properties should be laid out in the PropertySheet.
        Parameters:
        mode -
      • 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(), setSearchBoxVisible(boolean)
      • 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:
        titleFilter()
      • setTitleFilter

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

        public final Comparator<String> getCategoryComparator()
        Returns:
        how the categories should be laid out in the PropertySheet.
        See Also:
        PropertySheet.Mode
      • 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)