public void actionPerformed(ActionEvent event) {
    if (Debug.isActive()) Debug.println("Action for Collapse Tree button");

    tree_view.collapseLevel();
    toolbar.getYaxisTreeCommitButton().doClick();

    // Set toolbar buttons to reflect status
    toolbar.resetYaxisTreeButtons();
  }
示例#2
0
  public void actionPerformed(ActionEvent event) {
    Window window;
    String msg;

    if (model.isZoomUndoStackEmpty()) {
      window = SwingUtilities.windowForComponent((JToolBar) toolbar);
      msg = "Zoom Undo Stack is empty";
      Dialogs.warn(window, msg);
    } else model.zoomUndo();

    // Set toolbar buttons to reflect status
    if (toolbar != null) toolbar.resetZoomButtons();

    if (Debug.isActive()) Debug.println("Action for Zoom Undo button.");
  }
示例#3
0
    private BufferedImage createThumbNailImage(Dimension imgSize, ProgressMonitor pm) {
      Assert.notNull(pm, "pm");

      String thumbNailBandName = getThumbnailBandName();
      Band thumbNailBand = product.getBand(thumbNailBandName);

      Debug.trace(
          "ProductSubsetDialog: Reading thumbnail data for band '" + thumbNailBandName + "'...");
      pm.beginTask("Creating thumbnail image", 5);
      BufferedImage image = null;
      try {
        MultiLevelSource multiLevelSource =
            BandImageMultiLevelSource.create(thumbNailBand, SubProgressMonitor.create(pm, 1));
        final ImageLayer imageLayer = new ImageLayer(multiLevelSource);
        final int imageWidth = imgSize.width;
        final int imageHeight = imgSize.height;
        final int imageType = BufferedImage.TYPE_3BYTE_BGR;
        image = new BufferedImage(imageWidth, imageHeight, imageType);
        Viewport snapshotVp = new DefaultViewport(isModelYAxisDown(imageLayer));
        final BufferedImageRendering imageRendering = new BufferedImageRendering(image, snapshotVp);

        final Graphics2D graphics = imageRendering.getGraphics();
        graphics.setColor(getBackground());
        graphics.fillRect(0, 0, imageWidth, imageHeight);

        snapshotVp.zoom(imageLayer.getModelBounds());
        snapshotVp.moveViewDelta(snapshotVp.getViewBounds().x, snapshotVp.getViewBounds().y);
        imageLayer.render(imageRendering);

        pm.worked(4);
      } finally {
        pm.done();
      }
      return image;
    }
示例#4
0
  private void showDeclaration(BeanTableSorted from, boolean isNcml) {
    Variable v = getCurrentVariable(from);
    if (v == null) return;
    infoTA.clear();
    if (isNcml) {
      Formatter out = new Formatter();
      try {
        NCdumpW.writeNcMLVariable(v, out);
      } catch (IOException e) {
        e.printStackTrace();
      }
      infoTA.appendLine(out.toString());

    } else {
      infoTA.appendLine(v.toString());
    }

    if (Debug.isSet("Xdeveloper")) {
      infoTA.appendLine("\n");
      infoTA.appendLine("FULL NAME = " + v.getFullName());
      infoTA.appendLine("\n");
      infoTA.appendLine(v.toStringDebug());
    }
    infoTA.gotoTop();
    infoWindow.setTitle("Variable Info");
    infoWindow.show();
  }
示例#5
0
 /**
  * Retrieve the data blob, Certificate Pretty Print or Base64Encode cert, from the data object.
  * Used by the view functionality.
  *
  * @param row cert table row number
  * @retrun data in string format
  */
 public String getDataBlob(int row) {
   try {
     NameValuePairs obj = (NameValuePairs) getObjectValueAt(row);
     return obj.get(CERT_DATA);
   } catch (Exception e) {
     Debug.println("CertDataModel: getDataBlob()- " + e.toString());
     return "";
   }
 }
示例#6
0
  private static RasterDataNode[] getReferencedNodes(final RasterDataNode node) {
    final Product product = node.getProduct();
    if (product != null) {
      final List<String> expressions = new ArrayList<String>(10);
      if (node.getValidPixelExpression() != null) {
        expressions.add(node.getValidPixelExpression());
      }
      final ProductNodeGroup<Mask> overlayMaskGroup = node.getOverlayMaskGroup();
      if (overlayMaskGroup.getNodeCount() > 0) {
        final Mask[] overlayMasks =
            overlayMaskGroup.toArray(new Mask[overlayMaskGroup.getNodeCount()]);
        for (final Mask overlayMask : overlayMasks) {
          final String expression;
          if (overlayMask.getImageType() == Mask.BandMathsType.INSTANCE) {
            expression = Mask.BandMathsType.getExpression(overlayMask);
          } else if (overlayMask.getImageType() == Mask.RangeType.INSTANCE) {
            expression = Mask.RangeType.getExpression(overlayMask);
          } else {
            expression = null;
          }
          if (expression != null) {
            expressions.add(expression);
          }
        }
      }
      if (node instanceof VirtualBand) {
        final VirtualBand virtualBand = (VirtualBand) node;
        expressions.add(virtualBand.getExpression());
      }

      final ArrayList<Term> termList = new ArrayList<Term>(10);
      for (final String expression : expressions) {
        try {
          final Term term = product.parseExpression(expression);
          if (term != null) {
            termList.add(term);
          }
        } catch (ParseException e) {
          // @todo se handle parse exception
          Debug.trace(e);
        }
      }

      final Term[] terms = termList.toArray(new Term[termList.size()]);
      final RasterDataSymbol[] refRasterDataSymbols = BandArithmetic.getRefRasterDataSymbols(terms);
      return BandArithmetic.getRefRasters(refRasterDataSymbols);
    }
    return new RasterDataNode[0];
  }
