/*
 */

package naoscp.tools;

import com.jcraft.jsch.SftpProgressMonitor;
import javax.swing.JProgressBar;

/**
 *
 * @author claas
 * @author Heinrich Mellmann
 */
public class BarProgressMonitor implements SftpProgressMonitor {
    private final JProgressBar progressBar;
    private long max = 0;
    
    public BarProgressMonitor(JProgressBar progressBar) {
        this.progressBar = progressBar;
    }

    @Override
    public void init(int op, String src, String dest, long max) {
        this.max = max;
        progressBar.setIndeterminate(false);
        progressBar.setValue(0);
        progressBar.setMinimum(0);
        progressBar.setMaximum(100);
        progressBar.setEnabled(true);
    }

    @Override
    public boolean count(long count) {
        long percent = (count * 100) / max;
        progressBar.setValue((int) percent);
        return true;
    }

    @Override
    public void end() {
        progressBar.setEnabled(false);
    }
}

@@ -298,13 +298,41 @@
  0;%0A
+    private long count = 0;%0A
     %0A
-
     
@@ -532,24 +532,48 @@
 .max = max;%0A
+        this.count = 0;%0A
         prog
@@ -804,24 +804,53 @@
 ng count) %7B%0A
+        this.count += count;%0A
         long
@@ -861,16 +861,21 @@
 cent = (
+this.
 count * 

correct progress in NaoSCP