Java 类javax.swing.SwingWorker 实例源码

项目:pdfjumbler    文件:ProgressDialog.java   
public static boolean run(SwingWorker<?,?> worker, Frame parent) throws Exception {
    ProgressDialog dialog = new ProgressDialog(parent, worker);
    worker.execute();
    dialog.setVisible(true);
    try {
        worker.get();
    }
    catch (ExecutionException e) {
        if (e.getCause() instanceof CancellationException) {
            return false;
        } else if (e.getCause() instanceof Exception) {
            throw (Exception)e.getCause();
        } else {
            // ?!?
            throw new AssertionError(e);
        }
    }

    return !worker.isCancelled();
}
项目:ftc    文件:ClientController.java   
/**
 * authenticates using existing credentials without triggering the auth
 * workflow does nothing if offline
 */
public void authenticate() {
    if (offline)
        return;

    SwingWorker<ConnectionStatus, Object> connectionWorker = AsyncWork.goUnderground(authFunction,
            authContinuation);
    Events.ui.post(RunState.AUTHENTICATION_STARTED);
    try {
        connectionWorker.execute();
        logging.Info("attempting to authenticate");
        String msgAuthFailed = "authentication failed: ";
        try {
            ConnectionStatus result = connectionWorker.get(clientSettings.authTimeout, TimeUnit.SECONDS);
            if (result.status == HttpStatus.SC_OK)
                logging.Info("authentication succeeded");
            else
                logging.Info(msgAuthFailed + result.message.or("unknown reason"));
        } catch (InterruptedException | ExecutionException | TimeoutException e) {
            connectionWorker.cancel(true);
            logging.Info(String.format("%s %s %s", msgAuthFailed, e.getClass().getSimpleName(), e.getMessage()));
        }
    } finally {
        Events.ui.post(RunState.AUTHENTICATION_FINISHED);
    }
}
项目:FinanceAnalytics    文件:ViewListModel.java   
private void registerListener() {
  _configMaster.changeManager().addChangeListener(new ChangeListener() {
    @Override
    public void entityChanged(ChangeEvent event) {
      SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
        @Override
        protected Void doInBackground() throws Exception {
          pullItems();
          runFilter();
          return null;
        }
      };
      worker.execute();
    }
  });
}
项目:incubator-netbeans    文件:PackageColorer.java   
private static void storeColors() {
    final Properties properties = new Properties();
    final List<ColoredFilter> colors = getRegisteredColors();

    new SwingWorker() {
        protected Object doInBackground() throws Exception {
            for (int i = 0; i < colors.size(); i++) try {
                colors.get(i).store(properties, Integer.toString(i) + "_"); // NOI18N
            } catch (Throwable t) {
                Logger.getLogger(PackageColorer.class.getName()).log(Level.INFO, null, t);
            }

            try {
                ProfilerStorage.saveGlobalProperties(properties, FILTERS_FILE);
            } catch (IOException e) {
                Logger.getLogger(PackageColorer.class.getName()).log(Level.INFO, null, e);
            }

            return null;
        }
    }.execute();
}
项目:rapidminer    文件:UpgradeLicenseAction.java   
/**
 * Creates a new upgrade {@link SwingWorker}.
 * 
 * @return
 */
private static SwingWorker<Void, Void> createUpgradeWorker() {
    return new SwingWorker<Void, Void>() {

        @Override
        protected Void doInBackground() throws Exception {
            RMUrlHandler.handleUrl(URI_LICENSE_UPGRADE);
            return null;
        }

        @Override
        protected void done() {
            try {
                // see if anything failed
                get();
            } catch (ExecutionException | InterruptedException e) {
                LogService.getRoot().log(Level.WARNING,
                        "com.rapidminer.license.gui.actions.UpgradeLicenseAction.failed_to_init_upgrade");
            }
        }
    };
}
项目:jaer    文件:CypressFX3.java   
protected void updateTimestampMasterStatus() {
    final SwingWorker<Void, Void> masterUpdateWorker = new SwingWorker<Void, Void>() {
        @Override
        public Void doInBackground() {
            try {
                final int isMasterSPI = spiConfigReceive(CypressFX3.FPGA_SYSINFO, (short) 2);

                isMaster.set(isMasterSPI != 0);
            }
            catch (HardwareInterfaceException e) {
                // Ignore exceptions.
            }

            return (null);
        }
    };

    masterUpdateWorker.execute();
}
项目:OpenJSharp    文件:XSheet.java   
/**
 * Unsubscribe button action.
 */
