All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jdesktop.swingworker.SwingWorker.cdiff Maven / Gradle / Ivy

The newest version!
*** /home/idk/work/fixes/6493680/ws/webrev/src/share/classes/javax/swing/SwingWorker.java-	Tue Nov 14 18:22:32 2006
--- SwingWorker.java	Tue Nov 14 17:36:55 2006
***************
*** 6,27 ****
   */
  package javax.swing;
  
  import java.beans.PropertyChangeListener;
  import java.beans.PropertyChangeSupport;
  import java.util.List;
  import java.util.ArrayList;
  import java.util.Collections;
  
  import java.util.concurrent.*;
  import java.util.concurrent.locks.*;
  
  import java.awt.event.*;
  
  import javax.swing.SwingUtilities;
- import javax.swing.event.SwingPropertyChangeSupport;
- 
  
  import sun.awt.AppContext;
  import sun.swing.AccumulativeRunnable;
  
  /**
--- 6,26 ----
   */
  package javax.swing;
  
  import java.beans.PropertyChangeListener;
  import java.beans.PropertyChangeSupport;
+ import java.beans.PropertyChangeEvent;
  import java.util.List;
  import java.util.ArrayList;
  import java.util.Collections;
  
  import java.util.concurrent.*;
  import java.util.concurrent.locks.*;
  
  import java.awt.event.*;
  
  import javax.swing.SwingUtilities;
  
  import sun.awt.AppContext;
  import sun.swing.AccumulativeRunnable;
  
  /**
***************
*** 229,239 ****
      private final FutureTask future;
  
      /**
       * all propertyChangeSupport goes through this.
       */
!     private final SwingPropertyChangeSupport propertyChangeSupport;
  
      /**
       * handler for {@code process} mehtod.
       */
      private AccumulativeRunnable doProcess;
--- 228,238 ----
      private final FutureTask future;
  
      /**
       * all propertyChangeSupport goes through this.
       */
!     private final PropertyChangeSupport propertyChangeSupport;
  
      /**
       * handler for {@code process} mehtod.
       */
      private AccumulativeRunnable doProcess;
***************
*** 287,298 ****
                             setState(StateValue.DONE);
                         }
                     };
  
         state = StateValue.PENDING;
!        propertyChangeSupport = new SwingPropertyChangeSupport(this, true);
! 
         doProcess = null;
         doNotifyProgressChange = null;
      }
      
      /**
--- 286,296 ----
                             setState(StateValue.DONE);
                         }
                     };
  
         state = StateValue.PENDING;
!        propertyChangeSupport = new SwingWorkerPropertyChangeSupport(this);
         doProcess = null;
         doNotifyProgressChange = null;
      }
      
      /**
***************
*** 721,731 ****
                  }
              };
          if (SwingUtilities.isEventDispatchThread()) {
              doDone.run();
          } else {
!             SwingUtilities.invokeLater(doDone);
          }
      }
  
  
      /**
--- 719,729 ----
                  }
              };
          if (SwingUtilities.isEventDispatchThread()) {
              doDone.run();
          } else {
!             doSubmit.add(doDone);
          }
      }
  
  
      /**
***************
*** 874,879 ****
--- 872,898 ----
          }
          public void actionPerformed(ActionEvent event) {
              run();
          }
      }
+     
+     private class SwingWorkerPropertyChangeSupport 
+             extends PropertyChangeSupport {
+         SwingWorkerPropertyChangeSupport(Object source) {
+             super(source);
+         }
+         @Override
+         public void firePropertyChange(final PropertyChangeEvent evt) {
+             if (SwingUtilities.isEventDispatchThread()) {
+                 super.firePropertyChange(evt);
+             } else {
+                 doSubmit.add(
+                     new Runnable() {
+                         public void run() {
+                             SwingWorkerPropertyChangeSupport.this
+                                 .firePropertyChange(evt);
+                         }
+                     });
+             }
+         }
+     }
  }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy