Class BeanProperty

java.lang.Object
org.controlsfx.property.BeanProperty
All Implemented Interfaces:
PropertySheet.Item

public class BeanProperty extends Object implements PropertySheet.Item
A convenience class for creating a PropertySheet.Item for use in the PropertySheet control based on a property belonging to a JavaBean - simply provide a PropertyDescriptor and the rest will be taken care of automatically.
See Also:
  • Field Details

    • CATEGORY_LABEL_KEY

      public static final String CATEGORY_LABEL_KEY
      Unique identifier to provide a custom category label within PropertySheet.Item.getCategory(). How to use it: with a PropertyDescriptor, provide the custom category through a a named attribute FeatureDescriptor.setValue(String, Object).
       final PropertyDescriptor propertyDescriptor = new PropertyDescriptor("yourProperty", YourBean.class);
       propertyDescriptor.setDisplayName("Your Display Name");
       propertyDescriptor.setShortDescription("Your explanation about this property.");
       // then provide a custom category
       propertyDescriptor.setValue(BeanProperty.CATEGORY_LABEL_KEY, "Your custom category");
       
      See Also:
  • Constructor Details

  • Method Details

    • getName

      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 PropertySheet.Item.getDescription().
      Specified by:
      getName in interface PropertySheet.Item
    • getDescription

      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 PropertySheet.Item.getName() method.
      Specified by:
      getDescription in interface PropertySheet.Item
    • getType

      public Class<?> getType()
      Returns the class type of the property.
      Specified by:
      getType in interface PropertySheet.Item
    • getValue

      public Object getValue()
      Returns the current value of the property.
      Specified by:
      getValue in interface PropertySheet.Item
    • setValue

      public void setValue(Object value)
      Sets the current value of the property.
      Specified by:
      setValue in interface PropertySheet.Item
    • getCategory

      public String getCategory()
      Returns a String representation of the category of the property. This is relevant when the PropertySheet mode property is set to PropertySheet.Mode.CATEGORY - as then all properties with the same category will be grouped together visually.
      Specified by:
      getCategory in interface PropertySheet.Item
    • getBean

      public Object getBean()
      Returns:
      The object passed in to the constructor of the BeanProperty.
    • getPropertyDescriptor

      public PropertyDescriptor getPropertyDescriptor()
      Returns:
      The PropertyDescriptor passed in to the constructor of the BeanProperty.
    • getPropertyEditorClass

      public 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
      Specified by:
      getPropertyEditorClass in interface PropertySheet.Item
    • isEditable

      public boolean isEditable()
      Indicates whether the PropertySheet should allow editing of this property, or whether it is read-only. The default implementation returns true.
      Specified by:
      isEditable in interface PropertySheet.Item
    • setEditable

      public void setEditable(boolean editable)
      Parameters:
      editable - Whether this property should be editable in the PropertySheet.
    • getObservableValue

      public Optional<javafx.beans.value.ObservableValue<? extends Object>> getObservableValue()
      Returns the underlying ObservableValue, where one exists, that the editor can monitor for changes.
      Specified by:
      getObservableValue in interface PropertySheet.Item