hello,
when I have a bean and I want to use a property change listener for
collection members, how can I tell the listener the old state of the
collection?
This is the code for simple fields from the docs:
public void setState(final String newState) {
String oldState = this.state;
this.state = newState;
this.changes.firePropertyChange( "state",
oldState,
newState );
}
and now I want to hook in the firePropertyChange for the following
method which adds some elements to a set:
protected Set<Var> knownVariables = new HashSet<Var>();
public void addKnownVariable(String var) {
this.knownVariables.add(var);
changes.firePropertyChange("knownVariables", OLDSTATE??!,
knownVariables);
}
Will I have to copy the whole collection, switch the complete field
collection object that I can supply the "old state"?
thanks,
Andy