public abstract class StringProperty extends ReadOnlyStringProperty implements Property<String>, WritableStringValue
Property
wrapping a
String
value.
The value of a StringProperty
can be get and set with ObservableObjectValue.get()
,
StringExpression.getValue()
, WritableObjectValue.set(Object)
, and setValue(String)
.
A property can be bound and unbound unidirectional with
Property.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()
.ObservableStringValue
,
WritableStringValue
,
ReadOnlyStringProperty
,
Property
Constructor and Description |
---|
StringProperty() |
Modifier and Type | Method and Description |
---|---|
void |
bindBidirectional(Property<?> other,
Format format)
Create a bidirectional binding between this
StringProperty and another
arbitrary property. |
void |
bindBidirectional(Property<String> other)
Create a bidirectional binding between this
Property and another
one. |
<T> void |
bindBidirectional(Property<T> other,
StringConverter<T> converter)
Create a bidirectional binding between this
StringProperty and another
arbitrary property. |
void |
setValue(String v)
Set the wrapped value.
|
String |
toString()
Returns a string representation of this
StringProperty object. |
void |
unbindBidirectional(Object other)
Remove a bidirectional binding between this
Property and another
one. |
void |
unbindBidirectional(Property<String> other)
Remove a bidirectional binding between this
Property and another
one. |
concat, getValue, getValueSafe, greaterThan, greaterThan, greaterThanOrEqualTo, greaterThanOrEqualTo, isEmpty, isEqualTo, isEqualTo, isEqualToIgnoreCase, isEqualToIgnoreCase, isNotEmpty, isNotEqualTo, isNotEqualTo, isNotEqualToIgnoreCase, isNotEqualToIgnoreCase, isNotNull, isNull, length, lessThan, lessThan, lessThanOrEqualTo, lessThanOrEqualTo, stringExpression
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBean, getName
addListener, getValue, removeListener
addListener, removeListener
get, set
getValue
get
public void setValue(String v)
setValue
in interface WritableValue<String>
v
- The new valuepublic void bindBidirectional(Property<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<String>
other
- the other Property
public void bindBidirectional(Property<?> other, 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
NullPointerException
- if other
or format
is null
IllegalArgumentException
- if other
is this
public <T> void bindBidirectional(Property<T> other, StringConverter<T> converter)
StringProperty
and another
arbitrary property. Relies on an implementation of StringConverter
for conversion.other
- the other Property
converter
- the StringConverter
used to convert between this StringProperty
and the other Property
NullPointerException
- if other
or converter
is null
IllegalArgumentException
- if other
is this
public void unbindBidirectional(Property<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<String>
other
- the other Property
public void unbindBidirectional(Object other)
Property
and another
one.
If no bidirectional binding between the properties exists, calling this
method has no effect.other
- the other Property
NullPointerException
- if other
is null
IllegalArgumentException
- if other
is this
public String toString()
StringProperty
object.toString
in class ReadOnlyStringProperty
StringProperty
object.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.