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 Autolisten.

Usage Example:

 public class ViewModelValue extends AutoProperty<ViewModelValue> {
    @Autolisten
    public IntegerProperty myValue;

    public ViewModelValue() {
        loadFields(ViewModelValue.class, this);
    }
 }
 
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Construct a new instance of AutoProperty
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addListener(javafx.beans.InvalidationListener listener)
     
    void
    addListener(javafx.beans.value.ChangeListener<? super T> listener)
     
    void
    bind(javafx.beans.value.ObservableValue<? extends T> observable)
     
    void
    bindBidirectional(javafx.beans.property.Property<T> other)
     
     
    boolean
     
    protected void
    loadFields(Class<?> clazz, T value)
    Load the fields marked with Autolisten from the given class This must be called in the constructor of the subclass
    void
    removeListener(javafx.beans.InvalidationListener listener)
     
    void
    removeListener(javafx.beans.value.ChangeListener<? super T> listener)
     
    void
    setValue(T value)
     
    void
     
    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

      protected void loadFields(Class<?> clazz, T value)
      Load the fields marked with Autolisten 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 subclass
      value - The class instance to listen to
    • addListener

      public void addListener(javafx.beans.value.ChangeListener<? super T> listener)
      Specified by:
      addListener in interface javafx.beans.value.ObservableValue<T extends javafx.beans.property.Property<T>>
    • removeListener

      public void removeListener(javafx.beans.value.ChangeListener<? super T> listener)
      Specified by:
      removeListener in interface javafx.beans.value.ObservableValue<T extends javafx.beans.property.Property<T>>
    • addListener

      public void addListener(javafx.beans.InvalidationListener listener)
      Specified by:
      addListener in interface javafx.beans.Observable
    • removeListener

      public void removeListener(javafx.beans.InvalidationListener listener)
      Specified by:
      removeListener in interface javafx.beans.Observable
    • bind

      public void bind(javafx.beans.value.ObservableValue<? extends T> observable)
      Specified by:
      bind in interface javafx.beans.property.Property<T extends javafx.beans.property.Property<T>>
    • unbind

      public void unbind()
      Specified by:
      unbind in interface javafx.beans.property.Property<T extends javafx.beans.property.Property<T>>
    • isBound

      public boolean isBound()
      Specified by:
      isBound in interface javafx.beans.property.Property<T extends javafx.beans.property.Property<T>>
    • bindBidirectional

      public void bindBidirectional(javafx.beans.property.Property<T> other)
      Specified by:
      bindBidirectional in interface javafx.beans.property.Property<T extends javafx.beans.property.Property<T>>
    • unbindBidirectional

      public void unbindBidirectional(javafx.beans.property.Property<T> other)
      Specified by:
      unbindBidirectional in interface javafx.beans.property.Property<T extends javafx.beans.property.Property<T>>
    • getBean

      public Object getBean()
      Specified by:
      getBean in interface javafx.beans.property.ReadOnlyProperty<T extends javafx.beans.property.Property<T>>
    • setValue

      public void setValue(T value)
      Specified by:
      setValue in interface javafx.beans.value.WritableValue<T extends javafx.beans.property.Property<T>>