Package javax.swing

Examples of javax.swing.ProgressMonitor$ProgressOptionPane


      }
      if ( (nextStack != null) || (previousStack != null) ) {
        stencilManager.setNextAndPreviousStacks(previousStack, nextStack);
      }
      NodeList stencils = document.getElementsByTagName( "stencil" );
      ProgressMonitor monitor = new ProgressMonitor(null, "Loading Tutorial", "", 0, stencils.getLength());
      monitor.setProgress(0);
      monitor.setMillisToDecideToPopup(1000);
      for (int i = 0; i < stencils.getLength(); i++) {
        Node stencilNode = stencils.item(i);
        StencilManager.Stencil newStencil = loadStencil(stencilNode);
        stencilList.addElement(newStencil);
        monitor.setProgress(i);
      }
      monitor.close();
      return stencilList;
    } else {
      System.out.println("Could not parse stencil file");
      System.out.flush();
      return null;
View Full Code Here


        // 最小値と最大値を設定する
        min = 0;
        max = getMaxEstimation() / getDelay();
       
        // ProgressMonitor を生成する
        progress = new ProgressMonitor(cmp, message, note, min, max);
        progress.setMillisToDecideToPopup(getDecideToPopup());
        progress.setMillisToPopup(getMillisToPopup());
       
        // タイマーを生成する
        timer = new Timer(getDelay(), this);
View Full Code Here

    }

    int ret = fileChooser.showDialog(mainPanel, NLS.str("file.select"));
    if (ret == JFileChooser.APPROVE_OPTION) {
      JadxPreferences.putLastSaveFilePath(fileChooser.getCurrentDirectory().getPath());
      ProgressMonitor progressMonitor = new ProgressMonitor(mainPanel, NLS.str("msg.saving_sources"), "", 0, 100);
      progressMonitor.setMillisToPopup(500);
      wrapper.saveAll(fileChooser.getSelectedFile(), progressMonitor);
    }
  }
