java.lang.Object
org.controlsfx.property.BeanProperty
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Unique identifier to provide a custom category label withinPropertySheet.Item.getCategory()
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBean()
Returns a String representation of the category of the property.A String that will be shown to the user as a tooltip.getName()
Returns the display name of the property, which should be short (i.e.Returns the underlying ObservableValue, where one exists, that the editor can monitor for changes.Optional
<Class<? extends PropertyEditor<?>>> Returns an Optional wrapping the class of the PropertyEditor that should be used for editing this item.Class
<?> getType()
Returns the class type of the property.getValue()
Returns the current value of the property.boolean
Indicates whether the PropertySheet should allow editing of this property, or whether it is read-only.void
setEditable
(boolean editable) void
Sets the current value of the property.
-
Field Details
-
CATEGORY_LABEL_KEY
Unique identifier to provide a custom category label withinPropertySheet.Item.getCategory()
. How to use it: with a PropertyDescriptor, provide the custom category through a a named attributeFeatureDescriptor.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
-
BeanProperty
-
-
Method Details
-
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 thePropertyEditor
. If you need to explain more detail to the user, consider placing it in thePropertySheet.Item.getDescription()
.- Specified by:
getName
in interfacePropertySheet.Item
-
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 thePropertySheet.Item.getName()
method.- Specified by:
getDescription
in interfacePropertySheet.Item
-
getType
Returns the class type of the property.- Specified by:
getType
in interfacePropertySheet.Item
-
getValue
Returns the current value of the property.- Specified by:
getValue
in interfacePropertySheet.Item
-
setValue
Sets the current value of the property.- Specified by:
setValue
in interfacePropertySheet.Item
-
getCategory
Returns a String representation of the category of the property. This is relevant when thePropertySheet
mode property
is set toPropertySheet.Mode.CATEGORY
- as then all properties with the same category will be grouped together visually.- Specified by:
getCategory
in interfacePropertySheet.Item
-
getBean
- Returns:
- The object passed in to the constructor of the BeanProperty.
-
getPropertyDescriptor
- Returns:
- The
PropertyDescriptor
passed in to the constructor of the BeanProperty.
-
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 interfacePropertySheet.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 interfacePropertySheet.Item
-
setEditable
public void setEditable(boolean editable) - Parameters:
editable
- Whether this property should be editable in the PropertySheet.
-
getObservableValue
Returns the underlying ObservableValue, where one exists, that the editor can monitor for changes.- Specified by:
getObservableValue
in interfacePropertySheet.Item
-