Example usage for com.google.gwt.user.rebind SourceWriter println

List of usage examples for com.google.gwt.user.rebind SourceWriter println

Introduction

In this page you can find the example usage for com.google.gwt.user.rebind SourceWriter println.

Prototype

void println(String s, Object... args);

Source Link

Document

Emit a printf-style string.

Usage

From source file:fr.putnami.pwt.core.inject.rebind.base.AbstractInjectorCreator.java

License:Open Source License

protected void writeConstructor(TreeLogger logger, GeneratorContext context, SourceWriter srcWriter) {
    srcWriter.println("public %s() {", this.proxyName);
    srcWriter.indent();//from   ww w .j  a v  a  2s.com
    for (InjectorWritterConstructor delegate : Iterables.filter(this.delegates,
            InjectorWritterConstructor.class)) {
        delegate.writeConstructor(srcWriter);
    }
    srcWriter.outdent();
    srcWriter.println("}");
}

From source file:fr.putnami.pwt.core.inject.rebind.delegate.InjectPostconstructCreator.java

License:Open Source License

@Override
public void writeConstructor(SourceWriter srcWriter) {
    srcWriter.println("%s();", this.postConstructMethod.getName());
}

From source file:fr.putnami.pwt.core.inject.rebind.delegate.InjectPresenterCreator.java

License:Open Source License

@Override
public void writePresent(SourceWriter srcWriter) {
    for (JMethod presenterMethod : this.presenterMethods) {
        if (presenterMethod.getParameters().length == 0) {
            srcWriter.println("super.%s();", presenterMethod.getName());
        } else if (presenterMethod.getParameters().length > 0) {
            JType placeType = presenterMethod.getParameters()[0].getType();
            srcWriter.println("if(place instanceof %s){", placeType.getSimpleSourceName());
            srcWriter.indent();//from  w ww  .  j a  v a2s.  com
            srcWriter.println("super.%s((%s) place);", presenterMethod.getName(),
                    placeType.getSimpleSourceName());
            srcWriter.outdent();
            srcWriter.println("}");
        }
    }
}

From source file:fr.putnami.pwt.core.inject.rebind.delegate.InjectTemplateCreator.java

License:Open Source License

@Override
public void writeStatic(SourceWriter srcWriter) {
    if (this.templateName != null) {
        srcWriter.println("@UiTemplate(%s)", this.templateName);
    }/*from  ww w .ja va 2 s .  co m*/
    srcWriter.println("interface %s extends UiBinderLocalized<Widget, %s> {}", this.templateInterfaceName,
            this.viewType.getSimpleSourceName());
}

From source file:fr.putnami.pwt.core.inject.rebind.delegate.SuspendServiceOnPresentCreator.java

License:Open Source License

@Override
public void writeAfterPresent(SourceWriter srcWriter) {
    if (!this.hasService) {
        srcWriter.println("displayer.setWidget(%s.this);", this.injectorName);
    } else {/*from  www.jav  a  2 s . c o m*/
        srcWriter.println("commandController.flush(new CallbackAdapter<List<CommandResponse>>() {");
        srcWriter.indent();
        srcWriter.println("@Override");
        srcWriter.println("public void onSuccess(List<CommandResponse> result) {");
        srcWriter.indent();
        srcWriter.println("displayer.setWidget(%s.this);", this.injectorName);
        srcWriter.outdent();
        srcWriter.println("};");
        srcWriter.outdent();
        srcWriter.println("});");
        srcWriter.println("commandController.setSuspended(isSuspended);");
    }
}

From source file:fr.putnami.pwt.core.model.rebind.ModelCreator.java

License:Open Source License

private void appendPastValidator(SourceWriter w, JField field) {
    Past pastAnnotation = field.getAnnotation(Past.class);
    if (pastAnnotation != null) {
        w.println(", new PastValidator(\"%s\")", pastAnnotation.message());
    }/*from  w w  w.  ja v  a 2 s. co m*/
}

From source file:fr.putnami.pwt.core.model.rebind.ModelCreator.java

License:Open Source License

private void appendNullValidator(SourceWriter w, JField field) {
    Null nullAnnotation = field.getAnnotation(Null.class);
    if (nullAnnotation != null) {
        w.println(", new NullValidator(\"%s\")", nullAnnotation.message());
    }/*from ww w  .  j a  va  2s. c  o m*/
}

From source file:fr.putnami.pwt.core.model.rebind.ModelCreator.java

License:Open Source License

private void appendNotNullValidator(SourceWriter w, JField field) {
    NotNull notNullAnnotation = field.getAnnotation(NotNull.class);
    if (notNullAnnotation != null) {
        w.println(", new NotNullValidator(\"%s\")", notNullAnnotation.message());
    }//from   w  w w  .  ja v  a  2s  .  c  o m
}

From source file:fr.putnami.pwt.core.model.rebind.ModelCreator.java

License:Open Source License

private void appendFutureValidator(SourceWriter w, JField field) {
    Future futureAnnotation = field.getAnnotation(Future.class);
    if (futureAnnotation != null) {
        w.println(", new FutureValidator(\"%s\")", futureAnnotation.message());
    }//from  www .j  a  v a2s  .co m
}

From source file:fr.putnami.pwt.core.model.rebind.ModelCreator.java

License:Open Source License

private void appendFalseValidator(SourceWriter w, JField field) {
    AssertFalse falseAnnotation = field.getAnnotation(AssertFalse.class);
    if (falseAnnotation != null) {
        w.println(", new AssertFalseValidator(\"%s\")", falseAnnotation.message());
    }//from w w  w . java  2s. c  o  m
}