View Full Code Here

        return instance;
    }

    public void readPlugins(String base, JFrame parent) throws Exception {
        String baseURL = base;
        ProgressMonitor monitor;

        if (base == null) {
            baseURL = TiledConfiguration.root().get("pluginsDir", "plugins");
        }

        File dir = new File(baseURL);
        if (!dir.exists() || !dir.canRead()) {
            //FIXME: removed for webstart
            //throw new Exception(
            //        "Could not open directory for reading plugins: " +
            //        baseURL);
            return;
        }

        int total = 0;
        File[] files = dir.listFiles();
        for (File file : files) {
            String aPath = file.getAbsolutePath();
            if (aPath.endsWith(".jar")) {
                total++;
            }
        }

        // Start the progress monitor
        monitor = new ProgressMonitor(
                parent, "Loading plugins", "", 0, total - 1);
        monitor.setProgress(0);
        monitor.setMillisToPopup(0);
        monitor.setMillisToDecideToPopup(0);

        for (int i = 0; i < files.length; i++) {
            String aPath = files[i].getAbsolutePath();
            String aName =
                aPath.substring(aPath.lastIndexOf(File.separatorChar) + 1);

            // Skip non-jar files.
            if (!aPath.endsWith(".jar")) {
                continue;
            }

            try {
                monitor.setNote("Reading " + aName + "...");
                JarFile jf = new JarFile(files[i]);

                monitor.setProgress(i);

                if (jf.getManifest() == null)
                    continue;

                String readerClassName =
                    jf.getManifest().getMainAttributes().getValue(
                            "Reader-Class");
                String writerClassName =
                    jf.getManifest().getMainAttributes().getValue(
                            "Writer-Class");

                Class readerClass = null;
                Class writerClass = null;

                // Verify that the jar has the necessary files to be a
                // plugin
                if (readerClassName == null && writerClassName == null) {
                    continue;
                }

                monitor.setNote("Loading " + aName + "...");
                addURL(new File(aPath).toURI().toURL());

                if (readerClassName != null) {
                    JarEntry reader = jf.getJarEntry(
                            readerClassName.replace('.', '/') + ".class");
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

        // Save time for later analysis
        final long timeBeforeCalculating = System.currentTimeMillis();

        // Create progress monitor
        final ProgressMonitor pm = new ProgressMonitor(
            GUI.getTopParentContainer(),
            "Calculating channel attenuation",
            null,
            0,
            resolution.width - 1
        );

        // Thread that will perform the work
        final Runnable runnable = new Runnable() {
          public void run() {
            try {

              // Available signal strength intervals
              double lowestImageValue = Double.MAX_VALUE;
              double highestImageValue = -Double.MAX_VALUE;

              // Create image values (calculate each pixel)
              double[][] imageValues = new double[resolution.width][resolution.height];
              for (int x=0; x < resolution.width; x++) {
                for (int y=0; y < resolution.height; y++) {
                  final double xx = x;
                  final double yy = y;
                  TxPair txPair = new TxPair() {
                    public double getDistance() {
                      double w = getFromX() - getToX();
                      double h = getFromY() - getToY();
                      return Math.sqrt(w*w+h*h);
                    }
                    public double getFromX() { return radioX; }
                    public double getFromY() { return radioY; }
                    public double getToX() { return startX + width * xx/resolution.width; }
                    public double getToY() { return startY + height * yy/resolution.height; }
                    public double getTxPower() { return selectedRadio.getCurrentOutputPower(); }
                    public double getTxGain() {
                      if (!(selectedRadio instanceof DirectionalAntennaRadio)) {
                        return 0;
                      }
                      DirectionalAntennaRadio r = (DirectionalAntennaRadio)selectedRadio;
                      double txGain = r.getRelativeGain(r.getDirection() + getAngle(), getDistance());
                      //logger.debug("tx gain: " + txGain + " (angle " + String.format("%1.1f", Math.toDegrees(r.getDirection() + getAngle())) + ")");
                      return txGain;
                    }
                    public double getRxGain() {
                      return 0;
                    }
                  };

                  if (dataTypeToVisualize == ChannelModel.TransmissionData.SIGNAL_STRENGTH) {
                    // Attenuate
                    double[] signalStrength = currentChannelModel.getReceivedSignalStrength(txPair);

                    // Collecting signal strengths
                    if (signalStrength[0] < lowestImageValue) {
                      lowestImageValue = signalStrength[0];
                    }
                    if (signalStrength[0] > highestImageValue) {
                      highestImageValue = signalStrength[0];
                    }

                    imageValues[x][y] = signalStrength[0];

                  } else if (dataTypeToVisualize == ChannelModel.TransmissionData.SIGNAL_STRENGTH_VAR) {
                    // Attenuate
                    double[] signalStrength = currentChannelModel.getReceivedSignalStrength(txPair);

                    // Collecting variances
                    if (signalStrength[1] < lowestImageValue) {
                      lowestImageValue = signalStrength[1];
                    }
                    if (signalStrength[1] > highestImageValue) {
                      highestImageValue = signalStrength[1];
                    }

                    imageValues[x][y] = signalStrength[1];

                  } else if (dataTypeToVisualize == ChannelModel.TransmissionData.SNR) {
                    // Get signal to noise ratio
                    double[] snr = currentChannelModel.getSINR(
                        txPair,
                        -Double.MAX_VALUE
                    );

                    // Collecting signal to noise ratio
                    if (snr[0] < lowestImageValue) {
                      lowestImageValue = snr[0];
                    }
                    if (snr[0] > highestImageValue) {
                      highestImageValue = snr[0];
                    }

                    imageValues[x][y] = snr[0];

                  } else if (dataTypeToVisualize == ChannelModel.TransmissionData.SNR_VAR) {
                    // Get signal to noise ratio
                    double[] snr = currentChannelModel.getSINR(
                        txPair,
                        -Double.MAX_VALUE
                    );

                    // Collecting variances
                    if (snr[1] < lowestImageValue) {
                      lowestImageValue = snr[1];
                    }
                    if (snr[1] > highestImageValue) {
                      highestImageValue = snr[1];
                    }

                    imageValues[x][y] = snr[1];
                  } else if (dataTypeToVisualize == ChannelModel.TransmissionData.PROB_OF_RECEPTION) {
                    // Get probability of receiving a packet TODO What size? Does it matter?
                    double probability = currentChannelModel.getProbability(
                        txPair, -Double.MAX_VALUE
                    )[0];

                    // Collecting variances
                    if (probability < lowestImageValue) {
                      lowestImageValue = probability;
                    }
                    if (probability > highestImageValue) {
                      highestImageValue = probability;
                    }

                    imageValues[x][y] = probability;
                  } else if (dataTypeToVisualize == ChannelModel.TransmissionData.DELAY_SPREAD_RMS) {
                    // Get RMS delay spread of receiving a packet
                    double rmsDelaySpread = currentChannelModel.getRMSDelaySpread(
                        txPair
                    );

                    // Collecting variances
                    if (rmsDelaySpread < lowestImageValue) {
                      lowestImageValue = rmsDelaySpread;
                    }
                    if (rmsDelaySpread > highestImageValue) {
                      highestImageValue = rmsDelaySpread;
                    }

                    imageValues[x][y] = rmsDelaySpread;
                  }

                  // Check if the dialog has been canceled
                  if (pm.isCanceled()) {
                    return;
                  }

                  // Update progress
                  pm.setProgress(x);

                }
              }

              // Adjust coloring signal strength limit
              if (coloringIsFixed) {
                if (dataTypeToVisualize == ChannelModel.TransmissionData.SIGNAL_STRENGTH) {
                  lowestImageValue = -100;
                  highestImageValue = 0;
                } else if (dataTypeToVisualize == ChannelModel.TransmissionData.SIGNAL_STRENGTH_VAR) {
                  lowestImageValue = 0;
                  highestImageValue = 20;
                } else if (dataTypeToVisualize == ChannelModel.TransmissionData.SNR) {
                  lowestImageValue = -10;
                  highestImageValue = 30;
                } else if (dataTypeToVisualize == ChannelModel.TransmissionData.SNR_VAR) {
                  lowestImageValue = 0;
                  highestImageValue = 20;
                } else if (dataTypeToVisualize == ChannelModel.TransmissionData.PROB_OF_RECEPTION) {
                  lowestImageValue = 0;
                  highestImageValue = 1;
                } else if (dataTypeToVisualize == ChannelModel.TransmissionData.DELAY_SPREAD_RMS) {
                  lowestImageValue = 0;
                  highestImageValue = 5;
                }
              }

              // Save coloring high-low interval
              coloringHighest = highestImageValue;
              coloringLowest = lowestImageValue;

              // Create image
              for (int x=0; x < resolution.width; x++) {
                for (int y=0; y < resolution.height; y++) {

                  tempChannelImage.setRGB(
                      x,
                      y,
                      getColorOfSignalStrength(imageValues[x][y], lowestImageValue, highestImageValue)
                  );
                }
              }
              logger.info("Attenuating area done, time=" + (System.currentTimeMillis() - timeBeforeCalculating));

              // Repaint to show the new channel propagation
              channelStartX = startX;
              channelStartY = startY;
              channelWidth = width;
              channelHeight = height;
              channelImage = tempChannelImage;

              AreaViewer.this.repaint();
              coloringIntervalPanel.repaint();

            } catch (Exception ex) {
              if (pm.isCanceled()) {
                return;
              }
              logger.fatal("Attenuation aborted: " + ex);
              ex.printStackTrace();
              pm.close();
            }
            pm.close();
          }
        };

        // Start thread
        attenuatorThread = new Thread(runnable);
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.