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();

Source Link

Usage

From source file:com.gwtplatform.mvp.rebind.NonLeafTabContentProxyOutputter.java

License:Apache License

private void writeGetTabDataInternalMethod(SourceWriter writer) throws UnableToCompleteException {
    if (tabLabel != null) {
        // Simple string tab label
        writer.println();
        writer.println("protected TabData getTabDataInternal(" + ginjectorInspector.getGinjectorClassName()
                + " ginjector) {");
        writer.indent();/*from   w ww . ja v  a2  s  .  com*/
        writer.println("return new TabDataBasic(\"" + tabLabel + "\", " + tabPriority + ");");
        writer.outdent();
        writer.println("}");
    } else {
        tabInfoMethod.writeGetTabDataInternalMethod(writer);
    }
}

From source file:com.gwtplatform.mvp.rebind.PresenterInspector.java

License:Apache License

/**
 * Register a {@link com.gwtplatform.mvp.client.proxy.RevealContentHandler RevealContentHandler}
 * for each {@code @ContentSlot} defined in the presenter.
 *//*  w  w  w .ja v a2 s.c  om*/
public void writeContentSlotHandlerRegistration(SourceWriter writer) {
    if (contentSlots.size() == 0) {
        return;
    }

    writer.println();
    writer.println(
            "RevealContentHandler<" + presenterClassName + "> revealContentHandler = new RevealContentHandler<"
                    + presenterClassName + ">( eventBus, this );");

    for (JField field : contentSlots) {
        writer.println("getEventBus().addHandler( " + presenterClassName + "." + field.getName()
                + ", revealContentHandler );");
    }
}

From source file:com.gwtplatform.mvp.rebind.PresenterTitleMethod.java

License:Apache License

private void writeProxyMethodStaticReturningString(SourceWriter writer) {
    writer.println();
    writer.println("protected void getPlaceTitle(GetPlaceTitleEvent event) {");
    writer.indent();/*ww w .j a  v  a2 s .co  m*/
    writer.print("String title = " + presenterInspector.getPresenterClassName() + ".");
    writePresenterMethodCall(writer);
    writer.println();
    writer.println("event.getHandler().onSetPlaceTitle( title );");
    writer.outdent();
    writer.println("}");
}

From source file:com.gwtplatform.mvp.rebind.PresenterTitleMethod.java

License:Apache License

private void writeProxyMethodStaticWithHandler(SourceWriter writer) {
    writer.println();
    writer.println("protected void getPlaceTitle(GetPlaceTitleEvent event) {");
    writer.indent();/*from www  .j a va2  s  . co m*/
    writer.print(presenterInspector.getPresenterClassName() + ".");
    writePresenterMethodCall(writer);
    writer.println();
    writer.println("}");
}

From source file:com.gwtplatform.mvp.rebind.PresenterTitleMethod.java

License:Apache License

private void writeProxyMethodNonStaticReturnString(SourceWriter writer) {
    writer.println();
    writer.println("protected void getPlaceTitle(final GetPlaceTitleEvent event) {");
    writer.indent();//from   www. j  a  v a 2  s . c  om
    writer.println("getPresenter( new NotifyingAsyncCallback<" + presenterInspector.getPresenterClassName()
            + ">(getEventBus()){");
    writer.indent();
    writer.indent();
    writer.println("public void success(" + presenterInspector.getPresenterClassName() + " p ) {");
    writer.indent();
    writer.print("String title = p.");
    writePresenterMethodCall(writer);
    writer.println();
    writer.println("event.getHandler().onSetPlaceTitle( title );");
    writer.outdent();
    writer.println(" }");
    writer.println("public void failure(Throwable t) { event.getHandler().onSetPlaceTitle(null); }");
    writer.outdent();
    writer.println("} );");
    writer.outdent();
    writer.println("}");
}

From source file:com.gwtplatform.mvp.rebind.PresenterTitleMethod.java

License:Apache License

private void writeProxyMethodNonStaticWithHandler(SourceWriter writer) {
    writer.println();
    writer.println("protected void getPlaceTitle(final GetPlaceTitleEvent event) {");
    writer.indent();//from  ww w .  j  av a  2  s .c  o  m
    writer.println("getPresenter( new NotifyingAsyncCallback<" + presenterInspector.getPresenterClassName()
            + ">(getEventBus()){");
    writer.indent();
    writer.indent();
    writer.print("public void success(" + presenterInspector.getPresenterClassName() + " p ) { p.");
    writePresenterMethodCall(writer);
    writer.println(" }");
    writer.println("public void failure(Throwable t) { event.getHandler().onSetPlaceTitle(null); }");
    writer.outdent();
    writer.println("} );");
    writer.outdent();
    writer.println("}");
}

From source file:com.gwtplatform.mvp.rebind.ProviderBundleGenerator.java

License:Apache License

private void writeConstructor(SourceWriter sourceWriter, List<JClassType> presenters) {
    sourceWriter.print("@" + Inject.class.getSimpleName());
    sourceWriter.println();
    sourceWriter.print("public " + getClassName() + "(");
    sourceWriter.println();/*from   w ww.j  ava  2  s.  co m*/
    sourceWriter.indent();
    sourceWriter.indent();

    int i = 0;
    for (JClassType presenter : presenters) {
        String name = presenter.getSimpleSourceName();
        sourceWriter.print(String.format(CTOR_PARAM, name, name.toLowerCase()));
        if (i == presenters.size() - 1) {
            sourceWriter.print(") {");
        } else {
            sourceWriter.print(",");
        }
        sourceWriter.println();
        i++;
    }

    sourceWriter.outdent();
    sourceWriter.print("super(" + presenters.size() + ");");
    sourceWriter.println();
    for (JClassType presenter : presenters) {
        String name = presenter.getSimpleSourceName();
        sourceWriter.print(String.format(ARRAY_SETTER, name.toUpperCase(), name.toLowerCase()));
        sourceWriter.println();
    }
    sourceWriter.outdent();
    sourceWriter.print("}");
    sourceWriter.println();
    sourceWriter.outdent();
}

From source file:com.gwtplatform.mvp.rebind.ProxyOutputterBase.java

License:Apache License

@Override
public final void writeFields(SourceWriter writer) {
    writer.println();
    writer.println("private " + ginjectorInspector.getGinjectorClassName() + " ginjector;");
}

From source file:com.gwtplatform.mvp.rebind.ProxyOutputterBase.java

License:Apache License

@Override
public final void writeConstructor(SourceWriter writer, String className, boolean registerDelayedBind) {
    writer.println();
    writer.println("public " + className + "() {");
    if (registerDelayedBind) {
        writer.indent();//from   w w w.j  a va  2s . c o  m
        writer.println("DelayedBindRegistry.register(this);");
        writer.outdent();
    }
    writer.println("}");
}

From source file:com.gwtplatform.mvp.rebind.ProxyOutputterBase.java

License:Apache License

@Override
public final void writeMethods(SourceWriter writer) throws UnableToCompleteException {
    // Write delayedBind
    writer.println();
    writer.println("@Override");
    writer.println("public void delayedBind(Ginjector baseGinjector) {");
    writer.indent();/*  w w  w .  j  a v  a  2  s  .c o  m*/
    writeGinjectorAssignation(writer, ginjectorInspector.getGinjectorClassName());
    writer.println("bind(ginjector.getPlaceManager(),");
    writer.println("    ginjector.getEventBus());");
    writeSubclassDelayedBind(writer);
    writeAddHandlerForProxyEvents(writer);
    writer.outdent();
    writer.println("}");
    writeHandlerMethodsForProxyEvents(writer);

    writeSubclassMethods(writer);
}