Search in sources :

Example 16 with Contribute

use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.

the class ClojureModule method defaultMappers.

@Contribute(MethodToFunctionSymbolMapper.class)
public static void defaultMappers(OrderedConfiguration<MethodToFunctionSymbolMapper> configuration) {
    configuration.add("Annotation", new AnnotationMapper());
    configuration.add("Default", new DefaultMapper(), "after:*");
}
Also used : DefaultMapper(org.apache.tapestry5.internal.clojure.DefaultMapper) AnnotationMapper(org.apache.tapestry5.internal.clojure.AnnotationMapper) Contribute(org.apache.tapestry5.ioc.annotations.Contribute)

Example 17 with Contribute

use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.

the class TapestryModule method setupCoreFrameworkValidators.

/**
 * Contributes the basic set of validators:
 * <ul>
 * <li>required</li>
 * <li>minlength</li>
 * <li>maxlength</li>
 * <li>min</li>
 * <li>max</li>
 * <li>regexp</li>
 * <li>email</li>
 * <li>none</li>
 * </ul>
 */
@Contribute(FieldValidatorSource.class)
public static void setupCoreFrameworkValidators(MappedConfiguration<String, Validator> configuration) {
    configuration.addInstance("required", Required.class);
    configuration.addInstance("minlength", MinLength.class);
    configuration.addInstance("maxlength", MaxLength.class);
    configuration.addInstance("min", Min.class);
    configuration.addInstance("max", Max.class);
    configuration.addInstance("regexp", Regexp.class);
    configuration.addInstance("email", Email.class);
    configuration.addInstance("checked", Checked.class);
    configuration.addInstance("unchecked", Unchecked.class);
    configuration.add("none", new None());
}
Also used : None(org.apache.tapestry5.validator.None) Contribute(org.apache.tapestry5.ioc.annotations.Contribute)

Example 18 with Contribute

use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.

the class TapestryModule method provideCoreAndAppLibraries.

@Contribute(ComponentClassResolver.class)
public static void provideCoreAndAppLibraries(Configuration<LibraryMapping> configuration, @Symbol(TapestryHttpInternalConstants.TAPESTRY_APP_PACKAGE_PARAM) String appRootPackage) {
    configuration.add(new LibraryMapping(InternalConstants.CORE_LIBRARY, "org.apache.tapestry5.corelib"));
    configuration.add(new LibraryMapping("", appRootPackage));
}
Also used : LibraryMapping(org.apache.tapestry5.services.LibraryMapping) Contribute(org.apache.tapestry5.ioc.annotations.Contribute)

Example 19 with Contribute

use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.

the class JavaScriptModule method exposeJavaScriptSupportForFullPageRenders.

/**
 * Adds page render filters, each of which provides an {@link org.apache.tapestry5.annotations.Environmental}
 * service. Filters
 * often provide {@link org.apache.tapestry5.annotations.Environmental} services needed by
 * components as they render.
 * <dl>
 * <dt>JavascriptSupport</dt>
 * <dd>Provides {@link JavaScriptSupport}</dd>
 * </dl>
 */
@Contribute(MarkupRenderer.class)
public void exposeJavaScriptSupportForFullPageRenders(OrderedConfiguration<MarkupRendererFilter> configuration, final JavaScriptStackSource javascriptStackSource, final JavaScriptStackPathConstructor javascriptStackPathConstructor, final Request request) {
    final BooleanHook suppressCoreStylesheetsHook = createSuppressCoreStylesheetHook(request);
    MarkupRendererFilter javaScriptSupport = new MarkupRendererFilter() {

        public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) {
            DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
            JavaScriptSupportImpl support = new JavaScriptSupportImpl(linker, javascriptStackSource, javascriptStackPathConstructor, suppressCoreStylesheetsHook);
            environment.push(JavaScriptSupport.class, support);
            renderer.renderMarkup(writer);
            environment.pop(JavaScriptSupport.class);
            support.commit();
        }
    };
    configuration.add("JavaScriptSupport", javaScriptSupport, "after:DocumentLinker");
}
Also used : MarkupRenderer(org.apache.tapestry5.services.MarkupRenderer) PartialMarkupRenderer(org.apache.tapestry5.services.PartialMarkupRenderer) PartialMarkupRendererFilter(org.apache.tapestry5.services.PartialMarkupRendererFilter) MarkupRendererFilter(org.apache.tapestry5.services.MarkupRendererFilter) DocumentLinker(org.apache.tapestry5.internal.services.DocumentLinker) MarkupWriter(org.apache.tapestry5.MarkupWriter) JavaScriptSupportImpl(org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl) BooleanHook(org.apache.tapestry5.BooleanHook) Contribute(org.apache.tapestry5.ioc.annotations.Contribute)

