Package org.apache.tapestry.internal.services

Examples of org.apache.tapestry.internal.services.ComponentResultProcessorWrapper


        heartbeat.begin();

        try
        {
            ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(_eventResultProcessor);

            _resources.triggerEvent(PREPARE_FOR_SUBMIT, context, callback);

            if (callback.isAborted()) return true;

            _resources.triggerEvent(PREPARE, context, callback);

            if (callback.isAborted()) return true;

            // TODO: Ajax stuff will eventually mean there are multiple values for this parameter
            // name

            String actionsBase64 = _request.getParameter(FORM_DATA);

            ObjectInputStream ois = null;

            Component component = null;

            try
            {
                ois = new Base64ObjectInputStream(actionsBase64);

                while (true)
                {
                    String componentId = ois.readUTF();
                    ComponentAction action = (ComponentAction) ois.readObject();

                    component = _source.getComponent(componentId);

                    action.execute(component);

                    component = null;
                }
            }
            catch (EOFException ex)
            {
                // Expected
            }
            catch (Exception ex)
            {
                Location location = component == null ? null : component.getComponentResources().getLocation();

                throw new TapestryException(ex.getMessage(), location, ex);
            }
            finally
            {
                TapestryInternalUtils.close(ois);
            }

            heartbeat.end();

            ValidationTracker tracker = _environment.peek(ValidationTracker.class);

            // Let the listeners peform any final validations

            // Update through the parameter because the tracker has almost certainly changed
            // internal state.

            _tracker = tracker;

            _resources.triggerEvent(VALIDATE_FORM, context, callback);

            if (callback.isAborted()) return true;

            _formSupport.executeDeferred();

            // Let the listeners know about overall success or failure. Most listeners fall into
            // one of those two camps.

            // If the tracker has no errors, then clear it of any input values
            // as well, so that the next page render will be "clean" and show
            // true persistent data, not value from the previous form submission.

            if (!_tracker.getHasErrors()) _tracker.clear();

            _resources.triggerEvent(tracker.getHasErrors() ? FAILURE : SUCCESS, context, callback);

            // Lastly, tell anyone whose interested that the form is completely submitted.

            if (callback.isAborted()) return true;

            _resources.triggerEvent(SUBMIT, context, callback);

            return callback.isAborted();
        }
        finally
        {
            _environment.pop(Heartbeat.class);
            _environment.pop(FormSupport.class);
View Full Code Here


        heartbeat.begin();

        try
        {

            ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(
                    _componentEventResultProcessor);

            _resources.triggerContextEvent(PREPARE_FOR_SUBMIT, context, callback);

            if (callback.isAborted()) return true;

            _resources.triggerContextEvent(PREPARE, context, callback);

            if (callback.isAborted()) return true;

            executeStoredActions();

            heartbeat.end();

            ValidationTracker tracker = _environment.peek(ValidationTracker.class);

            // Let the listeners peform any final validations

            // Update through the parameter because the tracker has almost certainly changed
            // internal state.

            _tracker = tracker;

            _resources.triggerContextEvent(VALIDATE_FORM, context, callback);

            if (callback.isAborted()) return true;

            _formSupport.executeDeferred();

            // Let the listeners know about overall success or failure. Most listeners fall into
            // one of those two camps.

            // If the tracker has no errors, then clear it of any input values
            // as well, so that the next page render will be "clean" and show
            // true persistent data, not value from the previous form submission.

            if (!_tracker.getHasErrors()) _tracker.clear();

            _resources.triggerContextEvent(tracker.getHasErrors() ? FAILURE : SUCCESS, context, callback);

            // Lastly, tell anyone whose interested that the form is completely submitted.

            if (callback.isAborted()) return true;

            _resources.triggerContextEvent(SUBMIT, context, callback);

            return callback.isAborted();
        }
        finally
        {
            _environment.pop(Heartbeat.class);
            _environment.pop(FormSupport.class);
View Full Code Here

     * event notification is what will ultimately render (typically, its a Block).  However, we do a <em>lot</em> of
     * tricks to provide the desired FormSupport around the what renders.
     */
    Object onInject(EventContext context) throws IOException
    {
        ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(
                _componentEventResultProcessor);

        _resources.triggerContextEvent(TapestryConstants.ACTION_EVENT, context, callback);

        if (!callback.isAborted()) return null;

        // Here's where it gets very, very tricky.

        final RenderCommand rootRenderCommand = _pageRenderQueue.getRootRenderCommand();

View Full Code Here

        heartbeat.begin();

        try
        {
            ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(_eventResultProcessor);

            _resources.triggerEvent(PREPARE_FOR_SUBMIT, context, callback);

            if (callback.isAborted()) return true;

            _resources.triggerEvent(PREPARE, context, callback);

            if (callback.isAborted()) return true;

            // TODO: Ajax stuff will eventually mean there are multiple values for this parameter
            // name

            String actionsBase64 = _request.getParameter(FORM_DATA);

            ObjectInputStream ois = null;

            Component component = null;

            try
            {
                ois = new Base64ObjectInputStream(actionsBase64);

                while (true)
                {
                    String componentId = ois.readUTF();
                    ComponentAction action = (ComponentAction) ois.readObject();

                    component = _source.getComponent(componentId);

                    action.execute(component);

                    component = null;
                }
            }
            catch (EOFException ex)
            {
                // Expected
            }
            catch (Exception ex)
            {
                Location location = component == null ? null : component.getComponentResources().getLocation();

                throw new TapestryException(ex.getMessage(), location, ex);
            }
            finally
            {
                TapestryInternalUtils.close(ois);
            }

            heartbeat.end();

            ValidationTracker tracker = _environment.peek(ValidationTracker.class);

            // Let the listeners peform any final validations

            // Update through the parameter because the tracker has almost certainly changed
            // internal state.

            _tracker = tracker;

            _resources.triggerEvent(VALIDATE, context, callback);

            if (callback.isAborted()) return true;

            _formSupport.executeDeferred();

            // Let the listeners know about overall success or failure. Most listeners fall into
            // one of those two camps.

            // If the tracker has no errors, then clear it of any input values
            // as well, so that the next page render will be "clean" and show
            // true persistent data, not value from the previous form submission.

            if (!_tracker.getHasErrors()) _tracker.clear();

            _resources.triggerEvent(tracker.getHasErrors() ? FAILURE : SUCCESS, context, callback);

            // Lastly, tell anyone whose interested that the form is completely submitted.

            if (callback.isAborted()) return true;

            _resources.triggerEvent(SUBMIT, context, callback);

            return callback.isAborted();
        }
        finally
        {
            _environment.pop(Heartbeat.class);
            _environment.pop(FormSupport.class);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.internal.services.ComponentResultProcessorWrapper

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.