Package com.google.gwt.user.rebind

Examples of com.google.gwt.user.rebind.SourceWriter.indent()


        + " setJavaScriptObject(");
    sw.println("JavaScriptObject obj) {");
    sw.indent();

    sw.println("if (obj != null) {");
    sw.indent();
    for (Task t : context.tasks) {
      if (t.imported != null) {
        String fieldName = t.getFieldName(logger);
        sw.print("assert JSONWrapperUtil.hasField(obj, \"");
        sw.print(fieldName);
View Full Code Here


    sw.println("}");

    // Method declaration
    sw.print("public native " + context.simpleTypeName
        + " setJavaScriptObjectNative(JavaScriptObject obj) /*-{");
    sw.indent();

    if (context.maintainIdentity) {
      // Delete the backing object's reference to the current wrapper
      sw.print("if (");
      sw.print(context.objRef);
View Full Code Here

    if (context.maintainIdentity) {
      // Delete the backing object's reference to the current wrapper
      sw.print("if (");
      sw.print(context.objRef);
      sw.println(") {");
      sw.indent();
      sw.print("delete ");
      sw.print(context.objRef);
      sw.print(".");
      sw.print(BACKREF);
      sw.println(";");
View Full Code Here

      sw.println("}");
    }

    // If the incoming JSO is null or undefined, reset the JSWrapper
    sw.println("if (!obj) {");
    sw.indent();
    sw.print(context.objRef);
    sw.println(" = null;");
    sw.println("return this;");
    sw.outdent();
    sw.println("}");
View Full Code Here

      // Verify that the incoming object doesn't already have a wrapper object.
      // If there is a backreference, throw an exception.
      sw.print("if (obj.");
      sw.print(BACKREF);
      sw.println(") {");
      sw.indent();
      sw.println("@com.google.gwt.jsio.client.impl.JSONWrapperUtil::throwMultipleWrapperException()();");
      sw.outdent();
      sw.println("}");
    }
View Full Code Here

    // class to ensure that if the class is used with a JSList, only one
    // instance of the Extractor will ever exist.
    sw.println("public final Extractor<"
        + parameterization.getParameterizedQualifiedSourceName()
        + "> getExtractor() {");
    sw.indent();
    sw.print("return ");
    sw.print(EXTRACTOR);
    sw.println(";");
    sw.outdent();
    sw.println("}");
View Full Code Here

    // The one instance of the Extractor
    sw.print("private final static Extractor ");
    sw.print(EXTRACTOR);
    sw.print(" = new Extractor() {");
    sw.indent();
    FragmentGeneratorContext subParams = new FragmentGeneratorContext(context);
    subParams.parameterName = "obj";
    FragmentGenerator fragmentGenerator = context.fragmentGeneratorOracle.findFragmentGenerator(
        logger, typeOracle, returnType);
View Full Code Here

    subParams.parameterName = "obj";
    FragmentGenerator fragmentGenerator = context.fragmentGeneratorOracle.findFragmentGenerator(
        logger, typeOracle, returnType);

    sw.println("public native Object fromJS(JavaScriptObject obj) /*-{");
    sw.indent();
    sw.print("return ");
    fragmentGenerator.fromJS(subParams);
    sw.println(";");
    sw.outdent();
    sw.println("}-*/;");
 
View Full Code Here

    sw.println("}-*/;");

    // Write the Extracor's toJS function and close the Extractor
    // implementation.
    sw.println("public native JavaScriptObject toJS(Object obj) /*-{");
    sw.indent();
    sw.print("return ");
    fragmentGenerator.toJS(subParams);
    sw.println(";");
    sw.outdent();
    sw.println("}-*/;");
 
View Full Code Here

        sw.print(", ");
      }
    }
    sw.print(")");
    sw.println(" /*-{");
    sw.indent();

    // The return type of the function we're importing.
    JType returnType = constructor.getReturnType();

    sw.print("var jsReturn = ");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.