package com.sunfairs.property;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.apache.log4j.Logger;
public class TorderPropertyChangeListener implements PropertyChangeListener {
private static final Logger logger = Logger.getLogger(TorderPropertyChangeListener.class);
private String properties;
private String oldValues;
private String newValues;
public TorderPropertyChangeListener(){
this.properties = "";
this.oldValues = "";
this.newValues = "";
}
public void propertyChange(PropertyChangeEvent event) {
String property = event.getPropertyName();
String oldValue = String.valueOf(event.getOldValue());
String newValue = String.valueOf(event.getNewValue());
if(!oldValue.equals(newValue) && (oldValue!=null && !newValue.equals(""))){
this.properties=this.properties+","+property;
this.oldValues = this.oldValues+","+oldValue;
this.newValues = this.newValues+","+newValue;
}
logger.info("["+property+":"+oldValue+","+newValue+"]");
}
public String getNewValues() {
return newValues;
}
public String getOldValues() {
return oldValues;
}
public String getProperties() {
return properties;
}
}