private void unregisterListener() {
    new SwingWorker<Boolean, Void>() {
        @Override
        public Boolean doInBackground() {
            return mbeanNotifications.unregisterListener(currentNode);
        }
        @Override
        protected void done() {
            try {
                if (get()) {
                    updateNotifications();
                    validate();
                }
            } catch (Exception e) {
                Throwable t = Utils.getActualException(e);
                if (JConsole.isDebug()) {
                    System.err.println("Problem removing listener");
                    t.printStackTrace();
                }
                showErrorDialog(t.getMessage(),
                        Messages.PROBLEM_REMOVING_LISTENER);
            }
        }
    }.execute();
}
项目:OpenJSharp    文件:XMBeanAttributes.java   
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void,Void> sw = new SwingWorker<Void,Void>() {

       @Override
       protected Void doInBackground() throws Exception {
           SnapshotMBeanServerConnection mbsc =
           mbeansTab.getSnapshotMBeanServerConnection();
           mbsc.flush();
           return null;
       }

       @Override
       protected void done() {
           try {
               get();
               if (stopCellEditing) stopCellEditing();
               loadAttributes(mbean, mbeanInfo);
           } catch (Exception x) {
               if (JConsole.isDebug()) {
                   x.printStackTrace();
               }
           }
       }
    };
    mbeansTab.workerAdd(sw);
}
项目:jdk8u-jdk    文件:XSheet.java   
/**
 * Unsubscribe button action.
 */
private void unregisterListener() {
    new SwingWorker<Boolean, Void>() {
        @Override
        public Boolean doInBackground() {
            return mbeanNotifications.unregisterListener(currentNode);
        }
        @Override
        protected void done() {
            try {
                if (get()) {
                    updateNotifications();
                    validate();
                }
            } catch (Exception e) {
                Throwable t = Utils.getActualException(e);
                if (JConsole.isDebug()) {
                    System.err.println("Problem removing listener");
                    t.printStackTrace();
                }
                showErrorDialog(t.getMessage(),
                        Messages.PROBLEM_REMOVING_LISTENER);
            }
        }
    }.execute();
}
项目:jdk8u-jdk    文件:XMBeanAttributes.java   
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void,Void> sw = new SwingWorker<Void,Void>() {

       @Override
       protected Void doInBackground() throws Exception {
           SnapshotMBeanServerConnection mbsc =
           mbeansTab.getSnapshotMBeanServerConnection();
           mbsc.flush();
           return null;
       }

       @Override
       protected void done() {
           try {
               get();
               if (stopCellEditing) stopCellEditing();
               loadAttributes(mbean, mbeanInfo);
           } catch (Exception x) {
               if (JConsole.isDebug()) {
                   x.printStackTrace();
               }
           }
       }
    };
    mbeansTab.workerAdd(sw);
}
项目:jdk8u-jdk    文件:bug6432565.java   
public static void main(String[] args) throws Exception {
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventProcessor());

    SwingWorker<Void, CharSequence> swingWorker =
        new SwingWorker<Void,CharSequence>() {
            @Override
            protected Void doInBackground() {
                publish(new String[] {"hello"});
                publish(new StringBuilder("world"));
                return null;
            }
            @Override
            protected void done() {
                isDone.set(true);
            }
        };
    swingWorker.execute();

    while (! isDone.get()) {
        Thread.sleep(100);
    }
    if (throwable.get() instanceof ArrayStoreException) {
        throw new RuntimeException("Test failed");
    }
}
项目:openjdk-jdk10    文件:XSheet.java   
/**
 * Unsubscribe button action.
 */
