コード例 #1
0
 public void applyAction(ActionEvent evt) {
   if (FormatProperties.contains(getArg("format"))) {
     fireStatusEvent("Formatting...");
     String outStr =
         FormatAdapter.get(getArg("format").toUpperCase(), av.getAlignment().getSequences());
     ta.setText(outStr);
     fireStatusEvent("done");
   } else {
     fireStatusEvent("Not yet supported", StatusEvent.ERROR);
   }
 }
コード例 #2
0
  public OutputPopup(JFrame parent, AlignViewport av, Controller c, String title) {
    super(parent, av, c, title);

    sp = new JScrollPane();
    ta = new JTextArea(10, 60);
    f = new JComboBox();

    ta.setFont(new Font("Courier", Font.PLAIN, 10));
    format = new JLabel("Alignment format");

    for (int i = 0; i < FormatProperties.getFormats().size(); i++) {
      f.addItem((String) FormatProperties.getFormats().elementAt(i));
    }

    sp.add(ta);

    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1.0;

    add(sp, gb, gbc, 0, 0, 2, 2);

    gbc.fill = GridBagConstraints.HORIZONTAL;
    add(format, gb, gbc, 0, 2, 1, 1);
    add(f, gb, gbc, 1, 2, 1, 1);

    add(status, gb, gbc, 0, 3, 2, 2);

    setApplyAction(new AreaOutputAction("area output", av, c));

    pack();

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

    setLocation(
        (screenSize.width - getSize().width) / 2, (screenSize.height - getSize().height) / 2);

    show();
  }
コード例 #3
0
    public void applyAction(ActionEvent evt) {
      String fileStr = getArg("file");

      System.out.println("Output string " + fileStr);

      if (FormatProperties.contains(getArg("format"))) {
        if (parent instanceof AlignFrame) {
          AlignFrame af = (AlignFrame) parent;
          String outStr =
              FormatAdapter.get(getArg("format").toUpperCase(), av.getAlignment().getSequences());
          System.out.println(outStr + " " + fileStr);
          try {
            PrintStream ps =
                new PrintStream(new BufferedOutputStream(new FileOutputStream(fileStr)));
            fireStatusEvent("Saving file");

            try {
              Thread.sleep(500);
            } catch (Exception ex2) {
            }
            ps.print(outStr);
            ps.close();

            fireStatusEvent("done");

            fireJalActionEvent(new JalActionEvent(this, this, JalActionEvent.DONE));
          } catch (IOException ex) {
            fireStatusEvent("Can't open file", StatusEvent.ERROR);
            System.out.println("Exception : " + ex);
          }
        } else {
          fireStatusEvent("(Internal Error) Parent isn't Alignment Frame", StatusEvent.ERROR);
        }
      } else {
        fireStatusEvent("Format not yet supported", StatusEvent.ERROR);
      }
    }