Class BoundProperty<T>

java.lang.Object
it.tidalwave.role.ui.BoundProperty<T>
All Implemented Interfaces:
Changeable<T>, ChangingSource<T>

public class BoundProperty<T> extends Object implements ChangingSource<T>, Changeable<T>
Author:
Fabrizio Giudici
  • Field Details

  • Constructor Details

    • BoundProperty

      public BoundProperty()
  • Method Details

    • of

      @Nonnull public static <T> BoundProperty<T> of(@Nonnull T value)
      Creates a new BoundProperty with the given initial value.
      Type Parameters:
      T - the type of the property
      Parameters:
      value - the initial value
      Returns:
      the property
      Since:
      3.2-ALPHA-2
    • set

      public void set(T value)
      Sets a new value to this object. This method fires a property change event associated to PROP_VALUE.
      Specified by:
      set in interface Changeable<T>
      Parameters:
      value - the new value
    • get

      public T get()
      Returns the value of this object.
      Specified by:
      get in interface ChangingSource<T>
      Returns:
      the value
    • bind

      public void bind(@Nonnull ChangingSource<T> source)
      Binds this property to a ChangingSource. Every change in the value of the source will be synchronized to the value of this property. If the source is a Changeable binding will be bidirectional, that is the object will be set to the current value of this property and will be kept in sync.
      Parameters:
      source - the source
    • unbindAll

      public void unbindAll()
      Removes all the bindings of this object.
      Specified by:
      unbindAll in interface ChangingSource<T>