public class BeanProperty extends java.lang.Object implements PropertySheet.Item
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.PropertySheet.Item,
PropertySheet,
PropertyDescriptor| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CATEGORY_LABEL_KEY
Unique identifier to provide a custom category label within
PropertySheet.Item#getCategory(). |
| Constructor and Description |
|---|
BeanProperty(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getBean() |
java.lang.String |
getCategory()
Returns a String representation of the category of the property.
|
java.lang.String |
getDescription()
A String that will be shown to the user as a tooltip.
|
java.lang.String |
getName()
Returns the display name of the property, which should be short (i.e.
|
java.util.Optional<javafx.beans.value.ObservableValue<? extends java.lang.Object>> |
getObservableValue()
Returns the underlying ObservableValue, where one exists, that the editor
can monitor for changes.
|
java.beans.PropertyDescriptor |
getPropertyDescriptor() |
java.util.Optional<java.lang.Class<? extends PropertyEditor<?>>> |
getPropertyEditorClass()
Returns an Optional wrapping the class of the PropertyEditor that
should be used for editing this item.
|
java.lang.Class<?> |
getType()
Returns the class type of the property.
|
java.lang.Object |
getValue()
Returns the current value of the property.
|
boolean |
isEditable()
Indicates whether the PropertySheet should allow editing of this
property, or whether it is read-only.
|
void |
setEditable(boolean editable) |
void |
setValue(java.lang.Object value)
Sets the current value of the property.
|
public static final java.lang.String CATEGORY_LABEL_KEY
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");
public BeanProperty(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor)
public java.lang.String getName()
PropertyEditor.
If you need to explain more detail to the user, consider placing it
in the PropertySheet.Item.getDescription().getName in interface PropertySheet.Itempublic java.lang.String getDescription()
PropertySheet.Item.getName()
method.getDescription in interface PropertySheet.Itempublic java.lang.Class<?> getType()
getType in interface PropertySheet.Itempublic java.lang.Object getValue()
getValue in interface PropertySheet.Itempublic void setValue(java.lang.Object value)
setValue in interface PropertySheet.Itempublic java.lang.String getCategory()
PropertySheet
mode property is set to
PropertySheet.Mode.CATEGORY - as then all properties with the same category
will be grouped together visually.getCategory in interface PropertySheet.Itempublic java.lang.Object getBean()
public java.beans.PropertyDescriptor getPropertyDescriptor()
PropertyDescriptor passed in to the constructor of
the BeanProperty.public java.util.Optional<java.lang.Class<? extends PropertyEditor<?>>> getPropertyEditorClass()
getPropertyEditorClass in interface PropertySheet.Itempublic boolean isEditable()
isEditable in interface PropertySheet.Itempublic void setEditable(boolean editable)
editable - Whether this property should be editable in the PropertySheet.public java.util.Optional<javafx.beans.value.ObservableValue<? extends java.lang.Object>> getObservableValue()
getObservableValue in interface PropertySheet.Item