private void unregisterListener() {
    new SwingWorker<Boolean, Void>() {
        @Override
        public Boolean doInBackground() {
            return mbeanNotifications.unregisterListener(currentNode);
        }
        @Override
        protected void done() {
            try {
                if (get()) {
                    updateNotifications();
                    validate();
                }
            } catch (Exception e) {
                Throwable t = Utils.getActualException(e);
                if (JConsole.isDebug()) {
                    System.err.println("Problem removing listener");
                    t.printStackTrace();
                }
                showErrorDialog(t.getMessage(),
                        Messages.PROBLEM_REMOVING_LISTENER);
            }
        }
    }.execute();
}
项目:openjdk-jdk10    文件:XMBeanAttributes.java   
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void,Void> sw = new SwingWorker<Void,Void>() {

       @Override
       protected Void doInBackground() throws Exception {
           SnapshotMBeanServerConnection mbsc =
           mbeansTab.getSnapshotMBeanServerConnection();
           mbsc.flush();
           return null;
       }

       @Override
       protected void done() {
           try {
               get();
               if (stopCellEditing) stopCellEditing();
               loadAttributes(mbean, mbeanInfo);
           } catch (Exception x) {
               if (JConsole.isDebug()) {
                   x.printStackTrace();
               }
           }
       }
    };
    mbeansTab.workerAdd(sw);
}
项目:openjdk-jdk10    文件:bug6432565.java   
public static void main(String[] args) throws Exception {
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventProcessor());

    SwingWorker<Void, CharSequence> swingWorker =
        new SwingWorker<Void,CharSequence>() {
            @Override
            protected Void doInBackground() {
                publish(new String[] {"hello"});
                publish(new StringBuilder("world"));
                return null;
            }
            @Override
            protected void done() {
                isDone.set(true);
            }
        };
    swingWorker.execute();

    while (! isDone.get()) {
        Thread.sleep(100);
    }
    if (throwable.get() instanceof ArrayStoreException) {
        throw new RuntimeException("Test failed");
    }
}
项目:chipKIT-importer    文件:ProgressTrackingStep.java   
@Override
public void readSettings(WizardDescriptor wizardDescriptor) {        
    this.wizardDescriptor = wizardDescriptor;
    this.wizardDescriptor.setOptions( new Object[] { WizardDescriptor.FINISH_OPTION } );

    importWorker.addPropertyChangeListener( (PropertyChangeEvent evt) -> {
        if ( "state".equals( evt.getPropertyName() ) && evt.getNewValue() == SwingWorker.StateValue.DONE ) {
            if ( importWorker.hasFailed() ) {                    
                onImportFailed( importWorker.getException() );
            } else {
                onImportSuccess( importWorker.isMultiConfigBoard() );
            }
        }
    });
    importWorker.execute();                
}
项目:openjdk9    文件:XSheet.java   
/**
 * Unsubscribe button action.
 */
