JavaBeanStringProperty provides an adapter between a regular
Java Bean property of type String and a JavaFX
StringProperty. It cannot be created directly, but a
JavaBeanStringPropertyBuilder has to be used.
As a minimum, the Java Bean class must implement a getter and a setter for the
property.
The class, as well as the getter and a setter methods, must be declared public.
If the getter of an instance of this class is called, the property of
the Java Bean is returned. If the setter is called, the value will be passed
to the Java Bean property. If the Java Bean property is bound (i.e. it supports
PropertyChangeListeners), this JavaBeanStringProperty will be
aware of changes in the Java Bean. Otherwise it can be notified about
changes by calling fireValueChangedEvent(). If the Java Bean property
is also constrained (i.e. it supports VetoableChangeListeners), this
JavaBeanStringProperty will reject changes, if it is bound to an
ObservableValue<String>.
Deploying an Application as a Module
If the Java Bean class is in a named module, then it must be reflectively
accessible to the javafx.base module.
A class is reflectively accessible if the module
opens the containing package to at
least the javafx.base module.
For example, if com.foo.MyBeanClass is in the foo.app module,
the module-info.java might
look like this:
module foo.app {
opens com.foo to javafx.base;
}
Alternatively, a class is reflectively accessible if the module
exports the containing package
unconditionally.
javafx.beans.property.StringProperty , JavaBeanStringPropertyBuilder
| Modifier and Type | Field and Description |
|---|---|
| private final PropertyDescriptor | |
| private ExpressionHelper | |
| private final PropertyDescriptor | |
| private ObservableValue |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | addListener(ChangeListener<? super String>
The listener to register listener)Implements javafx. Adds a |
| public void | addListener(InvalidationListener
The listener to register listener)Implements javafx. Adds an |
| public void | bind(ObservableValue<? extends String>
The observable this observable)Property should be bound to.Implements javafx. Create a unidirection binding for this |
| public void | dispose()
Implements javafx. Signals to the JavaFX property that it will not be used anymore and any references can be removed. |
| public void | fireValueChangedEvent()
Implements javafx. This method can be called to notify the adapter of a change of the Java Bean value, if the Java Bean property is not bound (i.e. it does not support PropertyChangeListeners). |
| public String | get()
Implements javafx. Get the wrapped value. |
| public Object | getBean()
Implements javafx. Returns the |
| public String | getName()
Implements javafx. Returns the name of this property. |
| public boolean | isBound()
Implements javafx. Can be used to check, if a |
| public void | removeListener(ChangeListener<? super String>
The listener to remove listener)Implements javafx. Removes the given listener from the list of listeners that are notified
whenever the value of the |
| public void | removeListener(InvalidationListener
The listener to remove listener)Implements javafx. Removes the given listener from the list of listeners, that are notified
whenever the value of the |
| public void | set(final String
The new value value)Implements javafx. Set the wrapped value. |
| public void | unbind()
Implements javafx. Remove the unidirectional binding for this |
| descriptor | back to summary |
|---|---|
| private final PropertyDescriptor<String> descriptor | |
| helper | back to summary |
|---|---|
| private ExpressionHelper<String> helper | |
| listener | back to summary |
|---|---|
| private final PropertyDescriptor<String>. | |
| observable | back to summary |
|---|---|
| private ObservableValue<? extends String> observable | |
| JavaBeanStringProperty | back to summary |
|---|---|
| pack-priv JavaBeanStringProperty(PropertyDescriptor<String> descriptor, Object bean) | |
| addListener | back to summary |
|---|---|
| public void addListener(ChangeListener<? super String> listener) Implements javafx. Doc from javafx. Adds a
Note that the same actual
The
| |
| addListener | back to summary |
|---|---|
| public void addListener(InvalidationListener listener) Implements javafx. Doc from javafx. Adds an
Note that the same actual
The
| |
| bind | back to summary |
|---|---|
| public void bind(ObservableValue<? extends String> observable) Implements javafx. Doc from javafx. Create a unidirection binding for this Note that JavaFX has all the bind calls implemented through weak listeners. This means the bound property can be garbage collected and stopped from being updated.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements javafx. Doc from javafx. Signals to the JavaFX property that it will not be used anymore and any references can be removed. A call of this method usually results in the property stopping to observe the Java Bean property by unregistering its listener(s).
| |
| fireValueChangedEvent | back to summary |
|---|---|
| public void fireValueChangedEvent() Implements javafx. Doc from javafx. This method can be called to notify the adapter of a change of the Java Bean value, if the Java Bean property is not bound (i.e. it does not support PropertyChangeListeners).
| |
| get | back to summary |
|---|---|
| public String get() Implements javafx. Doc from javafx. Get the wrapped value. This must be identical to
the value returned from
This method exists only to align WritableObjectValue API with
| |
| getBean | back to summary |
|---|---|
| public Object getBean() Implements javafx. Doc from javafx. Returns the | |
| getName | back to summary |
|---|---|
| public String getName() Implements javafx. Doc from javafx. Returns the name of this property. If the property does not have a name,
this method returns an empty | |
| isBound | back to summary |
|---|---|
| public boolean isBound() Implements javafx. Doc from javafx. Can be used to check, if a
| |
| removeListener | back to summary |
|---|---|
| public void removeListener(ChangeListener<? super String> listener) Implements javafx. Doc from javafx. Removes the given listener from the list of listeners that are notified
whenever the value of the If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
| |
| removeListener | back to summary |
|---|---|
| public void removeListener(InvalidationListener listener) Implements javafx. Doc from javafx. Removes the given listener from the list of listeners, that are notified
whenever the value of the If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
| |
| set | back to summary |
|---|---|
| public void set(final String value) Implements javafx. Doc from javafx. Set the wrapped value.
Should be equivalent to
| |
| unbind | back to summary |
|---|---|
| public void unbind() Implements javafx. Doc from javafx. Remove the unidirectional binding for this
| |