package net.sf.ij.vtk;

import ij.IJ;
import vtk.vtkProcessObject;

/**
 * Created by IntelliJ IDEA.
 * User: jarek
 * Date: Feb 5, 2003
 * Time: 10:13:00 PM
 * To change this template use Options | File Templates.
 * FIX: Use vtkObject.AddObserver for ProcessEvent instead of depreciated SetProgressMethod.
 * FIX: Javadoc comments
 */
public class VtkProgressObserver {
  vtkProcessObject processObject;

  public VtkProgressObserver(vtkProcessObject processObject) {
    this.processObject = processObject;
    // FIX: Enable  SetProgressMethod or equivalent
//    processObject.SetProgressMethod(this, "progressMethod");
  }

  public void progressMethod() {
    double progress = processObject.GetProgress();
    String processObjectName = processObject.GetClassName();
    IJ.showStatus(processObjectName + " " + (int) (progress * 100) + "%");
    IJ.showProgress(progress);
//    System.out.println("Process object  : "+processObjectName);
//    System.out.println("Progress        : "+progress);
//    System.out.println("ProgressMaxValue: "+processObject.GetProgressMaxValue());
//    System.out.println("ProgressMinValue: "+processObject.GetProgressMinValue());
//    System.out.println("ProgressText    : "+processObject.GetProgressText());
  }
}

@@ -1,336 +1,1022 @@
-package net.sf.ij.vtk;%0A%0Aimport ij.IJ;%0Aimport vtk.vtkProcessObject;%0A%0A/**%0A * Created by IntelliJ IDEA.%0A * User: jarek%0A * Date: Feb 5, 2003%0A * Time: 10:13:00 PM%0A * To change this template use Options %7C File Templates.%0A * FIX: Use vtkObject.AddObserver for ProcessEvent instead of depreciated SetProgressMethod.%0A * FIX: Javadoc comments
+/***%0A * Image/J Plugins%0A * Copyright (C) 2002-2004 Jarek Sacha%0A *%0A * This library is free software; you can redistribute it and/or%0A * modify it under the terms of the GNU Lesser General Public%0A * License as published by the Free Software Foundation; either%0A * version 2.1 of the License, or (at your option) any later version.%0A *%0A * This library is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this library; if not, write to the Free Software%0A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A *%0A * Latest release available at http://sourceforge.net/projects/ij-plugins/%0A */%0Apackage net.sf.ij.vtk;%0A%0Aimport ij.IJ;%0Aimport vtk.vtkProcessObject;%0A%0A/**%0A * Can monitor progress event generated by a vtkProcessObject.
 %0A */
@@ -1053,16 +1053,18 @@
 ver %7B%0A  
+ 
+ 
 vtkProce
@@ -1088,16 +1088,18 @@
 bject;%0A%0A
+  
   public
@@ -1157,16 +1157,20 @@
 ) %7B%0A    
+  
+  
 this.pro
@@ -1205,94 +1205,55 @@
     
-// FIX: Enable  SetProgressMethod or equivalent%0A//    processObject.SetProgressMethod(
+    processObject.AddObserver(%22ProgressEvent%22, 
 this
@@ -1277,15 +1277,19 @@
 %22);%0A
+  
   %7D%0A%0A  
+ 
+ 
 publ
@@ -1311,24 +1311,28 @@
 sMethod() %7B%0A
+    
     double p
@@ -1366,24 +1366,28 @@
 Progress();%0A
+    
     String p
@@ -1431,24 +1431,28 @@
 lassName();%0A
+    
     IJ.showS
@@ -1510,24 +1510,28 @@
 00) + %22%25%22);%0A
+    
     IJ.showP
@@ -1920,14 +1920,16 @@
 ext());%0A
+  
   %7D%0A%7D%0A

Remove obsolete use of SetProgressMethod.