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); } }
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); } }