Package org.apache.tapestry5

Examples of org.apache.tapestry5.EventContext


    @Test
    public void component_id_matches_are_case_insensitive()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, false);

        train_getCount(context, 0);
View Full Code Here


    @Test
    public void coerce_context()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        ComponentPageElementResources resources = mockComponentPageElementResources();
        EventContext context = mockEventContext();
        Integer value = new Integer(27);
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, false);
View Full Code Here

    @Test
    public void coerce_when_not_enough_context()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, true);
        logger.debug(eq(TapestryMarkers.EVENT_HANDLER_METHOD), isA(String.class));
View Full Code Here

    @Test
    public void unable_to_coerce()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        ComponentPageElementResources resources = mockComponentPageElementResources();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, true);
        logger.debug(eq(TapestryMarkers.EVENT_HANDLER_METHOD), isA(String.class));

        train_toClass(resources, Integer.class.getName(), Integer.class);

        train_getCount(context, 1);

        expect(context.get(Integer.class, 0)).andThrow(new NumberFormatException("Not so easy, is it?"));

        replay();

        ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, resources, logger);
View Full Code Here

        train_canonicalizePageName(resolver, pageName, pageName);

        train_collectPageActivationContext(collector, pageName, 3);

        EventContext pageActivationContext = new ArrayEventContext(typeCoercer, 3);
        PageRenderRequestParameters parameters = new PageRenderRequestParameters(pageName, pageActivationContext, false);

        expect(linkEncoder.createPageRenderLink(parameters)).andReturn(link);

        replay();
View Full Code Here

        train_getName(activePage, "order/View");
        train_getName(primaryPage, primaryPageName);

        train_collectPageActivationContext(collector, "order/View", "x", "y");

        EventContext pageActivationContext = new ArrayEventContext(typeCoercer, "x", "y");
        EventContext eventContext = new ArrayEventContext(typeCoercer, 3, 5, 9);

        ComponentEventRequestParameters parameters = new ComponentEventRequestParameters("order/View", primaryPageName,
                "gnip.gnop", "myevent", pageActivationContext, eventContext);

        expect(linkEncoder.createComponentEventLink(parameters, true)).andReturn(link);
View Full Code Here

    private boolean process(String pageName, String pageActivationContext) throws IOException
    {
        if (!componentClassResolver.isPageName(pageName)) return false;

        EventContext activationContext = contextPathEncoder.decodePath(pageActivationContext);

        PageRenderRequestParameters parameters = new PageRenderRequestParameters(pageName, activationContext);

        componentRequestHandler.handlePageRender(parameters);
View Full Code Here

        if (localizationSetter.setLocaleFromLocaleName(possibleLocaleName))
            activePageName = activePageName.substring(slashx + 1);

        if (!componentClassResolver.isPageName(activePageName)) return false;

        EventContext eventContext = contextPathEncoder.decodePath(matcher.group(CONTEXT));

        EventContext activationContext = contextPathEncoder.decodePath(
                request.getParameter(InternalConstants.PAGE_CONTEXT_NAME));

        // The event type is often omitted, and defaults to "action".

        if (eventType == null) eventType = EventConstants.ACTION;
View Full Code Here

        appendContext(parameters.getEventContext(), builder);

        Link result = new LinkImpl(builder.toString(), baseURL == null, forForm, response, optimizer);

        EventContext pageActivationContext = parameters.getPageActivationContext();

        if (pageActivationContext.getCount() != 0)
        {
            // Reuse the builder           
            builder.setLength(0);
            appendContext(pageActivationContext, builder);
View Full Code Here

        final Class<?> pageClass = value.getPageClass();
        final Object[] activationContext = value.getPageActivationContext();

        final String pageName = this.resolver.resolvePageClassNameToPageName(pageClass.getName());

        final EventContext context = activationContext == null ? new EmptyEventContext() : new ArrayEventContext(
                this.typeCoercer, activationContext);

        this.handler.handle(new PageRenderRequestParameters(pageName, context, false));
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.EventContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.