示例#7
0
  public pmLogin(JFrame f, String title, String msg, pmTop t, String h) {

    super(f, title, true); // modal

    theTop = t;
    theTag = h;
    theFrame = f;

    JLabel l;
    JPanel p;

    // initialize constraints
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(10, 10, 10, 10);
    c.anchor = GridBagConstraints.EAST;

    // top panel contains the desired message
    p = new JPanel();
    p.setLayout(new GridBagLayout());

    l = new JLabel(msg, SwingConstants.CENTER);
    p.add(l, c);
    this.getContentPane().add(p, "North");

    // NIS middle panel
    // contains username and password
    if (t.ns.getNameService().equals("nis")) {

      p = new JPanel();
      p.setLayout(new GridBagLayout());

      l = new JLabel(pmUtility.getResource("Hostname:"), SwingConstants.RIGHT);
      p.add(l, c);

      l = new JLabel(pmUtility.getResource("Username:"******"Password:"******"Password.mnemonic"));

      c.gridx = 1;
      c.weightx = 1.0;

      String nisMaster;
      try {
        nisMaster = theTop.host.getNisMaster();
      } catch (Exception e) {
        nisMaster = new String("Unknown");
        Debug.warning("pmLogin: getNisMaster() returns exception: " + e);
      }

      c.anchor = GridBagConstraints.WEST;

      l = new JLabel(nisMaster, SwingConstants.LEFT);
      p.add(l, c);

      l = new JLabel(("root"), SwingConstants.LEFT);
      p.add(l, c);

      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.CENTER;
      c.gridy = GridBagConstraints.RELATIVE;

      p.add(passwordField, c);
      passwordField.setEchoChar('*');

      this.getContentPane().add(p, "Center");

    } else if (t.ns.getNameService().equals("ldap")) {

      // middle panel contains LDAP server name, distinguished name,
      // and password
      p = new JPanel();
      p.setLayout(new GridBagLayout());

      // LDAP Server Name
      l = new JLabel(pmUtility.getResource("LDAP.Server:"), SwingConstants.RIGHT);
      p.add(l, c);

      serverField = new pmTextField(25);
      serverField.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              okPressed();
            }
          });

      String ldapMaster;
      try {
        ldapMaster = theTop.host.getLDAPMaster();
      } catch (Exception e) {
        ldapMaster = new String("");
        Debug.warning("pmLdap: getLDAPMaster() returns exception: " + e);
      }

      serverField.setText(ldapMaster);
      c.gridx = 1;
      p.add(serverField, c);

      // Distinguished Name
      c.gridx = 0;
      l = new JLabel(pmUtility.getResource("Distinguished.Name:"), SwingConstants.RIGHT);
      p.add(l, c);

      dnField = new pmTextField(25);
      dnField.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              okPressed();
            }
          });

      String defaultDN;
      try {
        defaultDN = theTop.host.getDefaultAdminDN();
      } catch (Exception e) {
        defaultDN = new String("");
        Debug.warning("pmLdap: getDefaultAdminDN() returns exception: " + e);
      }

      dnField.setText(defaultDN);
      c.gridx = 1;
      p.add(dnField, c);

      // Password
      c.gridx = 0;
      l = new JLabel(pmUtility.getResource("Password:"******"Password.mnemonic"));

      c.gridx = 1;
      c.weightx = 1.0;

      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.CENTER;
      c.gridy = GridBagConstraints.RELATIVE;

      p.add(passwordField, c);
      passwordField.setEchoChar('*');

      this.getContentPane().add(p, "Center");
    }

    // bottom panel contains buttons
    c.gridx = 0;
    c.weightx = 1.0;
    c.weighty = 0.0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;

    JPanel thePanel = new JPanel();

    okButton = new pmButton(pmUtility.getResource("OK"));
    okButton.setMnemonic(pmUtility.getIntResource("OK.mnemonic"));
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            okPressed();
          }
        });
    thePanel.add(okButton, c);

    cancelButton = new pmButton(pmUtility.getResource("Cancel"));
    cancelButton.setMnemonic(pmUtility.getIntResource("Cancel.mnemonic"));
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            cancelPressed();
          }
        });
    thePanel.add(cancelButton, c);

    if (theTag != null && theTop != null) {

      helpButton = new pmButton(pmUtility.getResource("Help"));
      helpButton.setMnemonic(pmUtility.getIntResource("Help.mnemonic"));
      p.add(helpButton);
      helpButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              helpPressed();
            }
          });
      thePanel.add(helpButton, c);
    }

    this.getContentPane().add(thePanel, "South");

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            returnValue = JOptionPane.CLOSED_OPTION;
            pmLogin.this.setVisible(false);
          }
        });

    // handle Esc as cancel in any case
    this.getRootPane()
        .registerKeyboardAction(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Debug.message("CLNT:  default cancel action");
                cancelPressed();
              }
            },
            KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
            JComponent.WHEN_IN_FOCUSED_WINDOW);

    // lay out the dialog
    this.pack();

    // set focus and defaults after packing...
    // this.getRootPane().setDefaultButton(okButton);
    okButton.setAsDefaultButton();

    passwordField.requestFocus();
  }