Package javax.swing

Examples of javax.swing.ProgressMonitor$ProgressOptionPane


          ErrorMessages.GUMPHASH_FILE_NOT_FOUND_MESSAGE);
    } catch (IOException e1) {
      UOGumpViewer.getLogger().log(Level.WARNING,
          ErrorMessages.GUMPHASH_FILE_CANNOT_READ_MESSAGE);
    }
    final ProgressMonitor pm = new ProgressMonitor(parent, resourceBundle
        .getString("GumpScanningThread.Message.SearchNewGumps"), "", 0,
        gumpVector.size());
    pm.setProgress(0);

    for (int i = 0; i < gumpVector.size(); i++) {
      Gump gump = gumpVector.elementAt(i);

      final int progress = i;
      if (pm.isCanceled()) {
        newGumpVector.removeAllElements();
        break;
      }

      SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          pm.setProgress(progress);
        }
      });

      try {
        gump = gumpReader.read(gump.getIndex());
        String gumpIndex = String.valueOf(gump.getIndex().getIndex());
        String oldHash = hashProps.getProperty(gumpIndex, "");
        if (!gump.getHash().equals(oldHash)) {
          newGumpVector.add(gump);
          hashProps.setProperty(gumpIndex, gump.getHash());
        }
        gump.setImage(null);
      } catch (IOException e) {
        UOGumpViewer.getLogger().log(Level.SEVERE, ErrorMessages.GUMPS_CANNOT_READ_MESSAGE, e);
      }
    }
    pm.close();

    if (newGumpVector.size() > 0) {
      StringBuilder builder = new StringBuilder();
      for (Gump newGump : newGumpVector) {
        builder.append(newGump.getIndex().getIndex());
View Full Code Here


                  {
                     log.debug("searching " + lConfig.getJar());

                     ClassLoader l = createClassLoader(loaderConfigs, baseLoader);
                     JarFile jarFile = new JarFile(lConfig.getJar());
                     ProgressMonitor monitor = null;
                     int entryNumber = 0;

                     if (HermesBrowser.getBrowser() != null)
                     {
                        monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Looking for factories in " + lConfig.getJar(), "Scanning...", 0, jarFile
                              .size());
                        monitor.setMillisToDecideToPopup(0);
                        monitor.setMillisToPopup(0);
                        monitor.setProgress(0);
                     }

                     for (Enumeration iter = jarFile.entries(); iter.hasMoreElements();)
                     {
                        ZipEntry entry = (ZipEntry) iter.nextElement();
                        entryNumber++;

                        if (monitor != null)
                        {
                           monitor.setProgress(entryNumber);
                           monitor.setNote("Checking entry " + entryNumber + " of " + jarFile.size());
                        }

                        if (entry.getName().endsWith(".class"))
                        {
                           String s = entry.getName().substring(0, entry.getName().indexOf(".class"));
View Full Code Here

      if (chooser.showDialog(HermesBrowser.getBrowser(), "Save All Messages...") == JFileChooser.APPROVE_OPTION) {
        DirectoryCache.lastSaveAsDirectory = chooser.getCurrentDirectory();

        final File file = chooser.getSelectedFile();
        final List<Message> messages = new ArrayList<Message>();
        final ProgressMonitor progress = new ProgressMonitor(HermesBrowser.getBrowser(), "Saving from " + from + " to " + file.getName(),
            "Browsing...", 0, 3);
        progress.setMillisToPopup(0);
        progress.setMillisToDecideToPopup(0);

        task.addTaskListener(new MessageTaskListener() {

          public void onMessage(Task task, Message message) {
            if (progress.isCanceled()) {
              task.stop();
            }

            messages.add(message);
            progress.setNote(messages.size() + " message" + TextUtils.plural(messages.size()) + " read");
          }

          public void onThrowable(Task task, Throwable t) {
            HermesBrowser.getBrowser().showErrorDialog(t);

          }

          public void onStopped(Task task) {
            if (!progress.isCanceled()) {
              doSave();
            } else {
              Hermes.ui.getDefaultMessageSink().add("Cancelled");
            }
          }

          public void onStatus(Task task, String status) {
            // NOP

          }

          public void onStarted(Task task) {
            Hermes.ui.getDefaultMessageSink().add("Browsing " + from + "...");
            progress.setProgress(1);
          }

          private void doSave() {
            FileOutputStream ostream = null;

            try {
              progress.setProgress(2);
              progress.setNote("Saving to " + file.getName());
              Hermes.ui.getDefaultMessageSink().add("Saving to " + file.getName());
              ostream = new FileOutputStream(file);
              hermes.toXML(messages, ostream);
              ostream.close();
              Hermes.ui.getDefaultMessageSink().add(
                  messages.size() + " message" + TextUtils.plural(messages.size()) + " saved to " + file.getName());

            } catch (Exception ex) {
              HermesBrowser.getBrowser().showErrorDialog(ex);

            } finally {
              progress.setProgress(3);
              progress.close();

              if (ostream != null) {
                try {
                  ostream.close();
                } catch (Exception ex) {
View Full Code Here

        });
    }

    private void doBind()
    {
        final ProgressMonitor monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Binding objects...", "Starting.", 0, bindModel.getRowCount() * 2);

        monitor.setMillisToDecideToPopup(100);
        monitor.setMillisToPopup(400);

        HermesBrowser.getBrowser().getThreadPool().invokeLater(new Runnable()
        {
            public void run()
            {
View Full Code Here

                        HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getJcrComponentRegistry().getRegistry());
                        hostDescriptionDialog.setLocationRelativeTo(getContentPane());
                        hostDescriptionDialog.open();

                        if (hostDescriptionDialog.isHostCreated()) {
                          ProgressMonitor progressMonitor = new ProgressMonitor(getContentPane(), "Host Descriptions", "Refreshing host list..", 0, 200);
                          int progress=1;
                          progressMonitor.setProgress(progress++);
                          while(cmbHostName.getSelectedIndex()==-1 || !cmbHostName.getSelectedItem().toString().equals(hostDescriptionDialog.getHostLocation())){
                              loadHostDescriptions();
                              cmbHostName.setSelectedItem(hostDescriptionDialog.getHostLocation());
                              progressMonitor.setProgress(progress++);
                              Thread.sleep(50);
                          }
                          progressMonitor.setProgress(200);
                        }
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
                    }
View Full Code Here

                        HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(getRegistry());
                        hostDescriptionDialog.setLocationRelativeTo(getContentPane());
                        hostDescriptionDialog.open();

                        if (hostDescriptionDialog.isHostCreated()) {
                          ProgressMonitor progressMonitor = new ProgressMonitor(getContentPane(), "Host Descriptions", "Refreshing host list..", 0, 200);
                          int progress=1;
                          progressMonitor.setProgress(progress++);
                          while(cmbHostName.getSelectedIndex()==-1 || !cmbHostName.getSelectedItem().toString().equals(hostDescriptionDialog.getHostLocation())){
                              loadHostDescriptions();
                              cmbHostName.setSelectedItem(hostDescriptionDialog.getHostLocation());
                              progressMonitor.setProgress(progress++);
                              Thread.sleep(50);
                          }
                          progressMonitor.setProgress(200);
                        }
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
                    }
View Full Code Here

    final int returnVal = dialog.showSaveDialog(MainWindow.getInstance());
    if (returnVal == OpenEWorldFileDialog.APPROVE_OPTION) {
      final String fileName = dialog.getSelectedFile().getAbsolutePath();
      if ((fileName != null) && (fileName.compareTo("") != 0)) {
        final EWorld2VanetMobisim converter = new EWorld2VanetMobisim(fileName);
        userFeedbackDialog = new ProgressMonitor(MainWindow.getInstance(), "Export to VanetMobisim",
                "Please wait while all necessary files are generated. Thank you.", 0, 0);
        final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
          @Override
          public Void doInBackground() {
            converter.run();
View Full Code Here

      }
    }
  }

  public static void openFile(final String fileName) {
    final ProgressMonitor progressMonitor = new ProgressMonitor(MainWindow.getInstance(), "Loading eWorld file",
            "Please wait while the file is loaded. Thank you.", 0, 0);
    final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
      @Override
      public Void doInBackground() {
        try {
          PersistenceManager.getInstance().loadFromFile(fileName);
        } catch (final Exception xcp) {
          cancel(true);
        }
        return null;
      }

      @Override
      public void done() {
        if (isCancelled()) {
          JOptionPane.showMessageDialog(MainWindow.getInstance(),
                  "An error occurred while loading an ewd file.\nPlease check the log files for details.",
                  "Could not open file!", JOptionPane.ERROR_MESSAGE);
        }
        progressMonitor.setProgress(0);
      }
    };
    worker.execute();
    MainWindow.getInstance().setFileName(fileName);
    MainWindow.getInstance().setTitle(fileName);
View Full Code Here

                        HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getAiravataAPI(), null);
                        hostDescriptionDialog.setLocationRelativeTo(getContentPane());
                        hostDescriptionDialog.open();

                        if (hostDescriptionDialog.isHostCreated()) {
                          ProgressMonitor progressMonitor = new ProgressMonitor(getContentPane(), "Host Descriptions", "Refreshing host list..", 0, 200);
                          int progress=1;
                          progressMonitor.setProgress(progress++);
                          while(cmbHostName.getSelectedIndex()==-1 || !cmbHostName.getSelectedItem().toString().equals(hostDescriptionDialog.getHostLocation())){
                              loadHostDescriptions();
                              cmbHostName.setSelectedItem(hostDescriptionDialog.getHostLocation());
                              progressMonitor.setProgress(progress++);
                              Thread.sleep(50);
                          }
                          progressMonitor.setProgress(200);
                        }
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
                    }
View Full Code Here

                        HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(getRegistry(), null);
                        hostDescriptionDialog.setLocationRelativeTo(getContentPane());
                        hostDescriptionDialog.open();

                        if (hostDescriptionDialog.isHostCreated()) {
                            ProgressMonitor progressMonitor = new ProgressMonitor(getContentPane(),
                                    "Host Descriptions", "Refreshing host list..", 0, 200);
                            int progress = 1;
                            progressMonitor.setProgress(progress++);
                            while (cmbHostName.getSelectedIndex() == -1
                                    || !cmbHostName.getSelectedItem().toString()
                                            .equals(hostDescriptionDialog.getHostLocation())) {
                                loadHostDescriptions();
                                cmbHostName.setSelectedItem(hostDescriptionDialog.getHostLocation());
                                progressMonitor.setProgress(progress++);
                                Thread.sleep(50);
                            }
                            progressMonitor.setProgress(200);
                        }
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
                    }
View Full Code Here

TOP

Related Classes of javax.swing.ProgressMonitor$ProgressOptionPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.