com.google.gwt.user.rebind.SourceWriter Java Examples
The following examples show how to use
com.google.gwt.user.rebind.SourceWriter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InjectErrorManagerCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void writeEntryPoint(SourceWriter srcWriter) { srcWriter.println("ErrorManager.get();"); if (!ErrorDisplayer.class.equals(this.errorDisplay)) { srcWriter.println("ErrorManager.get().setErrorDisplayer(GWT.<ErrorDisplayer> create(%s.class));", InjectCreatorUtil.toClassName(this.errorDisplay)); } if (this.errorHandlers != null) { for (Class<? extends ErrorHandler> handlerClass : this.errorHandlers) { srcWriter.println("ErrorManager.get().registerErrorHandler(new %s());", InjectCreatorUtil.toClassName(handlerClass)); } } if (this.errorHandlers != null) { for (JMethod handlerMethod : this.handlerMethods) { srcWriter.println("ErrorManager.get().registerErrorHandler(" + "new fr.putnami.pwt.core.error.client.ErrorHandler() {"); srcWriter.indent(); srcWriter.println("@Override public boolean handle(Throwable error) { return %s.this.%s(error); }", this.injectorName, handlerMethod.getName()); srcWriter.println("@Override public int getPriority() { return HIGH_PRIORITY; }"); srcWriter.outdent(); srcWriter.println("});"); } } }
Example #2
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private void generateServiceImplementationWithCallback(TreeLogger logger, SourceWriter srcWriter) throws UnableToCompleteException { for (JMethod method : this.serviceBinderType.getMethods()) { JParameter[] methodParams = method.getParameters(); JParameter callbackParam = null; if (methodParams != null && methodParams.length > 0) { callbackParam = methodParams[methodParams.length - 1]; } if (callbackParam == null) { break; } this.writeStartMethod(srcWriter, method); this.writeCommandDefinition(logger, srcWriter, method, callbackParam); this.writeCommandParam(srcWriter, method, null, callbackParam); this.writeEndMethod(srcWriter, method); } }
Example #3
Source File: SuspendServiceOnPresentCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void writeAfterPresent(SourceWriter srcWriter) { if (!this.hasService) { srcWriter.println("displayer.setWidget(%s.this);", this.injectorName); } else { 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);"); } }
Example #4
Source File: InjectMvpDescriptionCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void writeEntryPoint(SourceWriter srcWriter) { srcWriter.println("MvpController mvpController = MvpController.get();"); srcWriter.println("AcceptsOneWidget mvpDisplay = null;"); if (this.display != null && !AcceptsOneWidget.class.equals(this.display)) { srcWriter.println("mvpDisplay = GWT.create(%s.class);", InjectCreatorUtil.toClassName(this.display)); } srcWriter.println("if(mvpDisplay != null){"); srcWriter.indent(); srcWriter.println("mvpController.setDisplay(mvpDisplay);"); srcWriter.outdent(); srcWriter.println("}"); srcWriter.println("if(mvpDisplay instanceof IsWidget){"); srcWriter.indent(); srcWriter.println("RootPanel.get().add((IsWidget) mvpDisplay);"); srcWriter.outdent(); srcWriter.println("}"); if (this.defaultPlace != null && !Place.class.equals(this.defaultPlace)) { srcWriter.println("mvpController.setDefaultPlace(new %s());", InjectCreatorUtil.toClassName(this.defaultPlace)); } for (Class<?> activity : this.activities) { srcWriter.println("mvpController.registerActivity(GWT.<ActivityFactory> create(%s.class));", InjectCreatorUtil.toClassName(activity)); } }
Example #5
Source File: InjectMayStopActivityCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void writePresent(SourceWriter srcWriter) { srcWriter .println("final HandlerRegistrationCollection mayStopRegistrations = new HandlerRegistrationCollection();"); for (JMethod mayStopMethod : this.presenterMethods) { srcWriter.println("mayStopRegistrations.add(EventBus.get()" + ".addHandlerToSource(MayStopActivityEvent.TYPE, place, new MayStopActivityEvent.Handler() {"); srcWriter.indent(); srcWriter.println("@Override public void onMayStopActivity(MayStopActivityEvent event) {"); srcWriter.indent(); srcWriter.println("if (event.getMessage() == null) { event.setMessage(%s.this.%s()); }", this.injectorName, mayStopMethod.getName()); srcWriter.outdent(); srcWriter.outdent(); srcWriter.println("}}));"); } srcWriter.println("mayStopRegistrations.add(EventBus.get()" + ".addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {"); srcWriter.indent(); srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {"); srcWriter.indent(); srcWriter.println("mayStopRegistrations.removeHandler();"); srcWriter.outdent(); srcWriter.outdent(); srcWriter.println("}}));"); }
Example #6
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
public String create(TreeLogger logger, GeneratorContext context) throws UnableToCompleteException, NotFoundException { PrintWriter printWriter = this.getPrintWriter(logger, context); if (printWriter == null) { return this.proxyModelQualifiedName; } this.serializerTypeName = this.createSerializer(logger, context); this.collectImports(); SourceWriter srcWriter = this.getSourceWriter(printWriter, context); srcWriter.indent(); srcWriter.println(); this.generateSerializer(srcWriter); srcWriter.println(); this.generateServiceImplementation(logger, srcWriter); this.generateServiceImplementationWithCallback(logger, srcWriter); srcWriter.outdent(); srcWriter.commit(logger); return this.proxyModelQualifiedName; }
Example #7
Source File: InjectStopActivityCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void writePresent(SourceWriter srcWriter) { srcWriter.println("final HandlerRegistrationCollection stopRegistrations = new HandlerRegistrationCollection();"); for (JMethod mayStopMethod : this.presenterMethods) { srcWriter.println("stopRegistrations.add(EventBus.get()" + ".addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {"); srcWriter.indent(); srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {"); srcWriter.indent(); srcWriter.println("%s.this.%s();", this.injectorName, mayStopMethod.getName()); srcWriter.outdent(); srcWriter.outdent(); srcWriter.println("}}));"); } srcWriter.println("stopRegistrations.add(EventBus.get()" + ".addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {"); srcWriter.indent(); srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {"); srcWriter.indent(); srcWriter.println("stopRegistrations.removeHandler();"); srcWriter.outdent(); srcWriter.outdent(); srcWriter.println("}}));"); }
Example #8
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private void generateConstructor(TreeLogger logger, SourceWriter srcWriter) { int lastIndex = this.proxyModelQualifiedName.lastIndexOf('.'); String className = lastIndex == -1 ? this.proxyModelQualifiedName : this.proxyModelQualifiedName.substring(lastIndex + 1, this.proxyModelQualifiedName.length()); srcWriter.println("public %s(){", className); srcWriter.indent(); if (this.subModels.get(this.parentType) != null) { srcWriter.println("super(%s.INSTANCE, %s.class);", this.subModels.get(this.parentType), this.beanType.getSimpleSourceName()); srcWriter.println(); } else { srcWriter.println("super(%s.class);", this.beanType.getSimpleSourceName()); srcWriter.println(); } srcWriter.outdent(); srcWriter.println("}"); }
Example #9
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private void writeCommandDefinition(TreeLogger logger, SourceWriter srcWriter, JMethod method, JParameter callbackParameter) throws UnableToCompleteException { srcWriter.print("CommandDefinition commandDefinition = new CommandDefinition("); srcWriter.print("\"%s\", ", this.serviceType.getQualifiedSourceName()); srcWriter.print("\"%s\", ", method.getName()); if (callbackParameter != null) { JParameterizedType parameterizedCallback = callbackParameter.getType().isParameterized(); if (parameterizedCallback != null) { srcWriter.print("\"%s\" ", parameterizedCallback.getTypeArgs()[0].getQualifiedSourceName()); } else { logger.branch(TreeLogger.ERROR, "Callback argument type for method " + method.getName() + " is not parametrized", null); throw new UnableToCompleteException(); } } else { srcWriter.print("\"%s\" ", method.getReturnType().getQualifiedSourceName()); } for (JParameter parameter : method.getParameters()) { if (!parameter.equals(callbackParameter)) { srcWriter.print(", \"%s\"", parameter.getType().getQualifiedSourceName()); } } srcWriter.println(");"); }
Example #10
Source File: JsonAutoBeanGenerator.java From requestor with Apache License 2.0 | 6 votes |
private String generateProviderField(SourceWriter w, JClassType type) { final String fieldName = getFieldName(type); final String autoBeanFactoryMethodName = factoryFieldName + "." + fieldName; final String providerFieldName = fieldName + "Provider"; w.println("private final Provider %s = new Provider<%s>() {", providerFieldName, type.getQualifiedSourceName()); w.println(" @Override"); w.println(" public Class<%s> getType() {", type.getQualifiedSourceName()); w.println(" return %s.class;", type.getQualifiedSourceName()); w.println(" }"); w.println(); w.println(" @Override"); w.println(" public %s getInstance() {", type.getQualifiedSourceName()); w.println(" return %s().as();", autoBeanFactoryMethodName); w.println(" }"); w.println("};"); w.println(); return providerFieldName; }
Example #11
Source File: ProxyViewCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
public String create(TreeLogger logger, GeneratorContext context) { PrintWriter printWriter = context.tryCreate(logger, this.packageName, this.viewProxySimpleName); if (printWriter == null) { return this.viewProxyQualifiedName; } SourceWriter srcWriter = this.getSourceWriter(printWriter, context); srcWriter.indent(); this.generateProxy(logger, srcWriter); srcWriter.println(); this.generateTokenPrefixes(logger, srcWriter); srcWriter.println(); if (this.placeTokenizerClass == null) { this.generateInternalTokenizer(logger, srcWriter); } else { this.generateDelegateTokenizer(logger, srcWriter); } this.generateActivityFactory(logger, srcWriter); srcWriter.outdent(); srcWriter.commit(logger); return this.viewProxyQualifiedName; }
Example #12
Source File: EventBinderGenerator.java From gwteventbinder with Apache License 2.0 | 6 votes |
private SourceWriter createSourceWriter( TreeLogger logger, GeneratorContext context, JClassType eventBinderType, JClassType targetType) { String simpleName = getSimpleGeneratedClassName(eventBinderType); String packageName = eventBinderType.getPackage().getName(); ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleName); composer.setSuperclass(AbstractEventBinder.class.getCanonicalName() + "<" + targetType.getQualifiedSourceName() + ">"); composer.addImplementedInterface(eventBinderType.getName()); composer.addImport(EventBinder.class.getCanonicalName()); composer.addImport(EventBus.class.getCanonicalName()); composer.addImport(GenericEvent.class.getCanonicalName()); composer.addImport(GenericEventHandler.class.getCanonicalName()); composer.addImport(HandlerRegistration.class.getCanonicalName()); composer.addImport(LinkedList.class.getCanonicalName()); composer.addImport(List.class.getCanonicalName()); PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName); return (printWriter != null) ? composer.createSourceWriter(context, printWriter) : null; }
Example #13
Source File: UiBinderLocalizedCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) { String packageName = this.binderType.getPackage().getName(); String className = this.binderProxySimpleName; ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className); composerFactory.addImport(GWT.class.getName()); composerFactory.addImport(UiBinder.class.getName()); composerFactory.addImport(UiBinderLocalized.class.getName()); composerFactory.addImport(UiTemplate.class.getName()); composerFactory.addImport(this.binderType.getQualifiedSourceName()); composerFactory.addImport(this.widgetType.getQualifiedSourceName()); composerFactory.addImport(this.targetType.getQualifiedSourceName()); composerFactory.addImplementedInterface(UiBinderLocalized.class.getSimpleName() + "<" + this.widgetType.getSimpleSourceName() + "," + this.targetType.getSimpleSourceName() + ">"); composerFactory.addImplementedInterface(UiBinder.class.getSimpleName() + "<" + this.widgetType.getSimpleSourceName() + "," + this.targetType.getSimpleSourceName() + ">"); composerFactory.addImplementedInterface(this.binderType.getSimpleSourceName()); return composerFactory.createSourceWriter(ctx, printWriter); }
Example #14
Source File: ProxyViewCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) { ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(this.packageName, this.viewProxySimpleName); composerFactory.setSuperclass(this.placeType.getSimpleSourceName()); composerFactory.addImport(GWT.class.getName()); composerFactory.addImport(RunAsyncCallback.class.getName()); composerFactory.addImport(ViewProxy.class.getName()); composerFactory.addImport(Place.class.getName()); composerFactory.addImport(ViewPlace.class.getName()); composerFactory.addImport(Activity.class.getName()); composerFactory.addImport(ViewActivity.class.getName()); composerFactory.addImport(ApplicationUnreachableException.class.getName()); composerFactory.addImport(this.placeType.getQualifiedSourceName()); composerFactory.addImport(this.activityDescrition.view().getCanonicalName()); if (this.placeTokenizerClass != null) { composerFactory.addImport(this.placeTokenizerClass.getCanonicalName()); } if (this.viewDecoratorClass != null) { composerFactory.addImport(this.viewDecoratorClass.getCanonicalName()); } composerFactory.addImplementedInterface( ViewProxy.class.getSimpleName() + "<" + this.placeType.getSimpleSourceName() + ">"); return composerFactory.createSourceWriter(ctx, printWriter); }
Example #15
Source File: JsonAutoBeanGenerator.java From requestor with Apache License 2.0 | 5 votes |
private void generateMethods(SourceWriter srcWriter) { srcWriter.println("@Override"); srcWriter.println("public List<Serdes<?>> getSerdes() {"); srcWriter.println(" return serdesList;"); srcWriter.println("}"); srcWriter.println(); srcWriter.println("@Override"); srcWriter.println("public List<Provider<?>> getProviders() {"); srcWriter.println(" return providersList;"); srcWriter.println("}"); srcWriter.println(); }
Example #16
Source File: InjectErrorHandlerCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void writePresent(SourceWriter srcWriter) { srcWriter .println("final List<fr.putnami.pwt.core.error.client.ErrorHandler> errorHandlers = Lists.newArrayList();"); for (JMethod handlerMethod : this.presenterMethods) { srcWriter.println("errorHandlers.add(new fr.putnami.pwt.core.error.client.ErrorHandler() {"); srcWriter.indent(); srcWriter.println("@Override public boolean handle(Throwable error) { return %s.this.%s(error); }", this.injectorName, handlerMethod.getName()); srcWriter.println("@Override public int getPriority() { return HIGH_PRIORITY; }"); srcWriter.outdent(); srcWriter.println("});"); } srcWriter.println("for (fr.putnami.pwt.core.error.client.ErrorHandler errorHandler : errorHandlers) {"); srcWriter.indent(); srcWriter.println("ErrorManager.get().registerErrorHandler(errorHandler);"); srcWriter.outdent(); srcWriter.println("}"); srcWriter.println("final HandlerRegistrationCollection errorHandlerRegistrations " + "= new HandlerRegistrationCollection();"); srcWriter.println("errorHandlerRegistrations.add(" + "EventBus.get().addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {"); srcWriter.indent(); srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {"); srcWriter.indent(); srcWriter.println("for (fr.putnami.pwt.core.error.client.ErrorHandler handler : errorHandlers) {"); srcWriter.indent(); srcWriter.println("ErrorManager.get().registerErrorHandler(handler);"); srcWriter.outdent(); srcWriter.println("}"); srcWriter.outdent(); srcWriter.println("errorHandlerRegistrations.removeHandler();"); srcWriter.outdent(); srcWriter.println("}}));"); }
Example #17
Source File: ProxyViewCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void generateTokenPrefixes(TreeLogger logger, SourceWriter srcWriter) { List<String> tokens = Lists.newArrayList(); tokens.add("\"" + this.placeType.getSimpleSourceName().replaceAll("Place$", "") + "\""); for (String alias : this.activityDescrition.aliases()) { tokens.add("\"" + alias + "\""); } srcWriter.println("@Override"); srcWriter.println("public String[] getPlacePrefixes(){"); srcWriter.indent(); srcWriter.println("return new String[]{ %s };", Joiner.on(", ").join(tokens)); srcWriter.outdent(); srcWriter.println("}"); }
Example #18
Source File: ProxyViewCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void generateDelegateTokenizer(TreeLogger logger, SourceWriter srcWriter) { srcWriter.println("@Override"); srcWriter.println("public %s getPlace(String token) {", this.placeType.getSimpleSourceName()); srcWriter.indent(); srcWriter.println("return new %s().getPlace(token);", this.placeTokenizerClass.getSimpleName()); srcWriter.outdent(); srcWriter.println("}"); srcWriter.println("@Override"); srcWriter.println("public String getToken(%s place) {", this.placeType.getSimpleSourceName()); srcWriter.indent(); srcWriter.println("return new %s().getToken(place);", this.placeTokenizerClass.getSimpleName()); srcWriter.outdent(); srcWriter.println("}"); }
Example #19
Source File: ProxyViewCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void generateActivityFactory(TreeLogger logger, SourceWriter srcWriter) { srcWriter.println("@Override"); srcWriter.println("public Activity createActivity(Place place) {"); srcWriter.indent(); srcWriter.println("return new ViewActivity(this, place);"); srcWriter.outdent(); srcWriter.println("}"); }
Example #20
Source File: RestServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void writeMethodCall(SourceWriter srcWriter, JMethod method, JParameter callbackParam) { srcWriter.print("REST.<%s> withCallback(compositeCallback).call(restService).%s(", this.typeAsString(method .getReturnType(), true), method.getName()); int i = 0; for (JParameter parameter : method.getParameters()) { if (!parameter.equals(callbackParam)) { if (i++ > 0) { srcWriter.print(", "); } srcWriter.print("$%d_%s", i, parameter.getName()); } } srcWriter.println(");"); }
Example #21
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void generateServiceImplementation(TreeLogger logger, SourceWriter srcWriter) throws UnableToCompleteException { Set<String> addedMethods = Sets.newHashSet(); for (JMethod method : this.serviceType.getOverridableMethods()) { if (!addedMethods.contains(method.getName())) { addedMethods.add(method.getName()); this.writeStartMethod(srcWriter, method); this.writeCommandDefinition(logger, srcWriter, method, null); this.writeCommandParam(srcWriter, method, this.listCallbackMethods(logger, method), null); this.writeEndMethod(srcWriter, method); } } }
Example #22
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void writeStartMethod(SourceWriter srcWriter, JMethod method) { srcWriter.print("public %s %s(", this.typeAsString(method.getReturnType(), false), method.getName()); int i = 0; for (JParameter parameter : method.getParameters()) { if (i++ > 0) { srcWriter.print(", "); } srcWriter.print("%s $%d_%s", this.typeAsString(parameter.getType(), false), i, parameter.getName()); } srcWriter.println("){"); srcWriter.indent(); }
Example #23
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void writeEndMethod(SourceWriter srcWriter, JMethod method) { srcWriter.println("CommandController.get().invokeCommand(commandDefinition, commandParam);"); if (method.getReturnType().equals(JPrimitiveType.BOOLEAN)) { srcWriter.println("return false;"); } else if (method.getReturnType().equals(JPrimitiveType.BYTE) || method.getReturnType().equals(JPrimitiveType.CHAR) || method.getReturnType().equals(JPrimitiveType.DOUBLE) || method.getReturnType().equals(JPrimitiveType.FLOAT) || method.getReturnType().equals(JPrimitiveType.INT) || method.getReturnType().equals(JPrimitiveType.LONG) || method.getReturnType().equals(JPrimitiveType.SHORT)) { srcWriter.println("return 0;"); } else if (!method.getReturnType().equals(JPrimitiveType.VOID)) { srcWriter.println("return null;"); } srcWriter.outdent(); srcWriter.println("}"); }
Example #24
Source File: InjectThemeCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void writeEntryPoint(SourceWriter srcWriter) { srcWriter.println("Theme theme = new Theme();"); for (String style : this.styles) { srcWriter.println("theme.addLink(new CssLink(\"%s\", 0));", style); } srcWriter.println("ThemeController.get().installTheme(theme);"); }
Example #25
Source File: InjectTemplateCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void writeStatic(SourceWriter srcWriter) { if (this.templateName != null) { srcWriter.println("@UiTemplate(%s)", this.templateName); } srcWriter.println("interface %s extends UiBinderLocalized<Widget, %s> {}", this.templateInterfaceName, this.viewType.getSimpleSourceName()); }
Example #26
Source File: AbstractInjectorCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
protected void writeConstructor(TreeLogger logger, GeneratorContext context, SourceWriter srcWriter) { srcWriter.println("public %s() {", this.proxyName); srcWriter.indent(); for (InjectorWritterConstructor delegate : Iterables.filter(this.delegates, InjectorWritterConstructor.class)) { delegate.writeConstructor(srcWriter); } srcWriter.outdent(); srcWriter.println("}"); }
Example #27
Source File: InjectServiceCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void writeStatic(SourceWriter srcWriter) { if (this.declareProxy) { srcWriter.println("interface %s extends ServiceProxy<%s_Injector, %s>, %s {}", this.proxyTypeName, this.viewType.getSimpleSourceName(), this.serviceName, this.serviceName); } }
Example #28
Source File: AbstractInjectorCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) { ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(this.packageName, this.proxyName); composerFactory.addImport(GWT.class.getName()); composerFactory.addImport(this.injectableType.getQualifiedSourceName()); composerFactory.setSuperclass(this.injectableType.getSimpleSourceName()); for (InjectorWritterInit delegate : Iterables.filter(this.delegates, InjectorWritterInit.class)) { delegate.initComposer(composerFactory); } return composerFactory.createSourceWriter(ctx, printWriter); }
Example #29
Source File: InitializeFormCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void writeConstructor(SourceWriter srcWriter) { String fieldName = this.modelField.getName(); if (this.constantClassName != null) { srcWriter.println( "MessageHelper %sMessageHelper = new MessageHelper((ConstantsWithLookup) GWT.create(%s.class));", fieldName, this.constantClassName.getCanonicalName()); srcWriter.println("%s.setMessageHelper(%sMessageHelper);", fieldName, fieldName); } srcWriter.println("%s.initialize(new %s());", fieldName, this.modelImplClass); }
Example #30
Source File: InjectPresenterCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@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(); srcWriter.println("super.%s((%s) place);", presenterMethod.getName(), placeType.getSimpleSourceName()); srcWriter.outdent(); srcWriter.println("}"); } } }