mvvmFX icon indicating copy to clipboard operation
mvvmFX copied to clipboard

Util: PropertyChangeSupport for FX

Open sialcasa opened this issue 10 years ago • 0 comments

I'd like to have a wrapper which allows me to databind with an javafx property to a property of a java bean with propertychangesupport.

public class MyBean { private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);

 public void addPropertyChangeListener(PropertyChangeListener listener) {
     this.pcs.addPropertyChangeListener(listener);
 }

 public void removePropertyChangeListener(PropertyChangeListener listener) {
     this.pcs.removePropertyChangeListener(listener);
 }

 private String value;

 public String getValue() {
     return this.value;
 }

 public void setValue(String newValue) {
     String oldValue = this.value;
     this.value = newValue;
     this.pcs.firePropertyChange("value", oldValue, newValue);
 }

 [...]

}

sialcasa avatar May 12 '15 16:05 sialcasa