Пример #1
0
 public PropWriter prop(String name, Object value) {
   pindent();
   out.print(".set" + name.substring(0, 1).toUpperCase() + name.substring(1));
   out.print("(" + valueToString(value) + ")");
   out.println();
   return this;
 }
Пример #2
0
 public PropWriter p(String name, double value) {
   pindent();
   out.print(".set" + name.substring(0, 1).toUpperCase() + name.substring(1));
   out.print("(" + "" + value + "" + ")");
   out.println();
   return this;
 }
Пример #3
0
 private void pindent() {
   for (int i = 0; i < indent; i++) {
     out.print("    ");
   }
 }
Пример #4
0
  private void exportBinding(PrintWriter out, Binding binding) {
    if (AminoAdapter.shouldExportAsSetter(binding)) {
      String prop = binding.getTargetProperty().getName();
      out.println(
          binding.getTarget().getId()
              + ".set"
              + prop.substring(0, 1).toUpperCase()
              + prop.substring(1)
              + "("
              + binding.getSource().getId()
              + ");");
      return;
    }

    if (AminoAdapter.shouldExportAsAdder(binding)) {
      out.print(binding.getTarget().getId() + ".add(");
      out.print(binding.getSource().getId());
      out.println(");");
      return;
    }

    if (AminoAdapter.shouldExportAsTrigger(binding)) {
      out.println(binding.getSource().getId() + ".setCallback(" + "function(){\n");
      out.println("    " + binding.getTarget().getId() + ".execute();");
      out.println("});");
      return;
    }

    if (binding.getSource().getName().equals("ListView")) {
      if (binding.getSourceProperty().isProxy()) {
        p("it's a proxy! " + binding.getSourceProperty().getName());
        p("master = " + binding.getSourceProperty().getMasterProperty());
        String n = binding.getTargetProperty().getName();
        String setterName = "set" + n.substring(0, 1).toUpperCase() + n.substring(1);
        out.println(
            binding.getSource().getId()
                + ".listen(function(e){\n"
                + "  var val = e.getSelectedObject()."
                + binding.getSourceProperty().getName()
                + ";\n"
                + "  "
                + binding.getTarget().getId()
                + "."
                + setterName
                + "(val);\n"
                + "});\n");
        return;
      }
    }

    out.println(
        "var binder = new Binder()"
            + ".set("
            + binding.getSource().getId()
            + ",'"
            + binding.getSourceProperty().getName()
            + "',"
            + binding.getTarget().getId()
            + ",'"
            + binding.getTargetProperty().getName()
            + "');\n"
            + "engine.addAnim(binder);\n"
            + "binder.start();\n");
  }