Top Description Inners Fields Constructors Methods
javafx.beans.property

public abstract Class MapPropertyBase<K, V>

extends MapProperty<K, V>
Class Inheritance
Known Direct Subclasses
javafx.beans.property.SimpleMapProperty
Type Parameters
<K>
the type of the key elements of the Map
<V>
the type of the value elements of the Map
Imports
com.sun.javafx.binding.MapExpressionHelper, java.lang.ref.WeakReference, javafx.beans.InvalidationListener, .Observable, .WeakListener, javafx.beans.value.ChangeListener, .ObservableValue, javafx.collections.*

The class MapPropertyBase is the base class for a property wrapping an javafx.collections.ObservableMap. It provides all the functionality required for a property except for the getBean() and getName() methods, which must be implemented by extending classes.
Since
JavaFX 2.1
See Also
javafx.collections.ObservableMap, MapProperty

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
private class

Field Summary

Modifier and TypeField and Description
private MapPropertyBase<K, V>.EmptyProperty
private MapExpressionHelper<K, V>
private InvalidationListener
private final MapChangeListener<K, V>
private ObservableValue<? extends ObservableMap<K, V>>
private MapPropertyBase<K, V>.SizeProperty
private boolean
private ObservableMap<K, V>

Constructor Summary

AccessConstructor and Description
public
MapPropertyBase()

The Constructor of MapPropertyBase

public
MapPropertyBase(ObservableMap<K, V>
the initial value of the wrapped value
initialValue
)

The constructor of the MapPropertyBase.

Method Summary

Modifier and TypeMethod and Description
public void
addListener(InvalidationListener
The listener to register
listener
)

Implements javafx.beans.Observable.addListener.

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid.

public void
addListener(ChangeListener<? super ObservableMap<K, V>>
The listener to register
listener
)

Implements javafx.beans.value.ObservableValue.addListener.

Adds a ChangeListener which will be notified whenever the value of the ObservableValue changes.

public void
addListener(MapChangeListener<? super K, ? super V>
the listener for listening to the list changes
listener
)

Implements javafx.collections.ObservableMap.addListener.

Add a listener to this observable map.

public void
bind(final ObservableValue<? extends ObservableMap<K, V>>
The observable this Property should be bound to.
newObservable
)

Implements javafx.beans.property.Property.bind.

Create a unidirection binding for this Property.

public ReadOnlyBooleanProperty
emptyProperty()

Implements abstract javafx.beans.binding.MapExpression.emptyProperty.

A boolean property that is true, if the map is empty.

protected void
protected void
fireValueChangedEvent(MapChangeListener.Change<? extends K, ? extends V>
the change that needs to be propagated
change
)

Sends notifications to all attached InvalidationListeners, ChangeListeners, and javafx.collections.MapChangeListener.

public ObservableMap<K, V>
protected void
invalidated()

The method invalidated() can be overridden to receive invalidation notifications.

private void
public boolean
isBound()

Implements javafx.beans.property.Property.isBound.

Can be used to check, if a Property is bound.

private void
markInvalid(ObservableMap<K, V> oldValue)

public void
removeListener(InvalidationListener
The listener to remove
listener
)

Implements javafx.beans.Observable.removeListener.

Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

public void
removeListener(ChangeListener<? super ObservableMap<K, V>>
The listener to remove
listener
)

Implements javafx.beans.value.ObservableValue.removeListener.

Removes the given listener from the list of listeners that are notified whenever the value of the ObservableValue changes.

public void
removeListener(MapChangeListener<? super K, ? super V>
a listener to remove
listener
)

Implements javafx.collections.ObservableMap.removeListener.

Tries to removed a listener from this observable map.

public void
set(ObservableMap<K, V>
The new value
newValue
)

Implements javafx.beans.value.WritableObjectValue.set.

Set the wrapped value.

public ReadOnlyIntegerProperty
sizeProperty()

Implements abstract javafx.beans.binding.MapExpression.sizeProperty.

An integer property that represents the size of the map.

public String

Returns:

a string representation of this MapPropertyBase object.
toString
()

Overrides javafx.beans.property.MapProperty.toString.

Returns a string representation of this MapPropertyBase object.

public void
unbind()

Implements javafx.beans.property.Property.unbind.

Remove the unidirectional binding for this Property.

