package Framework;
import DisplayProject.binding.beans.PropertyConnector;
/**
* A mapped TextData is a class that is bound to a property of an object. When this value changes,
* the bound object property will change, and vice versa. THis is implemented as a package visible
* subclass of TextData owning to the cost of having TextData implement finalize, and the number
* of TextDatas that make it onto the finalizer queue that do not need to be there.
* @author Tim
*
*/
class MappedTextData extends TextData {
/**
* Stores a property connector
*/
private transient PropertyConnector propConnector;
public MappedTextData() {
super();
}
public MappedTextData(Object object, String property) {
super();
/*
* Bind using JGoodies
*
* result.value is bound to object.property
*
*/
PropertyConnector con = new PropertyConnector(this, "value", object, property);
this.propConnector = con;
}
@Override
protected void finalize() throws Throwable {
super.finalize();
if (this.propConnector != null) {
this.propConnector.release();
}
}
}