filebot/source/net/sourceforge/tuned/ui/SwingWorkerPropertyChangeAd...

52 lines
977 B
Java
Raw Normal View History

package net.sourceforge.tuned.ui;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.SwingWorker.StateValue;
public abstract class SwingWorkerPropertyChangeAdapter implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent evt) {
2011-11-04 07:45:48 +00:00
if (evt.getPropertyName().equals("progress")) {
progress(evt);
2011-11-04 07:45:48 +00:00
} else if (evt.getPropertyName().equals("state")) {
state(evt);
2011-11-04 07:45:48 +00:00
} else {
event(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
}
protected void state(PropertyChangeEvent evt) {
switch ((StateValue) evt.getNewValue()) {
case STARTED:
started(evt);
break;
case DONE:
done(evt);
break;
}
}
protected void progress(PropertyChangeEvent evt) {
}
protected void started(PropertyChangeEvent evt) {
}
protected void done(PropertyChangeEvent evt) {
}
2011-11-04 07:45:48 +00:00
protected void event(String name, Object oldValue, Object newValue) {
}
}