private void unregisterListener() {
    new SwingWorker<Boolean, Void>() {
        @Override
        public Boolean doInBackground() {
            return mbeanNotifications.unregisterListener(currentNode);
        }
        @Override
        protected void done() {
            try {
                if (get()) {
                    updateNotifications();
                    validate();
                }
            } catch (Exception e) {
                Throwable t = Utils.getActualException(e);
                if (JConsole.isDebug()) {
                    System.err.println("Problem removing listener");
                    t.printStackTrace();
                }
                showErrorDialog(t.getMessage(),
                        Messages.PROBLEM_REMOVING_LISTENER);
            }
        }
    }.execute();
}
项目:openjdk9    文件:XMBeanAttributes.java   
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void,Void> sw = new SwingWorker<Void,Void>() {

       @Override
       protected Void doInBackground() throws Exception {
           SnapshotMBeanServerConnection mbsc =
           mbeansTab.getSnapshotMBeanServerConnection();
           mbsc.flush();
           return null;
       }

       @Override
       protected void done() {
           try {
               get();
               if (stopCellEditing) stopCellEditing();
               loadAttributes(mbean, mbeanInfo);
           } catch (Exception x) {
               if (JConsole.isDebug()) {
                   x.printStackTrace();
               }
           }
       }
    };
    mbeansTab.workerAdd(sw);
}
项目:openjdk9    文件:bug6432565.java   
public static void main(String[] args) throws Exception {
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventProcessor());

    SwingWorker<Void, CharSequence> swingWorker =
        new SwingWorker<Void,CharSequence>() {
            @Override
            protected Void doInBackground() {
                publish(new String[] {"hello"});
                publish(new StringBuilder("world"));
                return null;
            }
            @Override
            protected void done() {
                isDone.set(true);
            }
        };
    swingWorker.execute();

    while (! isDone.get()) {
        Thread.sleep(100);
    }
    if (throwable.get() instanceof ArrayStoreException) {
        throw new RuntimeException("Test failed");
    }
}
项目:JMangaCup    文件:Principal.java   
private void aniadirMangas() {
        // // TODO Auto-generated method stub
        final SwingWorker worker = new SwingWorker() {
            @Override
            protected Object doInBackground() throws Exception {
                int inicio = Integer.parseInt(campoInicio.getText());
                int fin = Integer.parseInt(campoFin.getText());
                String url1 = campoUrl1.getText();
                String url2 = campoUrl2.getText();
                for (int i = inicio; i <= fin; i++) {
//                  ColaDescarga.addManga(url1 + i + url2);
                    textEnlaces.append(url1 + i + url2 + "\n");
                }
                return null;
            }
        };
        worker.execute();
        // dispose();
    }
项目:JMangaCup    文件:Principal.java   
private void aniadirMangasMasivo() {
        // TODO Auto-generated method stub
        final SwingWorker worker = new SwingWorker() {
            @Override
            protected Object doInBackground() throws Exception {
                String rawEnlaces = textEnlaces.getText();
                String [] enlaces = rawEnlaces.split("\n");
                for (int i = 0; i < enlaces.length; i++) {
                    ColaDescarga.addManga(enlaces[i]);
//                  System.out.println("+ "+enlaces[i]);
                }
                return null;
            }
        };
        worker.execute();
        // dispose();
    }
项目:JMangaCup    文件:Masivo.java   
protected void aniadirMangas() {
//      // TODO Auto-generated method stub
        final SwingWorker worker = new SwingWorker(){
            @Override
            protected Object doInBackground() throws Exception {
                int inicio = Integer.parseInt(campoInicio.getText());
                int fin = Integer.parseInt(campoFin.getText());
                String url1=campoUrl1.getText();
                String url2=campoUrl2.getText();
                for (int i = inicio; i <= fin; i++) {
                    System.out.println("Aniadiendo: "+url1+i+url2);
                    ColaDescarga.addManga(url1+i+url2);
                }
                return null;
            }   
        };
        worker.execute();
        dispose();
    }
项目:A-Fucking-AI    文件:SearchTask.java   
/**
 * @return swing worker that starts the search() method and calls done() when that 
 *         task finishes.
 * @see SwingWorker
 */
private SwingWorker<M,U> createNewSwingWorker() {
    return new SwingWorker<M,U>() {
        @Override
        protected M doInBackground() throws Exception {
                return SearchTask.this.search();
        }

        @Override
        protected void done() {
            try {
                M m = get(); // gets computed move
                SearchTask.this.done(m);

            } catch (InterruptedException | ExecutionException ex) { 
                System.err.println("Exception in search task: " + ex);
                ex.printStackTrace();
            }
        }            
    };
}
项目:SVG-Android    文件:MainFrame.java   
public SwingWorker<?, ?> open(File file) {
    if (file == null) {
        JFileChooser chooser = new JFileChooser();
        chooser.setFileFilter(new SupportFileFilter());
        if (mCurrentFile != null && mCurrentFile.getParentFile().exists()) {
            chooser.setCurrentDirectory(mCurrentFile.getParentFile());
        }
        int choice = chooser.showOpenDialog(this);
        if (choice == JFileChooser.APPROVE_OPTION) {
            return new OpenTask(chooser.getSelectedFile());
        } else {
            return null;
        }
    } else {
        return new OpenTask(file);
    }
}
项目:portecle    文件:DGeneratingKeyPair.java   
/**
 * Get key pair worker.
 * 
 * @param keyPairType key pair type
 * @param keySize key size
 * @return Swing worker that creates a key pair
 */
