use of org.apache.tapestry5.internal.renderers.AvailableValuesRenderer in project tapestry-5 by apache.
the class TapestryModule method contributeObjectRenderer.
/**
* Contributes a default object renderer for type Object, plus specialized
* renderers for {@link org.apache.tapestry5.http.services.Request}, {@link org.apache.tapestry5.commons.Location},
* {@link org.apache.tapestry5.ComponentResources}, {@link org.apache.tapestry5.EventContext},
* {@link AvailableValues},
* List, and Object[].
*/
@SuppressWarnings("unchecked")
public void contributeObjectRenderer(MappedConfiguration<Class, ObjectRenderer> configuration, @InjectService("LocationRenderer") ObjectRenderer locationRenderer, final TypeCoercer typeCoercer) {
configuration.add(Object.class, new DefaultObjectRenderer());
configuration.addInstance(Request.class, RequestRenderer.class);
configuration.add(Location.class, locationRenderer);
ObjectRenderer preformatted = new ObjectRenderer<Object>() {
public void render(Object object, MarkupWriter writer) {
writer.element("pre");
writer.write(typeCoercer.coerce(object, String.class));
writer.end();
}
};
configuration.addInstance(List.class, ListRenderer.class);
configuration.addInstance(Object[].class, ObjectArrayRenderer.class);
configuration.addInstance(ComponentResources.class, ComponentResourcesRenderer.class);
configuration.addInstance(EventContext.class, EventContextRenderer.class);
configuration.add(AvailableValues.class, new AvailableValuesRenderer());
}
Aggregations