public static class BeanPathAdapter.FieldProperty<BT,T,PT>
extends javafx.beans.property.ObjectPropertyBase<PT>
implements javafx.collections.ListChangeListener<java.lang.Object>, javafx.collections.SetChangeListener<java.lang.Object>, javafx.collections.MapChangeListener<java.lang.Object,java.lang.Object>, javafx.beans.value.ChangeListener<java.lang.Object>
A Property
extension that uses a bean’s getter/setter to define
the Property
's value.
javafx.collections.ListChangeListener.Change<E>
Modifier | Constructor and Description |
---|---|
protected |
FieldProperty(BT bean,
java.lang.String fullPath,
java.lang.String fieldName,
jfxtras.labs.scene.control.BeanPathAdapter.FieldPathValueProperty notifyProperty,
java.lang.Class<T> declaredFieldType,
java.lang.String collectionItemPath,
javafx.beans.Observable collectionObservable,
java.lang.Class<?> collectionType,
javafx.scene.control.SelectionModel<?> collectionSelectionModel,
BeanPathAdapter.FieldProperty<?,?,?> itemMaster)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addRemoveCollectionListener(javafx.beans.Observable observable,
boolean add)
Adds/Removes the
BeanPathAdapter.FieldProperty as a collection listener |
void |
changed(javafx.beans.value.ObservableValue<? extends java.lang.Object> observable,
java.lang.Object oldValue,
java.lang.Object newValue)
Detects
itemMaster changes for selection synchronization |
protected BeanPathAdapter.FieldProperty<java.lang.Object,?,?> |
extractCollectionItemFieldProperty(BeanPathAdapter.FieldBean<java.lang.Void,java.lang.Object> fieldBean)
Extracts the collections
BeanPathAdapter.FieldProperty from an associated
BeanPathAdapter.FieldBean |
protected BeanPathAdapter.FieldProperty<?,?,?> |
genCollectionFieldProperty(java.lang.Object bean)
Generates a
BeanPathAdapter.FieldProperty for a
getCollectionItemPath() and
getCollectionSelectionModel() when applicable |
protected BeanPathAdapter.FieldProperty<?,?,?> |
genFieldProperty(java.lang.Object itemBeanValue,
java.lang.Object itemBeanPropertyValue)
Generates a
BeanPathAdapter.FieldProperty using the specified bean and sets
the optional value on the bean (when the value is not null). |
PT |
get() |
BT |
getBean() |
java.lang.String |
getCollectionItemPath() |
protected javafx.beans.Observable |
getCollectionObservable() |
protected javafx.scene.control.SelectionModel<java.lang.Object> |
getCollectionSelectionModel() |
java.lang.Class<?> |
getDeclaredFieldType() |
java.lang.Object |
getDirty() |
java.lang.Class<T> |
getFieldType() |
java.lang.String |
getName() |
boolean |
hasCollectionItemPath() |
protected boolean |
hasDefaultDerived() |
protected boolean |
hasFieldPathValueTypeAddOrRemove(boolean add)
Determines if the
FieldPathValueProperty is registered for
adds or removals |
boolean |
hasItemMaster() |
boolean |
isList() |
boolean |
isMap() |
protected boolean |
isObservableList() |
protected static boolean |
isObservableList(javafx.beans.Observable observable) |
protected boolean |
isObservableMap() |
protected static boolean |
isObservableMap(javafx.beans.Observable observable) |
protected boolean |
isObservableSet() |
protected static boolean |
isObservableSet(javafx.beans.Observable observable) |
boolean |
isSet() |
protected BeanPathAdapter.FieldPathValue |
newSyncCollectionFieldPathValue(BeanPathAdapter.FieldProperty<?,?,?> fp,
java.lang.Object fpv,
boolean isAdd)
Creates a new
BeanPathAdapter.FieldPathValue using specified
BeanPathAdapter.FieldProperty or the current BeanPathAdapter.FieldProperty when the
specified BeanPathAdapter.FieldProperty is null. |
void |
onChanged(javafx.collections.ListChangeListener.Change<? extends java.lang.Object> change) |
void |
onChanged(javafx.collections.MapChangeListener.Change<? extends java.lang.Object,? extends java.lang.Object> change) |
void |
onChanged(javafx.collections.SetChangeListener.Change<? extends java.lang.Object> change) |
protected void |
postSet(java.lang.Object prevValue)
Executes any post processing that needs to take place after set
operation takes place
|
void |
set(java.lang.Object v)
Sets an
Object value |
protected void |
setDerived()
Sets the
FieldHandle#deriveValueFromAccessor() value |
void |
setDirty(java.lang.Object v)
Flags the
Property value as dirty and calls
set(Object) |
protected void |
setFieldPathValues(java.util.Collection<BeanPathAdapter.FieldPathValue> fieldPathValues)
|
protected void |
setTarget(BT bean)
Binds a new target to the
BeanPathAdapter.FieldHandle |
protected java.lang.Object |
updateCollectionItemProperty(java.lang.Object itemBeanPropertyValue)
Updates the underlying collection item value
|
addListener, addListener, bind, fireValueChangedEvent, invalidated, isBound, removeListener, removeListener, toString, unbind
bindBidirectional, setValue, unbindBidirectional
asString, asString, asString, getValue, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, isNotNull, isNull, objectExpression
protected FieldProperty(BT bean, java.lang.String fullPath, java.lang.String fieldName, jfxtras.labs.scene.control.BeanPathAdapter.FieldPathValueProperty notifyProperty, java.lang.Class<T> declaredFieldType, java.lang.String collectionItemPath, javafx.beans.Observable collectionObservable, java.lang.Class<?> collectionType, javafx.scene.control.SelectionModel<?> collectionSelectionModel, BeanPathAdapter.FieldProperty<?,?,?> itemMaster)
Constructor
bean
- the bean that the path belongs tofullPath
- the full <code>.</code> separated path to the
BeanPathAdapter.FieldProperty
fieldName
- the name of the field within the beannotifyProperty
- the FieldPathValueProperty
that will be set every
time the ObjectProperty.setValue(Object)
is
performed or an item within the value is changeddeclaredFieldType
- the declared Class
of the fieldcollectionItemPath
- the the <code>.</code> separated field names of the
Observable
collection (only applicable when the
Observable
is a ObservableList
,
ObservableSet
, or ObservableMap
)collectionObservable
- the Observable
Collection
used to bind to
the BeanPathAdapter.FieldProperty
<b>OR</b> when the
SelectionModel
is specified this is the
Observable
Collection
of available items
to select fromcollectionType
- the Collection
Class
used to attempt to
transform the underlying field Observable
Collection
to the Collection
Class
(only applicable when the actual field is a
Collection
)collectionSelectionModel
- the SelectionModel
used to set the values within
the Observable
<b>only applicable when the
Observable
is used for selection(s) and therefore
cannot be updated directly because it is read-only</b>itemMaster
- the BeanPathAdapter.FieldProperty
that contains the item(s) that
the SelectionModel
can select frompublic PT get()
protected void setDerived()
Sets the FieldHandle#deriveValueFromAccessor()
value
public void setDirty(java.lang.Object v)
Flags the Property
value as dirty and calls
set(Object)
v
- the value to setpublic void set(java.lang.Object v)
Sets an Object
value
protected final void postSet(java.lang.Object prevValue) throws java.lang.Throwable
Executes any post processing that needs to take place after set operation takes place
prevValue
- the ObjectExpression.getValue()
before ObjectProperty.setValue(Object)
was calledjava.lang.Throwable
- thrown when any errors occur when processing a post set
operationprotected BeanPathAdapter.FieldPathValue newSyncCollectionFieldPathValue(BeanPathAdapter.FieldProperty<?,?,?> fp, java.lang.Object fpv, boolean isAdd)
Creates a new BeanPathAdapter.FieldPathValue
using specified
BeanPathAdapter.FieldProperty
or the current BeanPathAdapter.FieldProperty
when the
specified BeanPathAdapter.FieldProperty
is null.
fp
- the BeanPathAdapter.FieldProperty
(optional)fpv
- the ObjectExpression.getValue()
isAdd
- true when adding an itemBeanPathAdapter.FieldPathValue
protected boolean hasFieldPathValueTypeAddOrRemove(boolean add)
Determines if the FieldPathValueProperty
is registered for
adds or removals
add
- true to check for add, false to check for removeFieldPathValueProperty
is registered
for the add or removeprotected void setFieldPathValues(java.util.Collection<BeanPathAdapter.FieldPathValue> fieldPathValues)
Sets a Collection
of BeanPathAdapter.FieldPathValue
(s) on the
notifyProperty
fieldPathValues
- the Collection
of BeanPathAdapter.FieldPathValue
(s) to setprotected BeanPathAdapter.FieldProperty<?,?,?> genFieldProperty(java.lang.Object itemBeanValue, java.lang.Object itemBeanPropertyValue)
Generates a BeanPathAdapter.FieldProperty
using the specified bean and sets
the optional value on the bean (when the value is not null). The
returned BeanPathAdapter.FieldProperty
will contain the same value instance
contained with the item master. When the item master is not available
an attempt will be made to get the item value from the
getDirty()
collection/map.
itemBeanValue
- the collection BeanPathAdapter.FieldBean
value to add/update. when
null
the existing BeanPathAdapter.FieldBean
value will
will be used unless it is null
as well- in which
case an attempt will be made to instantiate a new instance
of the bean using a no-argument constructoritemBeanPropertyValue
- the collection BeanPathAdapter.FieldBean
's BeanPathAdapter.FieldProperty
value to add/update (null when no update should be made to
the BeanPathAdapter.FieldBean
's BeanPathAdapter.FieldProperty
value)BeanPathAdapter.FieldProperty
for the collection item (null when
none is required)protected BeanPathAdapter.FieldProperty<?,?,?> genCollectionFieldProperty(java.lang.Object bean)
Generates a BeanPathAdapter.FieldProperty
for a
getCollectionItemPath()
and
getCollectionSelectionModel()
when applicable
bean
- the bean to generate a BeanPathAdapter.FieldProperty
BeanPathAdapter.FieldProperty
protected java.lang.Object updateCollectionItemProperty(java.lang.Object itemBeanPropertyValue)
Updates the underlying collection item value
see updateCollectionItemBean(int, Object, Object)
itemBeanPropertyValue
- the collection BeanPathAdapter.FieldBean
's BeanPathAdapter.FieldProperty
value to add/updategetBean()
when the collection item has
it’s own bean path, the <code>
itemBeanPropertyValue</code> when it does notprotected void addRemoveCollectionListener(javafx.beans.Observable observable, boolean add)
Adds/Removes the BeanPathAdapter.FieldProperty
as a collection listener
observable
- the Observable
collection/map to listen for
changes onadd
- true to add, false to removepublic void changed(javafx.beans.value.ObservableValue<? extends java.lang.Object> observable, java.lang.Object oldValue, java.lang.Object newValue)
Detects itemMaster
changes for selection synchronization
changed
in interface javafx.beans.value.ChangeListener<java.lang.Object>
public final void onChanged(javafx.collections.ListChangeListener.Change<? extends java.lang.Object> change)
onChanged
in interface javafx.collections.ListChangeListener<java.lang.Object>
public final void onChanged(javafx.collections.SetChangeListener.Change<? extends java.lang.Object> change)
onChanged
in interface javafx.collections.SetChangeListener<java.lang.Object>
public final void onChanged(javafx.collections.MapChangeListener.Change<? extends java.lang.Object,? extends java.lang.Object> change)
onChanged
in interface javafx.collections.MapChangeListener<java.lang.Object,java.lang.Object>
public java.lang.Object getDirty()
protected void setTarget(BT bean)
Binds a new target to the BeanPathAdapter.FieldHandle
bean
- the target bean to bind topublic BT getBean()
getBean
in interface javafx.beans.property.ReadOnlyProperty<PT>
public java.lang.String getName()
getName
in interface javafx.beans.property.ReadOnlyProperty<PT>
public java.lang.Class<T> getFieldType()
BeanPathAdapter.FieldHandle.getFieldType()
public java.lang.Class<?> getDeclaredFieldType()
BeanPathAdapter.FieldHandle.getDeclaredFieldType()
protected boolean hasDefaultDerived()
BeanPathAdapter.FieldHandle.hasDefaultDerived()
public boolean isList()
BeanPathAdapter.FieldProperty
is for a List
public boolean isSet()
BeanPathAdapter.FieldProperty
is for a Set
public boolean isMap()
BeanPathAdapter.FieldProperty
is for a Map
protected boolean isObservableList()
BeanPathAdapter.FieldProperty
is bound to an
ObservableList
protected boolean isObservableSet()
BeanPathAdapter.FieldProperty
is bound to an
ObservableSet
protected boolean isObservableMap()
BeanPathAdapter.FieldProperty
is bound to an
ObservableMap
protected static boolean isObservableList(javafx.beans.Observable observable)
observable
- the Observable
to checkObservable
is an ObservableList
protected static boolean isObservableSet(javafx.beans.Observable observable)
observable
- the Observable
to checkObservable
is an ObservableSet
protected static boolean isObservableMap(javafx.beans.Observable observable)
observable
- the Observable
to checkObservable
is an ObservableMap
protected BeanPathAdapter.FieldProperty<java.lang.Object,?,?> extractCollectionItemFieldProperty(BeanPathAdapter.FieldBean<java.lang.Void,java.lang.Object> fieldBean)
Extracts the collections BeanPathAdapter.FieldProperty
from an associated
BeanPathAdapter.FieldBean
fieldBean
- the BeanPathAdapter.FieldBean
to extract fromBeanPathAdapter.FieldProperty
public boolean hasCollectionItemPath()
public java.lang.String getCollectionItemPath()
protected javafx.scene.control.SelectionModel<java.lang.Object> getCollectionSelectionModel()
SelectionModel
for the BeanPathAdapter.FieldProperty
when
the field references a collection/map for item selection or
null
when not a selection BeanPathAdapter.FieldProperty
protected javafx.beans.Observable getCollectionObservable()
Observable
used to represent an
ObservableList
, ObservableSet
, or
ObservableMap
(null when either the observable
collection has been garbage collected or the
BeanPathAdapter.FieldProperty
does not represent a collection)public boolean hasItemMaster()
BeanPathAdapter.FieldProperty
has an item master that
it’s using to reference get()
for