com.google.gwt.uibinder.client.UiTemplate Java Examples

The following examples show how to use com.google.gwt.uibinder.client.UiTemplate. 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: UiBinderLocalizedCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
public UiBinderLocalizedCreator(JClassType binderType, GwtLocale locale) {
	this.binderType = binderType;
	this.locale = locale;

	for (JClassType interfaceType : binderType.getImplementedInterfaces()) {
		if (interfaceType.getQualifiedSourceName().equals(UiBinderLocalized.class.getCanonicalName())
			&& interfaceType instanceof JParameterizedType) {
			JParameterizedType paramType = (JParameterizedType) interfaceType;
			this.widgetType = paramType.getTypeArgs()[0];
			this.targetType = paramType.getTypeArgs()[1];
		}
	}
	UiTemplate templateAnnotation = binderType.getAnnotation(UiTemplate.class);
	if (templateAnnotation != null) {
		this.templateName = templateAnnotation.value().replace(UiBinderLocalizedCreator.TEMPLATE_SUFFIX, "");
	}
	if (this.templateName == null) {
		this.templateName = this.targetType.getSimpleSourceName();
	}
}
 
Example #2
Source File: UiBinderLocalizedCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #3
Source File: InjectTemplateCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void initComposer(ClassSourceFileComposerFactory composerFactory) {
	composerFactory.addImport(GWT.class.getName());
	composerFactory.addImport(UiBinderLocalized.class.getName());
	composerFactory.addImport(Widget.class.getName());
	composerFactory.addImport(UiTemplate.class.getName());
}