Inherited from javafx.beans.property.MapProperty:
bindBidirectionalsetValueunbindBidirectional

Field Detail

empty0back to summary
private MapPropertyBase<K, V>.EmptyProperty empty0
helperback to summary
private MapExpressionHelper<K, V> helper
listenerback to summary
private InvalidationListener listener
mapChangeListenerback to summary
private final MapChangeListener<K, V> mapChangeListener
observableback to summary
private ObservableValue<? extends ObservableMap<K, V>> observable
size0back to summary
private MapPropertyBase<K, V>.SizeProperty size0
validback to summary
private boolean valid
valueback to summary
private ObservableMap<K, V> value

Constructor Detail

MapPropertyBaseback to summary
public MapPropertyBase()

The Constructor of MapPropertyBase

MapPropertyBaseback to summary
public MapPropertyBase(ObservableMap<K, V> initialValue)

The constructor of the MapPropertyBase.

Parameters
initialValue:ObservableMap<K, V>

the initial value of the wrapped value

Method Detail

addListenerback to summary
public void addListener(InvalidationListener listener)

Implements javafx.beans.Observable.addListener.

Doc from javafx.beans.Observable.addListener.

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

Note that the same actual InvalidationListener instance may be safely registered for different Observables.

The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.

Parameters
listener:InvalidationListener

The listener to register

Annotations
@Override
addListenerback to summary
public void addListener(ChangeListener<? super ObservableMap<K, V>> listener)

Implements javafx.beans.value.ObservableValue.addListener.

Doc from javafx.beans.value.ObservableValue.addListener.

Adds a ChangeListener which will be notified whenever the value of the ObservableValue changes. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

Note that the same actual ChangeListener instance may be safely registered for different ObservableValues.

The ObservableValue stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakChangeListener avoid this situation.

Parameters
listener:ChangeListener<? super ObservableMap<K, V>>

The listener to register

Annotations
@Override
addListenerback to summary
public void addListener(MapChangeListener<? super K, ? super V> listener)

Implements javafx.collections.ObservableMap.addListener.

Doc from javafx.collections.ObservableMap.addListener.

Add a listener to this observable map.

Parameters
listener:MapChangeListener<? super K, ? super V>

the listener for listening to the list changes

Annotations
@Override
bindback to summary
public void bind(final ObservableValue<? extends ObservableMap<K, V>> newObservable)

Implements javafx.beans.property.Property.bind.

Doc from javafx.beans.property.Property.bind.

Create a unidirection binding for this Property.

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.

Parameters
newObservable:ObservableValue<? extends ObservableMap<K, V>>

The observable this Property should be bound to.

Annotations
@Override
emptyPropertyback to summary
public ReadOnlyBooleanProperty emptyProperty()

Implements abstract javafx.beans.binding.MapExpression.emptyProperty.

Doc from javafx.beans.binding.MapExpression.emptyProperty.

A boolean property that is true, if the map is empty.

Returns:ReadOnlyBooleanProperty

the ReadOnlyBooleanProperty

Annotations
@Override
fireValueChangedEventback to summary
protected void fireValueChangedEvent()

Sends notifications to all attached InvalidationListeners, ChangeListeners, and javafx.collections.MapChangeListener. This method is called when the value is changed, either manually by calling set(javafx.collections.ObservableMap) or in case of a bound property, if the binding becomes invalid.

fireValueChangedEventback to summary
protected void fireValueChangedEvent(MapChangeListener.Change<? extends K, ? extends V> change)

Sends notifications to all attached InvalidationListeners, ChangeListeners, and javafx.collections.MapChangeListener. This method is called when the content of the list changes.

Parameters
change:MapChangeListener.Change<? extends K, ? extends V>

the change that needs to be propagated

getback to summary
public ObservableMap<K, V> get()

Implements javafx.beans.value.WritableObjectValue.get, javafx.beans.value.ObservableObjectValue.get.

Doc from javafx.beans.value.WritableObjectValue.get.

Get the wrapped value. This must be identical to the value returned from getValue().

This method exists only to align WritableObjectValue API with WritableBooleanValue and subclasses of WritableNumberValue

Returns:ObservableMap<K, V>

The current value

Annotations
@Override
invalidatedback to summary
protected void invalidated()

The method invalidated() can be overridden to receive invalidation notifications. This is the preferred option in Objects defining the property, because it requires less memory. The default implementation is empty.