Example 20 with Contribute

use of org.apache.tapestry5.ioc.annotations.Contribute in project tapestry-5 by apache.

the class JavaScriptModule method exposeJavaScriptSupportForPartialPageRender.

/**
 * Contributes {@link PartialMarkupRendererFilter}s used when rendering a
 * partial Ajax response.
 * <dl>
 * <dt>JavaScriptSupport
 * <dd>Provides {@link JavaScriptSupport}</dd>
 * </dl>
 */
@Contribute(PartialMarkupRenderer.class)
public void exposeJavaScriptSupportForPartialPageRender(OrderedConfiguration<PartialMarkupRendererFilter> configuration, final JavaScriptStackSource javascriptStackSource, final JavaScriptStackPathConstructor javascriptStackPathConstructor, final Request request) {
    final BooleanHook suppressCoreStylesheetsHook = createSuppressCoreStylesheetHook(request);
    PartialMarkupRendererFilter javascriptSupport = new PartialMarkupRendererFilter() {

        public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) {
            IdAllocator idAllocator;
            if (request.getParameter(InternalConstants.SUPPRESS_NAMESPACED_IDS) == null) {
                String uid = Long.toHexString(System.nanoTime());
                String namespace = "_" + uid;
                idAllocator = new IdAllocator(namespace);
            } else {
                // When suppressed, work just like normal rendering.
                idAllocator = new IdAllocator();
            }
            DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
            JavaScriptSupportImpl support = new JavaScriptSupportImpl(linker, javascriptStackSource, javascriptStackPathConstructor, idAllocator, true, suppressCoreStylesheetsHook);
            environment.push(JavaScriptSupport.class, support);
            renderer.renderMarkup(writer, reply);
            environment.pop(JavaScriptSupport.class);
            support.commit();
        }
    };
    configuration.add("JavaScriptSupport", javascriptSupport, "after:DocumentLinker");
}
Also used : IdAllocator(org.apache.tapestry5.ioc.util.IdAllocator) PartialMarkupRendererFilter(org.apache.tapestry5.services.PartialMarkupRendererFilter) JSONObject(org.apache.tapestry5.json.JSONObject) DocumentLinker(org.apache.tapestry5.internal.services.DocumentLinker) PartialMarkupRenderer(org.apache.tapestry5.services.PartialMarkupRenderer) MarkupWriter(org.apache.tapestry5.MarkupWriter) JavaScriptSupportImpl(org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl) BooleanHook(org.apache.tapestry5.BooleanHook) Contribute(org.apache.tapestry5.ioc.annotations.Contribute)

Aggregations

Contribute (org.apache.tapestry5.ioc.annotations.Contribute)28 Primary (org.apache.tapestry5.ioc.annotations.Primary)4 PersistenceUnitConfigurer (org.apache.tapestry5.jpa.PersistenceUnitConfigurer)4 TapestryPersistenceUnitInfo (org.apache.tapestry5.jpa.TapestryPersistenceUnitInfo)4 EntityManagerFactory (javax.persistence.EntityManagerFactory)2 Metamodel (javax.persistence.metamodel.Metamodel)2 PersistenceUnitInfo (javax.persistence.spi.PersistenceUnitInfo)2 ServletContext (javax.servlet.ServletContext)2 BooleanHook (org.apache.tapestry5.BooleanHook)2 MarkupWriter (org.apache.tapestry5.MarkupWriter)2 Resource (org.apache.tapestry5.commons.Resource)2 DocumentLinker (org.apache.tapestry5.internal.services.DocumentLinker)2 JavaScriptSupportImpl (org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl)2 MessageCatalogResource (org.apache.tapestry5.internal.util.MessageCatalogResource)2 JSONObject (org.apache.tapestry5.json.JSONObject)2 PartialMarkupRenderer (org.apache.tapestry5.services.PartialMarkupRenderer)2 PartialMarkupRendererFilter (org.apache.tapestry5.services.PartialMarkupRendererFilter)2 ConfigurableWebApplicationContext (org.springframework.web.context.ConfigurableWebApplicationContext)2 AutoDisableAfterSubmit (com.flowlogix.web.mixins.AutoDisableAfterSubmit)1 AutoZoneColorHighlight (com.flowlogix.web.mixins.AutoZoneColorHighlight)1