Package javax.swing

Examples of javax.swing.ProgressMonitor$ProgressOptionPane


        final int startSize = messages.size();
        final Destination to = hermes.getDestination(destination, target);

        SwingRunner.invokeAndWait(new Runnable() {
          public void run() {
            monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Copying " + messages.size()
                + ((messages.size() == 1) ? " message" : " messages") + " to " + destination, "Connecting...", 0, messages.size());

            monitor.setMillisToDecideToPopup(100);
            monitor.setMillisToPopup(400);
            monitor.setProgress(1);
View Full Code Here


   }

   private void executeStatements(Connection connection, String[] statements) throws SQLException
   {
      final StringBuffer message = new StringBuffer();
      ProgressMonitor progressMonitor = null;

      if (HermesBrowser.getBrowser() != null)
      {
         progressMonitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Initialising message stores... ", "Connecting...", 0, statements.length);

         progressMonitor.setMillisToDecideToPopup(100);
         progressMonitor.setMillisToPopup(400);
      }

      final QueryRunner runner = new QueryRunner();

      for (int i = 0; i < statements.length; i++)
      {
         try
         {
            log.debug("executing: " + statements[i]);

            if (progressMonitor != null)
            {
               progressMonitor.setProgress(statements.length);
               progressMonitor.setNote("Executing statement " + i + " of " + statements.length);
            }

            runner.update(connection, statements[i]);
         }
         catch (SQLException ex)
View Full Code Here

  public int truncate(DestinationConfig dConfig) throws JMSException {
    boolean keepRunning = true;

    StringBuffer message = new StringBuffer();
    int numToDelete = 0;
    ProgressMonitor monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Deleting from " + dConfig.getName(), "Discovering size of " + dConfig.getName(), 0, 102);

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

    try {

      QueueBrowser browser = getHermes().createBrowser(dConfig);
      Enumeration iter = browser.getEnumeration();

      monitor.setProgress(1);

      Hermes.ui.getDefaultMessageSink().add("Discovering size of " + dConfig.getName());

      while (iter.hasMoreElements() && keepRunning && !monitor.isCanceled()) {
        iter.nextElement();
        numToDelete++;
      }

      browser.close();
      getHermes().rollback();

      if (monitor.isCanceled()) {
        keepRunning = false;
      }

      String message2 = dConfig.getName() + " is already empty.";

      if (numToDelete == 1) {
        message2 = "Deleting one message from " + dConfig.getName();
      } else {
        message2 = "Deleting " + numToDelete + " messages from " + dConfig.getName();
      }

      Hermes.ui.getDefaultMessageSink().add(message2);

      monitor.setProgress(2);

      final Destination destination = getHermes().getDestination(dConfig.getName(), Domain.getDomain(dConfig.getDomain()));

      for (int i = 0; i < numToDelete && keepRunning && !monitor.isCanceled(); i++) {
        Message m = null;

        while (m == null && keepRunning) {
          m = getHermes().receive(destination, 10000);
        }

        monitor.setNote(new Long(i) + " messages deleted");

        float l_i = i;
        float l_numToDelete = numToDelete;
        int progress = Math.round(2 + ((l_i / l_numToDelete) * 100));

        monitor.setProgress(progress);
      }

      if (monitor.isCanceled()) {
        keepRunning = false;
      }

      if (numToDelete > 0) {
        if (keepRunning) {
          getHermes().commit();
          message.append("Committed. ").append(numToDelete).append(" messages deleted from " + dConfig.getName());
        } else {
          getHermes().rollback();
          message.append("Trucate of ").append(dConfig.getName()).append(" rolled back");
        }
      }
    } catch (Exception ex) {
      message.append("During truncate of ").append(dConfig.getName()).append(": ").append(ex.getMessage());
      log.error(ex);
    } finally {
      if (monitor != null) {
        monitor.close();
      }
    }

    Hermes.ui.getDefaultMessageSink().add(message);

View Full Code Here

  }
 
  @Override
  public int truncate(DestinationConfig dConfig) throws JMSException {
    ProgressMonitor monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Deleting from " + dConfig.getName(),
        "Discovering size of " + dConfig.getName(), 0, 102);
    int rval = 0;
    String destName = getRealDestinationName(dConfig);
    monitor.setMillisToDecideToPopup(100);
    monitor.setMillisToPopup(400);

    try {
      if (dConfig.getDomain() == Domain.QUEUE.getId()) {
        Properties queueStats = seeBeyondAdmin.getQueueStatistics(destName);
        int start = Integer.parseInt(queueStats.getProperty("MIN_SEQ"));
        int finish = Integer.parseInt(queueStats.getProperty("MAX_SEQ"));
        for (int i = start; i <= finish; i++) {
          // Properties headerProps = (Properties) headers;
          seeBeyondAdmin.deleteQueueMessage(destName, "" + i);
          rval++;
          if (monitor.isCanceled())
            return rval;
        }
      } else if (dConfig.getDomain() == Domain.QUEUE.getId()){
        Properties queueStats = seeBeyondAdmin.getTopicStatistics(destName);
        int start = Integer.parseInt(queueStats.getProperty("FIRST_SEQ"));
        int finish = Integer.parseInt(queueStats.getProperty("LAST_SEQ"));
        for (int i = start; i <= finish; i++) {
          // Properties headerProps = (Properties) headers;
          seeBeyondAdmin.deleteTopicMessage(destName, "" + i);
          rval++;
          if (monitor.isCanceled())
            return rval;
        }
      } else
      {
        log.error("Unsupported destination domain " + dConfig.getDomain());
      }
    } catch (HermesException ex) {
      throw ex;
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new HermesException(e);
    } finally {
      if (monitor != null)
        monitor.close();
    }

    return rval;
  }
View Full Code Here

   {
      try
      {
         int numWritten = 0;

         ProgressMonitor monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Writing " + messages.size()
               + ((messages.size() == 1) ? " message" : " messages") + " to " + store.getId(), "Connecting...", 0, messages.size() + 1);

         monitor.setMillisToDecideToPopup(50);
         monitor.setMillisToPopup(50);

         for (Message message : messages)
         {
            store.store(message);

            monitor.setNote(++numWritten + " messages written.");
            monitor.setProgress(numWritten);

            if (monitor.isCanceled() || !isRunning())
            {
               break;
            }
         }

         if (monitor.isCanceled() || !isRunning())
         {
            Hermes.ui.getDefaultMessageSink().add("Storing messages in " + store.getId() + " cancelled");
            store.rollback();
            monitor.close() ;
         }
         else
         {
            monitor.setNote("Checkpointing...");
            monitor.setProgress(++numWritten);

            log.debug("Checkpointing...") ;
           
            store.checkpoint();
            monitor.close() ;

            Hermes.ui.getDefaultMessageSink().add(messages.size() + " message" + TextUtils.plural(messages.size()) + " stored in " + store.getId());
         }

      }
View Full Code Here

      if (isRunning())
      {
         int numDeleted = 0;

         final ProgressMonitor monitor = new ProgressMonitor(HermesBrowser.getBrowser(), "Deleting " + messages.size()
               + ((messages.size() == 1) ? " message" : " messages") + " from " + messageStore.getId(), "Connecting...", 0, messages.size() + 1);

         monitor.setMillisToDecideToPopup(50);
         monitor.setMillisToPopup(50);

         for (Message m : messages)
         {
            messageStore.delete(m);

            monitor.setNote(++numDeleted + " messages deleted.");
            monitor.setProgress(numDeleted);
           
            if (monitor.isCanceled() || !isRunning())
            {
               Hermes.ui.getDefaultMessageSink().add("Delete from " + messageStore.getId() + " cancelled") ;
               break ;
            }
         }

         if (isRunning() && !monitor.isCanceled())
         {
            monitor.setNote("Checkpointing...");
            monitor.setProgress(numDeleted + 1);

            messageStore.checkpoint();

            Hermes.ui.getDefaultMessageSink().add(
                  messages.size() + " message" + TextUtils.plural(messages.size()) + " deleted from store " + messageStore.getId());
View Full Code Here

    public void propertyChange(PropertyChangeEvent arg0) {
      Thread thread =
        new Thread(
          new Runnable() {
            public void run() {
              ProgressMonitor monitor = null;

              int index = 0;

              try {
                synchronized (unfilteredList) {
                  monitor =
                    new ProgressMonitor(
                      null, "Switching models...",
                      "Transferring between data structures, please wait...", 0,
                      unfilteredList.size() + 1);
                  monitor.setMillisToDecideToPopup(250);
                  monitor.setMillisToPopup(100);
                  logger.debug(
                    "Changing Model, isCyclic is now " + isCyclic());

                  List newUnfilteredList = null;
                  List newFilteredList = null;
                  HashSet newIDSet = null;

                  newIDSet = new HashSet(cyclicBufferSize);

                  if (isCyclic()) {
                    newUnfilteredList = new CyclicBufferList(cyclicBufferSize);
                    newFilteredList = new CyclicBufferList(cyclicBufferSize);
                  } else {
                    newUnfilteredList = new ArrayList(cyclicBufferSize);
                    newFilteredList = new ArrayList(cyclicBufferSize);
                  }

                  int increment = 0;

                  for (Iterator iter = unfilteredList.iterator();
                      iter.hasNext();) {
                    LoggingEvent e = (LoggingEvent) iter.next();
                    newUnfilteredList.add(e);

                    Object o =
                      e.getProperty(
                        e.getProperty(Constants.LOG4J_ID_KEY));

                    if (o != null) {
                      newIDSet.add(o);
                    } else {
                      newIDSet.add(new Integer(increment++));
                    }

                    monitor.setProgress(index++);
                  }

                  unfilteredList = newUnfilteredList;
                  filteredList = newFilteredList;
                  idSet = newIDSet;
                }

                monitor.setNote("Refiltering...");
                reFilter();

                monitor.setProgress(index++);
              } finally {
                monitor.close();
              }

              logger.debug("Model Change completed");
            }
          });
View Full Code Here

     * @see net.sourceforge.squirrel_sql.plugins.dbcopy.event.CopyTableListener#tableAnalysisStarted(net.sourceforge.squirrel_sql.plugins.dbcopy.event.AnalysisEvent)
     */
    public void tableAnalysisStarted(AnalysisEvent e) {
        SessionInfoProvider prov = e.getSessionInfoProvider();
        // TODO: set the total for the progress bar.
        pm = new ProgressMonitor(parent, 
                                 "Analyzing column names in tables to be copied",
                                 "",
                                 0,
                                 prov.getSourceSelectedDatabaseObjects().length);
       
View Full Code Here

      // show progress Monitor
      String progressMsg = "  Processing " + collectionReader.getNumberOfDocuments()
              + " Documents.";

      numDocs = collectionReader.getNumberOfDocuments();
      progressMonitor = new ProgressMonitor(DocumentAnalyzer.this, progressMsg, "", 0, numDocs + 2);
      String initial = "Initializing.... Please wait ";
      progressMonitor.setNote(initial);
      progressMonitor.setMillisToPopup(-1);
      progressMonitor.setMillisToDecideToPopup(-1);
      numDocsProcessed = 0;
View Full Code Here

                        HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getJcrComponentRegistry().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.