Examples of ComponentActionSink


Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

    void beginRender(MarkupWriter writer)
    {
        Link link = resources.createFormEventLink(EventConstants.ACTION, context);

        actionSink = new ComponentActionSink(logger, clientDataEncoder);

        clientId = javascriptSupport.allocateClientId(resources);

        // Pre-register some names, to prevent client-side collisions with function names
        // attached to the JS Form object.
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

    }

    void beginRender(MarkupWriter writer)
    {

        actionSink = new ComponentActionSink(logger);

        name = renderSupport.allocateClientId(resources);

        formSupport = new FormSupportImpl(name, actionSink, clientBehaviorSupport, clientValidation);
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

        if (InternalUtils.isBlank(formId))
            throw new RuntimeException(String.format(
                    "Query parameter '%s' was blank, but should have been specified in the request.",
                    FORMID_PARAMETER));

        final ComponentActionSink actionSink = new ComponentActionSink(logger);

        PartialMarkupRendererFilter filter = new PartialMarkupRendererFilter()
        {
            public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
            {
                hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);

                // Kind of ugly, but the only way to ensure we don't have name collisions on the
                // client side is to force a unique id into each name (as well as each id, but that's
                // RenderSupport's job).  It would be nice if we could agree on the uid, but
                // not essential.

                String uid = Long.toHexString(System.currentTimeMillis());

                IdAllocator idAllocator = new IdAllocator(":" + uid);

                clientId = renderSupport.allocateClientId(resources);

                reply.put("elementId", clientId);

                FormSupportImpl formSupport = new FormSupportImpl(formId, actionSink, clientBehaviorSupport, true,
                                                                  idAllocator);

                environment.push(FormSupport.class, formSupport);
                environment.push(ValidationTracker.class, new ValidationTrackerImpl());

                renderer.renderMarkup(writer, reply);

                formSupport.executeDeferred();

                environment.pop(ValidationTracker.class);
                environment.pop(FormSupport.class);

                hiddenFieldPositioner.getElement().attributes(
                        "type", "hidden",

                        "name", Form.FORM_DATA,

                        "value", actionSink.toBase64());
            }
        };

        pageRenderQueue.addPartialMarkupRendererFilter(filter);
    }
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

    {
        Link link = resources.createFormEventLink(EventConstants.ACTION, context);

        String actionURL = secure && secureEnabled ? link.toAbsoluteURI(true) : link.toURI();

        actionSink = new ComponentActionSink(logger, clientDataEncoder);

        clientId = javascriptSupport.allocateClientId(resources);

        // Pre-register some names, to prevent client-side collisions with function names
        // attached to the JS Form object.
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

    void beginRender(MarkupWriter writer)
    {
        Link link = resources.createFormEventLink(EventConstants.ACTION, context);

        actionSink = new ComponentActionSink(logger);

        name = renderSupport.allocateClientId(resources);

        formSupport = createRenderTimeFormSupport(name, actionSink, new IdAllocator());
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

        String formComponentId = request.getParameter(FORM_COMPONENTID_PARAMETER);

        final Form form = (Form) componentSource.getComponent(formComponentId);

        final ComponentActionSink actionSink = new ComponentActionSink(logger);

        PartialMarkupRendererFilter filter = new PartialMarkupRendererFilter()
        {
            public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
            {
                hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);

                // Kind of ugly, but the only way to ensure we don't have name collisions on the
                // client side is to force a unique id into each name (as well as each id, but that's
                // RenderSupport's job).  It would be nice if we could agree on the uid, but
                // not essential.

                String uid = Long.toHexString(System.currentTimeMillis());

                IdAllocator idAllocator = new IdAllocator(":" + uid);

                clientId = renderSupport.allocateClientId(resources);

                reply.put("elementId", clientId);

                InternalFormSupport formSupport =
                        form.createRenderTimeFormSupport(formClientId, actionSink, idAllocator);

                environment.push(FormSupport.class, formSupport);
                environment.push(ValidationTracker.class, new ValidationTrackerImpl());

                heartbeat.begin();

                renderer.renderMarkup(writer, reply);

                formSupport.executeDeferred();

                heartbeat.end();

                environment.pop(ValidationTracker.class);
                environment.pop(FormSupport.class);

                hiddenFieldPositioner.getElement().attributes(
                        "type", "hidden",

                        "name", Form.FORM_DATA,

                        "value", actionSink.toBase64());
            }
        };

        pageRenderQueue.addPartialMarkupRendererFilter(filter);
    }
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

        if (!visible)
            element.addClassName(CSSClassConstants.INVISIBLE);

        clientBehaviorSupport.addFormFragment(clientId, alwaysSubmit, show, hide, visibleBound);

        componentActions = new ComponentActionSink(logger, clientDataEncoder);

        // Here's the magic of environmentals ... we can create a wrapper around
        // the normal FormSupport environmental that intercepts some of the behavior.
        // Here we're setting aside all the actions inside the FormFragment so that we
        // can control whether those actions occur when the form is submitted.
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

        if (insideForm)
        {
            hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);

            actionSink = new ComponentActionSink(logger, clientDataEncoder);

            environment.push(FormSupport.class, new FormSupportAdapter(existingFormSupport)
            {
                @Override
                public <T> void store(T component, ComponentAction<T> action)
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

            e.attribute("data-zone-parameters",
                    parameters.toString(compactJSON));

            hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);

            actionSink = new ComponentActionSink(logger, clientDataEncoder);

            environment.push(FormSupport.class, new FormSupportAdapter(formSupport)
            {
                @Override
                public <T> void store(T component, ComponentAction<T> action)
View Full Code Here

Examples of org.apache.tapestry5.corelib.internal.ComponentActionSink

    {
        Link link = resources.createFormEventLink(EventConstants.ACTION, context);

        String actionURL = secure && secureEnabled ? link.toAbsoluteURI(true) : link.toURI();

        actionSink = new ComponentActionSink(logger, clientDataEncoder);

        clientId = javascriptSupport.allocateClientId(resources);

        // Pre-register some names, to prevent client-side collisions with function names
        // attached to the JS Form object.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.