Examples of EmbeddedComponentModel


Examples of org.apache.tapestry5.model.EmbeddedComponentModel

        PageElementFactory elementFactory = mockPageElementFactory();
        ComponentPageElement rootElement = mockComponentPageElement();
        InternalComponentResources resources = mockInternalComponentResources();
        ComponentModel model = mockComponentModel();
        ComponentTemplate template = mockComponentTemplate();
        EmbeddedComponentModel emodel = mockEmbeddedComponentModel();
        Location l = mockLocation();
        ComponentClassResolver resolver = mockComponentClassResolver();

        Map<String, Location> componentIds = CollectionFactory.newMap();
View Full Code Here

Examples of org.apache.tapestry5.model.EmbeddedComponentModel

        // This may be null for an anonymous component.
        String embeddedId = token.getId();

        String embeddedComponentClassName = null;

        final EmbeddedComponentModel embeddedModel = embeddedId == null ? null : assembler.getModel()
                .getEmbeddedComponentModel(embeddedId);

        if (embeddedId == null)
            embeddedId = assembler.generateEmbeddedId(embeddedType);

        if (embeddedModel != null)
        {
            String modelType = embeddedModel.getComponentType();

            if (InternalUtils.isNonBlank(modelType) && embeddedType != null)
            {
                throw new TapestryException(
                        String.format("Embedded component '%s' provides a type attribute in the template ('%s') " +
                                "as well as in the component class ('%s'). You should not provide a type attribute " +
                                "in the template when defining an embedded component within the component class.", embeddedId, embeddedType, modelType), token, null);
            }

            embeddedType = modelType;
            embeddedComponentClassName = embeddedModel.getComponentClassName();
        }

        String componentClassName = embeddedComponentClassName;

        // This awkwardness is making me think that the page loader should resolve the component
        // type before invoking this method (we would then remove the componentType parameter).

        if (InternalUtils.isNonBlank(embeddedType))
        {
            // The type actually overrides the specified class name. The class name is defined
            // by the type of the field. In many scenarios, the field type is a common
            // interface,
            // and the type is used to determine the concrete class to instantiate.

            try
            {
                componentClassName = componentClassResolver.resolveComponentTypeToClassName(embeddedType);
            } catch (RuntimeException ex)
            {
                throw new TapestryException(ex.getMessage(), token, ex);
            }
        }

        // OK, now we can record an action to get it instantiated.

        EmbeddedComponentAssembler embeddedAssembler = assembler.createEmbeddedAssembler(embeddedId,
                componentClassName, embeddedModel, token.getMixins(), token.getLocation());

        addActionForEmbeddedComponent(context, embeddedAssembler, embeddedId, elementName, componentClassName);

        addParameterBindingActions(context, embeddedAssembler, embeddedModel);

        if (embeddedModel != null && embeddedModel.getInheritInformalParameters())
        {
            // Another two-step: The first "captures" the container and embedded component. The second
            // occurs at the end of the page setup.

            assembler.add(new PageAssemblyAction()
View Full Code Here

Examples of org.apache.tapestry5.model.EmbeddedComponentModel

     */
    private boolean isPublishedParameter(ComponentModel model, String parameterName)
    {
        for (String embeddedComponentId : model.getEmbeddedComponentIds())
        {
            EmbeddedComponentModel embeddedComponentModel = model
                    .getEmbeddedComponentModel(embeddedComponentId);
            if (embeddedComponentModel.getPublishedParameters().contains(parameterName)) return true;
        }

        return false;
    }
View Full Code Here

Examples of org.apache.tapestry5.model.EmbeddedComponentModel

    private List<String> getPublishedParameters(ComponentModel model)
    {
        List<String> publishedParameters = CollectionFactory.newList();
        for (String embeddedComponentId : model.getEmbeddedComponentIds())
        {
            EmbeddedComponentModel embeddedComponentModel = model.getEmbeddedComponentModel(embeddedComponentId);
            publishedParameters.addAll(embeddedComponentModel.getPublishedParameters());
        }
        return publishedParameters;
    }
View Full Code Here

Examples of org.apache.tapestry5.model.EmbeddedComponentModel

            ComponentModel containerComponentModel = resources.getComponentModel();

            for (String embeddedComponentId : containerComponentModel.getEmbeddedComponentIds())
            {
                EmbeddedComponentModel embeddedComponentModel = containerComponentModel
                        .getEmbeddedComponentModel(embeddedComponentId);

                InternalComponentResources embeddedComponentResources = (InternalComponentResources) resources
                        .getEmbeddedComponent(embeddedComponentId).getComponentResources();
                /**
                 * If the parameter is not a formal parameter, then the parameter must be a published parameter
                 * of an embeddedComponent of the component we are currently examining.
                 */
                if (embeddedComponentModel.getPublishedParameters().contains(publishedParameterName)
                        && embeddedComponentResources.getComponentModel().isFormalParameter(publishedParameterName))
                {
                    return embeddedComponentResources;
                }

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.