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();
        ComponentModel model = mockComponentModel();

        train_isDebugEnabled(logger, false);
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();

        ComponentModel model = mockComponentModel();
View Full Code Here

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

        ComponentModel model = mockComponentModel();

        train_isDebugEnabled(logger, true);
View Full Code Here

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

        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, false, model, logger);
View Full Code Here

        final String pageName = pageClass == null
                ? requestGlobals.getActivePageName()
                : resolver.resolvePageClassNameToPageName(pageClass.getName());

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

        if (value.isBypassActivation())
        {
View Full Code Here

    }

    @Test
    public void array_event_context_to_strings()
    {
        EventContext ec = new ArrayEventContext(typeCoercer, 1, 2.3);

        assertEquals(ec.toStrings(), new String[]
        { "1", "2.3" });
    }
View Full Code Here

    }

    @Test
    public void to_string_of_event_context() {

        EventContext ec = new ArrayEventContext(typeCoercer, 1, 2.3);

        assertEquals(ec.toString(), "<EventContext: 1, 2.3>");
    }
View Full Code Here

        appendContext(true, 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(true, pageActivationContext, builder);
View Full Code Here

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

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

        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

    private PageRenderRequestParameters checkIfPage(String pageName, String pageActivationContext)
    {
        if (!componentClassResolver.isPageName(pageName)) return null;

        EventContext activationContext = contextPathEncoder.decodePath(pageActivationContext);

        return new PageRenderRequestParameters(pageName, activationContext);
    }
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.