invalidatePropertiesback to summary
private void invalidateProperties()
isBoundback to summary
public boolean isBound()

Implements javafx.beans.property.Property.isBound.

Doc from javafx.beans.property.Property.isBound.

Can be used to check, if a Property is bound.

Returns:boolean

true if the Property is bound, false otherwise

Annotations
@Override
markInvalidback to summary
private void markInvalid(ObservableMap<K, V> oldValue)
removeListenerback to summary
public void removeListener(InvalidationListener listener)

Implements javafx.beans.Observable.removeListener.

Doc from javafx.beans.Observable.removeListener.

Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

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.

Parameters
listener:InvalidationListener

The listener to remove

Annotations
@Override
removeListenerback to summary
public void removeListener(ChangeListener<? super ObservableMap<K, V>> listener)

Implements javafx.beans.value.ObservableValue.removeListener.

Doc from javafx.beans.value.ObservableValue.removeListener.

Removes the given listener from the list of listeners that are notified whenever the value of the ObservableValue changes.

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.

Parameters
listener:ChangeListener<? super ObservableMap<K, V>>

The listener to remove

Annotations
@Override
removeListenerback to summary
public void removeListener(MapChangeListener<? super K, ? super V> listener)

Implements javafx.collections.ObservableMap.removeListener.

Doc from javafx.collections.ObservableMap.removeListener.

Tries to removed a listener from this observable map. If the listener is not attached to this map, nothing happens.

Parameters
listener:MapChangeListener<? super K, ? super V>

a listener to remove

Annotations
@Override
setback to summary
public void set(ObservableMap<K, V> newValue)

Implements javafx.beans.value.WritableObjectValue.set.

Doc from javafx.beans.value.WritableObjectValue.set.

Set the wrapped value. Should be equivalent to setValue(java.lang.Object)

Parameters
newValue:ObservableMap<K, V>

The new value

Annotations
@Override
sizePropertyback to summary
public ReadOnlyIntegerProperty sizeProperty()

Implements abstract javafx.beans.binding.MapExpression.sizeProperty.

Doc from javafx.beans.binding.MapExpression.sizeProperty.

An integer property that represents the size of the map.

Returns:ReadOnlyIntegerProperty

the property

Annotations
@Override
toStringback to summary
public String toString()

Overrides javafx.beans.property.MapProperty.toString.

Returns a string representation of this MapPropertyBase object.

Returns:String

a string representation of this MapPropertyBase object.

Annotations
@Override
unbindback to summary
public void unbind()

Implements javafx.beans.property.Property.unbind.

Doc from javafx.beans.property.Property.unbind.

Remove the unidirectional binding for this Property. If the Property is not bound, calling this method has no effect.

Annotations
@Override
javafx.beans.property back to summary

private Class MapPropertyBase.EmptyProperty

extends ReadOnlyBooleanPropertyBase
Class Inheritance

Field Summary

Inherited from javafx.beans.property.ReadOnlyBooleanPropertyBase:
helper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected void
public boolean
get()

Implements javafx.beans.value.ObservableBooleanValue.get.

Returns the current value of this ObservableBooleanValue.

public Object
getBean()

Implements javafx.beans.property.ReadOnlyProperty.getBean.

Returns the Object that contains this property.

public String
getName()

Implements javafx.beans.property.ReadOnlyProperty.getName.

Returns the name of this property.

Inherited from javafx.beans.property.ReadOnlyBooleanPropertyBase:
addListeneraddListenerremoveListenerremoveListener

Constructor Detail

EmptyPropertyback to summary
private EmptyProperty()

Method Detail

fireValueChangedEventback to summary
protected void fireValueChangedEvent()

Overrides javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent.

Doc from javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent.

Sends notifications to all attached InvalidationListeners and ChangeListeners. This method needs to be called, if the value of this property changes.

Annotations
@Override
getback to summary
public boolean get()

Implements javafx.beans.value.ObservableBooleanValue.get.

Doc from javafx.beans.value.ObservableBooleanValue.get.

Returns the current value of this ObservableBooleanValue.

Returns:boolean

The current value

Annotations
@Override
getBeanback to summary
public Object getBean()

Implements javafx.beans.property.ReadOnlyProperty.getBean.

Doc from javafx.beans.property.ReadOnlyProperty.getBean.

