示例#1
0
 /** @param args */
 public static void main(String[] args) {
   Printable p = new PrinterProxy("Alice");
   System.out.println("名前は現在" + p.getPrinterName() + "です");
   p.setPrinterName("Bob");
   System.out.println("名前は現在" + p.getPrinterName() + "です");
   p.print("Hello, world.");
 }
示例#2
0
 public String toText() {
   StringBuilder sb = new StringBuilder();
   boolean first = true;
   for (Printable w : pages) {
     if (!first) {
       sb.append("\n");
     }
     first = false;
     sb.append(w.toText());
   }
   return sb.toString();
 }
示例#3
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;
  }
示例#4
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();
  }
示例#5
0
  public static void main(String[] main_args) throws LuaException, ClassNotFoundException {
    LuaState L = LuaStateFactory.newLuaState();
    L.openBase();

    L.LdoString(str);

    LuaObject func = L.getLuaObject("imprime");
    Object[] teste = func.call(new Object[] {"TESTANDO"}, 2);
    System.out.println(teste[0]);
    System.out.println(teste[1]);

    System.out.println("PROXY TEST :");
    Printable p = new ObjPrint();
    p.print("TESTE 1");

    LuaObject o = L.getLuaObject("luaPrint");
    p = (Printable) o.createProxy("org.keplerproject.luajava.test.Printable");
    p.print("Teste 2");

    L.close();
  }
示例#6
0
 public void print(Printable p) {
   print(p, ApplicationRegistry.getOutputDirectory() + p.getName() + "." + ts + ".csv");
 }