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 TypeMethodDescriptionvoidaddListener(javafx.beans.InvalidationListener listener) voidaddListener(javafx.beans.value.ChangeListener<? super T> listener) voidvoidbindBidirectional(javafx.beans.property.Property<T> other) getBean()booleanisBound()protected voidloadFields(Class<?> clazz, T value) Load the fields marked withAutolistenfrom the given class This must be called in the constructor of the subclassvoidremoveListener(javafx.beans.InvalidationListener listener) voidremoveListener(javafx.beans.value.ChangeListener<? super T> listener) voidvoidunbind()voidunbindBidirectional(javafx.beans.property.Property<T> other) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javafx.beans.value.ObservableValue
flatMap, getValue, map, orElse, whenMethods inherited from interface javafx.beans.property.ReadOnlyProperty
getNameMethods 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 withAutolistenfrom 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:
addListenerin interfacejavafx.beans.Observable
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener) - Specified by:
removeListenerin interfacejavafx.beans.Observable
-
bind
-
unbind
public void unbind() -
isBound
public boolean isBound() -
bindBidirectional
-
unbindBidirectional
-
getBean
-
setValue
-