Returns the Object that contains this property. If this property is not contained in an Object, null is returned.

Returns:Object

the containing Object or null

Annotations
@Override
getNameback to summary
public String getName()

Implements javafx.beans.property.ReadOnlyProperty.getName.

Doc from javafx.beans.property.ReadOnlyProperty.getName.

Returns the name of this property. If the property does not have a name, this method returns an empty String.

Returns:String

the name or an empty String

Annotations
@Override
javafx.beans.property back to summary

private Class MapPropertyBase.Listener<K, V>

extends Object
implements InvalidationListener, WeakListener
Class Inheritance
All Implemented Interfaces
javafx.beans.WeakListener, javafx.beans.InvalidationListener

Field Summary

Modifier and TypeField and Description
private final WeakReference<MapPropertyBase<K, V>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
invalidated(Observable
The Observable that became invalid
observable
)

Implements javafx.beans.InvalidationListener.invalidated.

This method needs to be provided by an implementation of InvalidationListener.

public boolean
wasGarbageCollected()

Implements javafx.beans.WeakListener.wasGarbageCollected.

Returns true if the linked listener was garbage-collected.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

wrefback to summary
private final WeakReference<MapPropertyBase<K, V>> wref

Constructor Detail

Listenerback to summary
public Listener(MapPropertyBase<K, V> ref)

Method Detail

invalidatedback to summary
public void invalidated(Observable observable)

Implements javafx.beans.InvalidationListener.invalidated.

Doc from javafx.beans.InvalidationListener.invalidated.

This method needs to be provided by an implementation of InvalidationListener. It is called if an Observable becomes invalid.

In general, it is considered bad practice to modify the observed value in this method.

Parameters
observable:Observable

The Observable that became invalid

Annotations
@Override
wasGarbageCollectedback to summary
public boolean wasGarbageCollected()

Implements javafx.beans.WeakListener.wasGarbageCollected.

Doc from javafx.beans.WeakListener.wasGarbageCollected.

Returns true if the linked listener was garbage-collected. In this case, the listener can be removed from the observable.

Returns:boolean

true if the linked listener was garbage-collected.

Annotations
@Override
javafx.beans.property back to summary

private Class MapPropertyBase.SizeProperty

extends ReadOnlyIntegerPropertyBase
Class Inheritance

Field Summary

Inherited from javafx.beans.property.ReadOnlyIntegerPropertyBase:
helper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected void
public int
get()

Implements javafx.beans.value.ObservableIntegerValue.get.

Returns the current value of this ObservableIntegerValue.

public Object
getBean()

Implements javafx.beans.property.ReadOnlyProperty.getBean.

Returns the Object that contains this property.

public String
getName()

Implements javafx.beans.property.ReadOnlyProperty.getName.

Returns the name of this property.

Inherited from javafx.beans.property.ReadOnlyIntegerPropertyBase:
addListeneraddListenerremoveListenerremoveListener

Constructor Detail

SizePropertyback to summary
private SizeProperty()

Method Detail

fireValueChangedEventback to summary
protected void fireValueChangedEvent()

Overrides javafx.beans.property.ReadOnlyIntegerPropertyBase.fireValueChangedEvent.

Doc from javafx.beans.property.ReadOnlyIntegerPropertyBase.fireValueChangedEvent.

Sends notifications to all attached InvalidationListeners and ChangeListeners. This method needs to be called, if the value of this property changes.

Annotations
@Override
getback to summary
public int get()

Implements javafx.beans.value.ObservableIntegerValue.get.

Doc from javafx.beans.value.ObservableIntegerValue.get.

Returns the current value of this ObservableIntegerValue.

Returns:int

The current value

Annotations
@Override
getBeanback to summary
public Object getBean()

Implements javafx.beans.property.ReadOnlyProperty.getBean.

Doc from javafx.beans.property.ReadOnlyProperty.getBean.

Returns the Object that contains this property. If this property is not contained in an Object, null is returned.

Returns:Object

the containing Object or null

Annotations
@Override
getNameback to summary
public String getName()

Implements javafx.beans.property.ReadOnlyProperty.getName.

Doc from javafx.beans.property.ReadOnlyProperty.getName.

Returns the name of this property. If the property does not have a name, this method returns an empty String.

Returns:String

the name or an empty String

Annotations
@Override