public abstract class StringProperty extends ReadOnlyStringProperty implements Property<java.lang.String>
Property
wrapping a
String
value.
The value of a StringProperty
can be get and set with #get()
,
#getValue()
, #set(Object)
, and setValue(String)
.
A property can be bound and unbound unidirectional with
#bind(ObservableValue)
and Property.unbind()
. Bidirectional bindings
can be created and removed with bindBidirectional(Property)
and
unbindBidirectional(Property)
.
The context of a StringProperty
can be read with ReadOnlyProperty.getBean()
and ReadOnlyProperty.getName()
.javafx.beans.value.ObservableStringValue
,
javafx.beans.value.WritableStringValue
,
ReadOnlyStringProperty
,
Property
Constructor and Description |
---|
StringProperty() |
Modifier and Type | Method and Description |
---|---|
void |
bindBidirectional(Property<?> other,
java.text.Format format)
Create a bidirectional binding between this
StringProperty and another
arbitrary property. |
void |
bindBidirectional(Property<java.lang.String> other)
Create a bidirectional binding between this
Property and another
one. |
<T> void |
bindBidirectional(Property<T> other,
<any> converter)
Create a bidirectional binding between this
StringProperty and another
arbitrary property. |
void |
setValue(java.lang.String v) |
java.lang.String |
toString()
Returns a string representation of this
StringProperty object. |
void |
unbindBidirectional(java.lang.Object other)
Remove a bidirectional binding between this
Property and another
one. |
void |
unbindBidirectional(Property<java.lang.String> other)
Remove a bidirectional binding between this
Property and another
one. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBean, getName
public void setValue(java.lang.String v)
public void bindBidirectional(Property<java.lang.String> other)
Property
and another
one.
Bidirectional bindings exists independently of unidirectional bindings. So it is possible to
add unidirectional binding to a property with bidirectional binding and vice-versa. However, this practice is
discouraged.
It is possible to have multiple bidirectional bindings of one Property.
JavaFX bidirectional binding implementation use weak listeners. This means bidirectional binding does not prevent properties from being garbage collected.
bindBidirectional
in interface Property<java.lang.String>
other
- the other Property
public void bindBidirectional(Property<?> other, java.text.Format format)
StringProperty
and another
arbitrary property. Relies on an implementation of Format
for conversion.other
- the other Property
format
- the Format
used to convert between this StringProperty
and the other Property
java.lang.NullPointerException
- if other
or format
is null
java.lang.IllegalArgumentException
- if other
is this
public <T> void bindBidirectional(Property<T> other, <any> converter)
StringProperty
and another
arbitrary property. Relies on an implementation of StringConverter
for conversion.T
- the type of the wrapped Object
other
- the other Property
converter
- the StringConverter
used to convert between this StringProperty
and the other Property
java.lang.NullPointerException
- if other
or converter
is null
java.lang.IllegalArgumentException
- if other
is this
public void unbindBidirectional(Property<java.lang.String> other)
Property
and another
one.
If no bidirectional binding between the properties exists, calling this
method has no effect.
It is possible to unbind by a call on the second property. This code will work:
property1.bindBirectional(property2); property2.unbindBidirectional(property1);
unbindBidirectional
in interface Property<java.lang.String>
other
- the other Property
public void unbindBidirectional(java.lang.Object other)
Property
and another
one.
If no bidirectional binding between the properties exists, calling this
method has no effect.other
- the other Property
java.lang.NullPointerException
- if other
is null
java.lang.IllegalArgumentException
- if other
is this
public java.lang.String toString()
StringProperty
object.toString
in class ReadOnlyStringProperty
StringProperty
object.