You could take advantage of the property change support by firing a new property change event when you update the "section" progress.
There are a number of ways you could achieve, depending on the information you have available.
You could call it directly using something like
firePropertyChange("sectionProgress", oldProgress, newProgress);
Now obviously, you run into the dreaded ETD sync issue, as the firePropertyChange
method is not thread safe.
But you could create a simple Updater
class that implements Runnable
inside your SwingWorker
private class TwoWorker extends SwingWorker<Double, Double> {
protected Double doInBackGround() throws Exception {
//... Do some work
SwingUtilities.invokeLater(new Updater(oldProgress, newProgress));
}
public class Updater implements Runnable {
private int oldProgress;
private int newProgress;
public Updater(int oldProgress, int newProgress) {
this.oldProgress = oldProgress;
this.newProgress = newProgress;
}
public void run() {
firePropertyChange("sectionProgress", oldProgress, newProgress);
}
}
}