public SwingWorker<KeyPair, Object> getKeyPairWorker(final KeyPairType keyPairType, final int keySize)
{
    return new SwingWorker<KeyPair, Object>()
    {
        @Override
        protected KeyPair doInBackground()
            throws Exception
        {
            return KeyPairUtil.generateKeyPair(keyPairType, keySize);
        }

        @Override
        protected void done()
        {
            closedByWorker = true;
            closeDialog();
            super.done();
        }
    };
}
项目:jdk8u_jdk    文件:XSheet.java   
/**
 * Unsubscribe button action.
 */
private void unregisterListener() {
    new SwingWorker<Boolean, Void>() {
        @Override
        public Boolean doInBackground() {
            return mbeanNotifications.unregisterListener(currentNode);
        }
        @Override
        protected void done() {
            try {
                if (get()) {
                    updateNotifications();
                    validate();
                }
            } catch (Exception e) {
                Throwable t = Utils.getActualException(e);
                if (JConsole.isDebug()) {
                    System.err.println("Problem removing listener");
                    t.printStackTrace();
                }
                showErrorDialog(t.getMessage(),
                        Messages.PROBLEM_REMOVING_LISTENER);
            }
        }
    }.execute();
}
项目:jdk8u_jdk    文件:XMBeanAttributes.java   
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void,Void> sw = new SwingWorker<Void,Void>() {

       @Override
       protected Void doInBackground() throws Exception {
           SnapshotMBeanServerConnection mbsc =
           mbeansTab.getSnapshotMBeanServerConnection();
           mbsc.flush();
           return null;
       }

       @Override
       protected void done() {
           try {
               get();
               if (stopCellEditing) stopCellEditing();
               loadAttributes(mbean, mbeanInfo);
           } catch (Exception x) {
               if (JConsole.isDebug()) {
                   x.printStackTrace();
               }
           }
       }
    };
    mbeansTab.workerAdd(sw);
}
项目:jdk8u_jdk    文件:bug6432565.java   
public static void main(String[] args) throws Exception {
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventProcessor());

    SwingWorker<Void, CharSequence> swingWorker =
        new SwingWorker<Void,CharSequence>() {
            @Override
            protected Void doInBackground() {
                publish(new String[] {"hello"});
                publish(new StringBuilder("world"));
                return null;
            }
            @Override
            protected void done() {
                isDone.set(true);
            }
        };
    swingWorker.execute();

    while (! isDone.get()) {
        Thread.sleep(100);
    }
    if (throwable.get() instanceof ArrayStoreException) {
        throw new RuntimeException("Test failed");
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:XSheet.java   
/**
 * Unsubscribe button action.
 */
private void unregisterListener() {
    new SwingWorker<Boolean, Void>() {
        @Override
        public Boolean doInBackground() {
            return mbeanNotifications.unregisterListener(currentNode);
        }
        @Override
        protected void done() {
            try {
                if (get()) {
                    updateNotifications();
                    validate();
                }
            } catch (Exception e) {
                Throwable t = Utils.getActualException(e);
                if (JConsole.isDebug()) {
                    System.err.println("Problem removing listener");
                    t.printStackTrace();
                }
                showErrorDialog(t.getMessage(),
                        Messages.PROBLEM_REMOVING_LISTENER);
            }
        }
    }.execute();
}
项目:lookaside_java-1.8.0-openjdk    文件:XMBeanAttributes.java   
private void refreshAttributes(final boolean stopCellEditing) {
    SwingWorker<Void,Void> sw = new SwingWorker<Void,Void>() {

       @Override
       protected Void doInBackground() throws Exception {
           SnapshotMBeanServerConnection mbsc =
           mbeansTab.getSnapshotMBeanServerConnection();
           mbsc.flush();
           return null;
       }

       @Override
       protected void done() {
           try {
               get();
               if (stopCellEditing) stopCellEditing();
               loadAttributes(mbean, mbeanInfo);
           } catch (Exception x) {
               if (JConsole.isDebug()) {
                   x.printStackTrace();
               }
           }
       }
    };
    mbeansTab.workerAdd(sw);
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6432565.java   
public static void main(String[] args) throws Exception {
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventProcessor());

    SwingWorker<Void, CharSequence> swingWorker =
        new SwingWorker<Void,CharSequence>() {
            @Override
            protected Void doInBackground() {
                publish(new String[] {"hello"});
                publish(new StringBuilder("world"));
                return null;
            }
            @Override
            protected void done() {
                isDone.set(true);
            }
        };
    swingWorker.execute();

    while (! isDone.get()) {
        Thread.sleep(100);
    }
    if (throwable.get() instanceof ArrayStoreException) {
        throw new RuntimeException("Test failed");
    }
}
项目:cloud-client    文件:CloudPREditor.java   
protected void refreshMetadata() {
  fetchMetadataButton.setEnabled(false);
  new SwingWorker<Void, Void>() {

    @Override
    protected Void doInBackground() throws Exception {
      serviceMetadata = pr.getEndpoint().metadata();
      return null;
    }

    public void done() {
      metadataUpdated();
      fetchMetadataButton.setEnabled(true);
    }

  }.execute();
}
项目:pathvisio    文件:SwingEngine.java   
public boolean openPathway(final URL url) {
    final ProgressKeeper pk = new ProgressKeeper();
    final ProgressDialog d = new ProgressDialog(JOptionPane.getFrameForComponent(getApplicationPanel()),
            "", pk, false, true);

    SwingWorker<Boolean, Boolean> sw = new SwingWorker<Boolean, Boolean>() {
        protected Boolean doInBackground() {
            pk.setTaskName("Opening pathway");
            try {
                engine.setWrapper (createWrapper());
                engine.openPathway(url);
                return true;
            } catch(ConverterException e) {
                handleConverterException(e.getMessage(), null, e);
                return false;
            } finally {
                pk.finished();
            }
        }
    };

    return processTask(pk, d, sw);
}
项目:pathvisio    文件:SwingEngine.java   
public boolean openPathway(final File f)
{
    final ProgressKeeper pk = new ProgressKeeper();
    final ProgressDialog d = new ProgressDialog(JOptionPane.getFrameForComponent(getApplicationPanel()),
            "", pk, false, true);

    engine.setWrapper (createWrapper());
    SwingWorker<Boolean, Boolean> sw = new SwingWorker<Boolean, Boolean>() {
        protected Boolean doInBackground() {
            pk.setTaskName("Opening pathway");
            try {
                engine.openPathway(f);
                return true;
            } catch(ConverterException e) {
                handleConverterException(e.getMessage(), null, e);
                return false;
            } finally {
                pk.finished();
            }
        }
    };

    return processTask(pk, d, sw);
}
项目:pathvisio    文件:SwingEngine.java   
public boolean importPathway(final File f) {
    final ProgressKeeper pk = new ProgressKeeper();
    final ProgressDialog d = new ProgressDialog(JOptionPane.getFrameForComponent(getApplicationPanel()),
            "", pk, false, true);

    SwingWorker<Boolean, Boolean> sw = new SwingWorker<Boolean,Boolean>() {
        protected Boolean doInBackground() {
            pk.setTaskName("Importing pathway");
            try {
                boolean editMode = engine.hasVPathway() ? engine.getActiveVPathway().isEditMode() : true;
                engine.setWrapper (createWrapper());
                engine.importPathway(f);
                engine.getActiveVPathway().setEditMode(editMode);
                return true;
            } catch(ConverterException e) {
                handleConverterException(e.getMessage(), frame, e);
                return false;
            } finally {
                pk.finished();
            }
        }
    };

return processTask(pk, d, sw);

}
项目:rapidminer-studio    文件:UpgradeLicenseAction.java   
/**
 * Creates a new upgrade {@link SwingWorker}.
 * 
 * @return
 */
private static SwingWorker<Void, Void> createUpgradeWorker() {
    return new SwingWorker<Void, Void>() {

        @Override
        protected Void doInBackground() throws Exception {
            RMUrlHandler.handleUrl(URI_LICENSE_UPGRADE);
            return null;
        }

        @Override
        protected void done() {
            try {
                // see if anything failed
                get();
            } catch (ExecutionException | InterruptedException e) {
                LogService.getRoot().log(Level.WARNING,
                        "com.rapidminer.license.gui.actions.UpgradeLicenseAction.failed_to_init_upgrade");
            }
        }
    };
}
项目:SWAT20    文件:Demo1WithSwingWorker.java   
public void actionPerformed(ActionEvent evt) {
    String cmd = evt.getActionCommand();
    if (cmd.equalsIgnoreCase("calc")) { // calc button pressed
        // Construct a new SwingWorker
        worker = new SwingWorker<String, Void>() {

            @Override
            protected String doInBackground() {
                return getXPrime(Integer.parseInt(jtext_input.getText()));
            }

            @Override
            protected void done() {
                try {
                    jlabe_result.setText(get());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } catch (ExecutionException e) {
                    e.printStackTrace();
                }
            }
        };
        // Execute the SwingWorker; the GUI will not freeze
        worker.execute();
    }
}
项目:ET_Redux    文件:UHoustonVarian810FileHandler.java   
/**
 *
 * @param loadDataTask the value of loadRawDataTaskListener
 * @param usingFullPropagation the value of usingFullPropagation
 * @param leftShadeCount the value of leftShadeCount
 * @param ignoreFirstFractions the value of ignoreFirstFracts
 * @param inLiveMode the value of inLiveMode
 */
@Override
public void getAndLoadRawIntensityDataFile(SwingWorker loadDataTask, boolean usingFullPropagation, int leftShadeCount, int ignoreFirstFractions, boolean inLiveMode) {

    // U Houston Varian810 has single ".prn" file containing all data
    // and include named fractions with each interna; data set
    if ((referenceMaterialIncrementerMap == null) || !inLiveMode) {
        referenceMaterialIncrementerMap = new ConcurrentHashMap<>();
        for (String standardID : rawDataFileTemplate.getStandardIDs()) {
            referenceMaterialIncrementerMap.put(standardID, 1);
        }
    }

    if (rawDataFile != null) {
        // create fractions from raw data and perform corrections and calculate ratios
        tripoliFractions = loadRawDataFile(loadDataTask, usingFullPropagation, leftShadeCount, ignoreFirstFractions, inLiveMode);
    };
}
项目:Stud.IP-Client    文件:GeneralSettingsView.java   
private void toogleAutoStart() {
    logger.entry();
    SwingWorker<String, Object> worker = new SwingWorker<String, Object>() {

        @Override
        protected String doInBackground() throws Exception {
            if (!requestRunning) {
                requestRunning = true;
                settings.setAutoStart(autoStartButton.isSelected());
            }
            return "done";
        }
    };
    worker.execute();
    logger.exit();
}
项目:Stud.IP-Client    文件:GeneralSettingsView.java   
private void toogleAutoUpdate() {
    logger.entry();
    SwingWorker<String, Object> worker = new SwingWorker<String, Object>() {

        @Override
        protected String doInBackground() throws Exception {
            if (!requestRunning) {
                requestRunning = true;
                settings.setAutoUpdate(autoUpdateButton.isSelected());
            }
            return "done";
        }
    };
    worker.execute();
    logger.exit();
}
项目:Stud.IP-Client    文件:GeneralSettingsView.java   
private void toogleHiddenStart() {
    logger.entry();
    SwingWorker<String, Object> worker = new SwingWorker<String, Object>() {

        @Override
        protected String doInBackground() throws Exception {
            if (!requestRunning) {
                requestRunning = true;
                settings.setHidden(hiddenStartButton.isSelected());
            }
            return "done";
        }
    };
    worker.execute();
    logger.exit();
}