package turgen;
import java.util.*;
import turgen.generator.ProgressSource;
import java.awt.event.*;


/** Timer listener. This updates progress bars*/

public class ProgressUpdater implements ActionListener {
    
    
    public void actionPerformed(ActionEvent e) {
        
        Set s = Turgen.sync.panelMap.keySet();
        if (s.size() == 0) {
            return;
        }

        GeneratorPanel[] pans = new GeneratorPanel[s.size()];
        s.toArray(pans);

        for (int i = 0; i < pans.length; i++) {
            Object o = Turgen.sync.panelMap.get(pans[i]);
            if (o != null) {
                ProgressSource g = (ProgressSource) o;
                int progress = g.getStatusPercent();
                if (pans[i] != null) {
                    String sts = g.getStatusString();
                    if (sts != null) {
                        pans[i].progress.setString(sts);
                    }
                    pans[i].progress.setValue(progress);
                }
            } else {
            }
        }


    }
    
    
    
    
  
    
}
