Package org.apache.tapestry5.internal.structure

Examples of org.apache.tapestry5.internal.structure.ComponentPageElement


        tracker.run(description, new Runnable()
        {
            public void run()
            {
                ComponentPageElement container = pageAssembly.activeElement.peek();

                try
                {

                    pageAssembly.componentName.push(embeddedName);

                    ComponentPageElement newElement = container.newChild(embeddedId, embeddedName.nestedId,
                            embeddedName.completeId, elementName, instantiator, location);

                    pageAssembly.page.addLifecycleListener(newElement);

                    pushNewElement(pageAssembly, newElement);
View Full Code Here


        if (embeddedBinder != null) { return new ParameterBinder()
        {
            public void bind(ComponentPageElement element, Binding binding)
            {
                ComponentPageElement subelement = element.getEmbeddedElement(embeddedId);

                embeddedBinder.bind(subelement, binding);
            }

            public String getDefaultBindingPrefix(String metaDefault)
            {
                return embeddedBinder.getDefaultBindingPrefix(metaDefault);
            }
        }; }

        final ParameterBinder innerBinder = embededdedComponentAssembler.createParameterBinder(parameterName);

        if (innerBinder == null)
        {
            String message = PageloadMessages.publishedParameterNonexistant(parameterName, instantiator.getModel()
                    .getComponentClassName(), embeddedId);

            throw new TapestryException(message, embededdedComponentAssembler.getLocation(), null);
        }
        // The simple case, publishing a parameter of a subcomponent as if it were a parameter
        // of this component.

        return new ParameterBinder()
        {
            public void bind(ComponentPageElement element, Binding binding)
            {
                ComponentPageElement subelement = element.getEmbeddedElement(embeddedId);

                innerBinder.bind(subelement, binding);
            }

            public String getDefaultBindingPrefix(String metaDefault)
View Full Code Here

    @Test
    public void nested_element_within_page()
    {
        RequestPageCache cache = mockRequestPageCache();
        Page page = mockPage();
        ComponentPageElement element = mockComponentPageElement();
        Component component = mockComponent();
        ComponentClassResolver resolver = mockComponentClassResolver();

        train_get(cache, PAGE_NAME, page);
View Full Code Here

        RequestPageCache cache = mockRequestPageCache();
        ComponentEventResultProcessor processor = mockComponentEventResultProcessor();
        PageResponseRenderer renderer = mockPageResponseRenderer();
        Page page = mockPage();
        EventContext context = mockEventContext();
        ComponentPageElement root = mockComponentPageElement();
        InternalComponentResources pageResources = mockInternalComponentResources();
        PageActivator activator = newMock(PageActivator.class);

        train_get(cache, "foo/Bar", page);
View Full Code Here

    void checkForRecursion(String componentClassName, Location location)
    {
        for (Object o : activeElement.getSnapshot())
        {
            ComponentPageElement e = (ComponentPageElement) o;

            if (e.getComponentResources().getComponentModel().getComponentClassName().equals(componentClassName))
            {
                throw new TapestryException(
                        PageloadMessages.recursiveTemplate(componentClassName),
                        location,
                        null);
View Full Code Here

        request.setAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME, contentType);

        Page containerPage = cache.get(parameters.getContainingPageName());

        ComponentPageElement element = containerPage.getComponentElementByNestedId(parameters.getNestedComponentId());

        // In many cases, the triggered element is a Form that needs to be able to
        // pass its event handler return values to the correct result processor.
        // This is certainly the case for forms.

        TrackableComponentEventCallback callback = new ComponentResultProcessorWrapper(interceptor);

        environment.push(ComponentEventResultProcessor.class, interceptor);
        environment.push(TrackableComponentEventCallback.class, callback);

        boolean handled = element
                .triggerContextEvent(parameters.getEventType(), parameters.getEventContext(), callback);

        if (!handled)
            throw new TapestryException(ServicesMessages.eventNotHandled(element, parameters.getEventType()), element,
                    null);
View Full Code Here

        {
            mixinId = nestedId.substring(dollarx + 1);
            nestedId = nestedId.substring(0, dollarx);
        }

        ComponentPageElement element = page.getComponentElementByNestedId(nestedId);

        if (mixinId == null)
            return element.getComponent();

        ComponentResources resources = element.getMixinResources(mixinId);

        return resources.getComponent();
    }
View Full Code Here

        TrackableComponentEventCallback callback = new ComponentResultProcessorWrapper(resultProcessor);

        environment.push(ComponentEventResultProcessor.class, resultProcessor);
        environment.push(TrackableComponentEventCallback.class, callback);

        ComponentPageElement element = containerPage.getComponentElementByNestedId(parameters.getNestedComponentId());

        boolean handled = element
                .triggerContextEvent(parameters.getEventType(), parameters.getEventContext(), callback);

        if (!handled)
            throw new TapestryException(ServicesMessages.eventNotHandled(element, parameters.getEventType()), element,
                    null);
View Full Code Here

    void checkForRecursion(String componentClassName, Location location)
    {
        for (Object o : activeElement.getSnapshot())
        {
            ComponentPageElement e = (ComponentPageElement) o;

            if (e.getComponentResources().getComponentModel().getComponentClassName().equals(componentClassName))
            {
                String message = String.format(
                        "The template for component %s is recursive (contains another direct or indirect reference to component %<s). This is not supported (components may not contain themselves).",
                        componentClassName);
View Full Code Here

        // Get or create a page instance and trigger the event.

        Page page = requestPageCache.get(pageName);

        ComponentPageElement element = page.getRootElement();

        final Holder<Object[]> holder = Holder.create();

        ComponentEventCallback callback = new ComponentEventCallback()
        {
            public boolean handleResult(Object result)
            {
                holder.put(typeCoercer.coerce(result, Object[].class));

                // We've got the value, stop the event.

                return true;
            }
        };

        element.triggerEvent(EventConstants.PASSIVATE, null, callback);

        if (!holder.hasValue()) return EMPTY;

        return holder.get();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.internal.structure.ComponentPageElement

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.