Package dk.gtz.graphedit.viewmodel
Class AutoProperty<T extends javafx.beans.property.Property<T>>
java.lang.Object
dk.gtz.graphedit.viewmodel.AutoProperty<T>
- Type Parameters:
T
- The type of the property
- All Implemented Interfaces:
javafx.beans.Observable
,javafx.beans.property.Property<T>
,javafx.beans.property.ReadOnlyProperty<T>
,javafx.beans.value.ObservableValue<T>
,javafx.beans.value.WritableValue<T>
- Direct Known Subclasses:
ViewModelEdge
,ViewModelGraph
,ViewModelVertex
public abstract class AutoProperty<T extends javafx.beans.property.Property<T>>
extends Object
implements javafx.beans.property.Property<T>
This class is a base class that automatically listen and fire events to changes in their fields marked with
Usage Example:
Autolisten
.
Usage Example:
public class ViewModelValue extends AutoProperty<ViewModelValue> {
@Autolisten
public IntegerProperty myValue;
public ViewModelValue() {
loadFields(ViewModelValue.class, this);
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(javafx.beans.InvalidationListener listener) void
addListener
(javafx.beans.value.ChangeListener<? super T> listener) void
void
bindBidirectional
(javafx.beans.property.Property<T> other) getBean()
boolean
isBound()
protected void
loadFields
(Class<?> clazz, T value) Load the fields marked withAutolisten
from the given class This must be called in the constructor of the subclassvoid
removeListener
(javafx.beans.InvalidationListener listener) void
removeListener
(javafx.beans.value.ChangeListener<? super T> listener) void
void
unbind()
void
unbindBidirectional
(javafx.beans.property.Property<T> other) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javafx.beans.value.ObservableValue
flatMap, getValue, map, orElse, when
Methods inherited from interface javafx.beans.property.ReadOnlyProperty
getName
Methods inherited from interface javafx.beans.value.WritableValue
getValue
-
Constructor Details
-
AutoProperty
protected AutoProperty()Construct a new instance of AutoProperty
-
-
Method Details
-
loadFields
Load the fields marked withAutolisten
from the given class This must be called in the constructor of the subclass- Parameters:
clazz
- The class type to load the fields from, typically the subclassvalue
- The class instance to listen to
-
addListener
-
removeListener
-
addListener
public void addListener(javafx.beans.InvalidationListener listener) - Specified by:
addListener
in interfacejavafx.beans.Observable
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener) - Specified by:
removeListener
in interfacejavafx.beans.Observable
-
bind
-
unbind
public void unbind() -
isBound
public boolean isBound() -
bindBidirectional
-
unbindBidirectional
-
getBean
-
setValue
-