Esempio n. 1
0
  /**
   * @param e
   * @return The full path and filename where the Exportable was printed
   */
  public String print(Exportable e) {
    if (e == null) return null;

    Collection<Printable> c = e.getPrintables();

    if (c == null) return null;
    String path = null;

    Iterator<Printable> i = c.iterator();

    while (i.hasNext()) {
      Printable p = i.next();
      if (path == null)
        path =
            ApplicationRegistry.getOutputDirectory() + p.getName() + "." + DateUtils.ts() + ".csv";
      print(p, path);
    }

    return path;
  }
Esempio n. 2
0
  public void print(Printable p, String file) {
    PrintStream ps = null;
    boolean state = FileUtils.doesFileExist(file);

    try {
      ps = new PrintStream(new FileOutputStream(file, true));
    } catch (Exception e) {
      e.printStackTrace();
      ps = System.err;
    }

    if (!state) {
      ps.print(p.getHeader() + ",\"Notes\"\r\n");
    }

    ps.print(p.getData());
    ps.print(",\"" + p.getNotes() + "\"\r\n");

    ps.flush();
    ps.close();
  }
Esempio n. 3
0
 public void print(Printable p) {
   print(p, ApplicationRegistry.getOutputDirectory() + p.getName() + "." + ts + ".csv");
 }