Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.ComponentEventResultProcessor


        }

        // Let subclasses do more.
        configure(config);

        renderSupport.addInit("autocompleter", new JSONArray(id, menuId, link.toAbsoluteURI(), config));
    }
View Full Code Here


        "class", "t-autocomplete-menu");
        writer.end();

        Link link = resources.createEventLink(EVENT_NAME);

        JSONObject config = new JSONObject();
        config.put("paramName", PARAM_NAME);
        config.put("indicator", loaderId);

        if (resources.isBound("minChars"))
            config.put("minChars", minChars);

        if (resources.isBound("frequency"))
            config.put("frequency", frequency);

        if (resources.isBound("tokens"))
        {
            for (int i = 0; i < tokens.length(); i++)
            {
                config.accumulate("tokens", tokens.substring(i, i + 1));
            }
        }

        // Let subclasses do more.
        configure(config);
View Full Code Here

     * not formatted correct.
     */
    JSONObject onParse(@RequestParameter(INPUT_PARAMETER)
    String input)
    {
        JSONObject response = new JSONObject();

        try
        {
            Date date = format.parse(input);

            response.put(RESULT, date.getTime());
        }
        catch (ParseException ex)
        {
            response.put(ERROR, ex.getMessage());
        }

        return response;
    }
View Full Code Here

     * the result.
     */
    JSONObject onFormat(@RequestParameter(INPUT_PARAMETER)
    String input)
    {
        JSONObject response = new JSONObject();

        try
        {
            long millis = Long.parseLong(input);

            Date date = new Date(millis);

            response.put(RESULT, format.format(date));
        }
        catch (NumberFormatException ex)
        {
            response.put(ERROR, ex.getMessage());
        }

        return response;
    }
View Full Code Here

{
    @Test
    public void loopback_request() throws Exception
    {
        RequestPageCache cache = mockRequestPageCache();
        ComponentEventResultProcessor processor = mockComponentEventResultProcessor();
        PageResponseRenderer renderer = mockPageResponseRenderer();
        Page page = mockPage();
        EventContext context = mockEventContext();
        ComponentPageElement root = mockComponentPageElement();
        InternalComponentResources pageResources = mockInternalComponentResources();
View Full Code Here

        Page activePage = cache.get(parameters.getActivePageName());

        final Holder<Boolean> resultProcessorInvoked = Holder.create();
        resultProcessorInvoked.put(false);

        ComponentEventResultProcessor interceptor = new ComponentEventResultProcessor()
        {
            public void processResultValue(Object value) throws IOException
            {
                resultProcessorInvoked.put(true);
View Full Code Here

{
    @Test
    public void loopback_request() throws Exception
    {
        RequestPageCache cache = mockRequestPageCache();
        ComponentEventResultProcessor processor = mockComponentEventResultProcessor();
        PageResponseRenderer renderer = mockPageResponseRenderer();
        Page page = mockPage();
        EventContext context = mockEventContext();
        ComponentPageElement root = mockComponentPageElement();
        InternalComponentResources pageResources = mockInternalComponentResources();
View Full Code Here

    public void result_is_root_component() throws Exception
    {
        Component result = mockComponent();
        ComponentResources resources = mockComponentResources();
        Logger logger = mockLogger();
        ComponentEventResultProcessor primary = mockComponentEventResultProcessor();

        train_getComponentResources(result, resources);
        train_getContainer(resources, null);

        train_getPageName(resources, PAGE_NAME);

        primary.processResultValue(PAGE_NAME);

        replay();

        ComponentEventResultProcessor<Component> processor = new ComponentInstanceResultProcessor(logger,
                primary);
View Full Code Here

    {
        Component value = mockComponent();
        Component containerResources = mockComponent();
        ComponentResources valueResources = mockComponentResources();
        Logger logger = mockLogger();
        ComponentEventResultProcessor primary = mockComponentEventResultProcessor();

        train_getComponentResources(value, valueResources);

        train_getContainer(valueResources, containerResources);

        train_getCompleteId(valueResources, PAGE_NAME + ":child");

        logger
                .warn("Component Zoop:child was returned from an event handler method, but is not a page component. The page containing the component will render the client response.");

        train_getPageName(valueResources, PAGE_NAME);

        primary.processResultValue(PAGE_NAME);

        replay();

        ComponentEventResultProcessor<Component> processor = new ComponentInstanceResultProcessor(logger, primary);
View Full Code Here

        ComponentResources resources = mockComponentResources();
        Component component = mockComponent();
        Component pageComponent = mockComponent();

        ComponentPageElement element = mockComponentPageElement();
        ComponentEventResultProcessor master = mockComponentEventResultProcessor();

        train_getComponentResources(component, resources);
        train_getPage(resources, pageComponent);
        train_getPageName(resources, pageName);
        train_get(cache, pageName, page);
        train_getNestedId(resources, nestedId);
        train_getComponentElementByNestedId(page, nestedId, element);

        master.processResultValue(element);

        replay();

        ComponentEventResultProcessor<Component> processor = new AjaxComponentInstanceEventResultProcessor(
                cache, master);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.ComponentEventResultProcessor

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.