Examples of EmbeddedComponentModel


Examples of org.apache.tapestry.model.EmbeddedComponentModel

        return result;
    }

    public EmbeddedComponentModel getEmbeddedComponentModel(String componentId)
    {
        EmbeddedComponentModel result = InternalUtils.get(_embeddedComponents, componentId);

        if (result == null && _parentModel != null)
            result = _parentModel.getEmbeddedComponentModel(componentId);

        return result;
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        // We know that if embeddedId is null, embeddedType is not.

        if (embeddedId == null) embeddedId = generateEmbeddedId(embeddedType, _idAllocator);

        EmbeddedComponentModel embeddedModel = _loadingComponentModel
                .getEmbeddedComponentModel(embeddedId);

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

            if (isNonBlank(modelType) && embeddedType != null)
            {
                Logger log = _loadingComponentModel.getLogger();
                log.error(ServicesMessages.compTypeConflict(embeddedId, embeddedType, modelType));
            }

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

        if (isBlank(embeddedType) && isBlank(embeddedComponentClassName))
            throw new TapestryException(ServicesMessages.noTypeForEmbeddedComponent(
                    embeddedId,
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        InternalComponentResources resources = mockInternalComponentResources();
        ComponentModel model = mockComponentModel();
        ComponentModel childModel = mockComponentModel();
        ComponentTemplate template = mockComponentTemplate();
        Logger logger = mockLogger();
        EmbeddedComponentModel emodel = mockEmbeddedComponentModel();
        ComponentPageElement childElement = mockComponentPageElement();
        InternalComponentResources childResources = mockInternalComponentResources();
        Location l = mockLocation();
        PageElement body = mockPageElement();
        ComponentTemplate childTemplate = mockComponentTemplate();
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        // We know that if embeddedId is null, embeddedType is not.

        if (embeddedId == null) embeddedId = generateEmbeddedId(embeddedType, _idAllocator);

        EmbeddedComponentModel embeddedModel = _loadingComponentModel
                .getEmbeddedComponentModel(embeddedId);

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

            if (isNonBlank(modelType) && embeddedType != null)
            {
                Logger log = _loadingComponentModel.getLogger();
                log.error(ServicesMessages.compTypeConflict(embeddedId, embeddedType, modelType));
            }

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

        if (isBlank(embeddedType) && isBlank(embeddedComponentClassName)) throw new TapestryException(
                ServicesMessages.noTypeForEmbeddedComponent(embeddedId, _loadingComponentModel.getComponentClassName()),
                token, null);
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        // We know that if embeddedId is null, embeddedType is not.

        if (embeddedId == null)
            embeddedId = generateEmbeddedId(embeddedType, _idAllocator);

        EmbeddedComponentModel embeddedModel = _loadingComponentModel
                .getEmbeddedComponentModel(embeddedId);

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

            if (isNonBlank(modelType) && embeddedType != null)
            {
                Log log = _loadingComponentModel.getLog();
                log.error(ServicesMessages.compTypeConflict(embeddedId, embeddedType, modelType));
            }

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

        if (isBlank(embeddedType) && isBlank(embeddedComponentClassName))
        {
            // non-null means its invisible instrumentation; the Any component
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        return result;
    }

    public EmbeddedComponentModel getEmbeddedComponentModel(String componentId)
    {
        EmbeddedComponentModel result = InternalUtils.get(_embeddedComponents, componentId);

        if (result == null && _parentModel != null)
            result = _parentModel.getEmbeddedComponentModel(componentId);

        return result;
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        // We know that if embeddedId is null, embeddedType is not.

        if (embeddedId == null) embeddedId = generateEmbeddedId(embeddedType, _idAllocator);

        final EmbeddedComponentModel embeddedModel = _loadingComponentModel
                .getEmbeddedComponentModel(embeddedId);

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

            if (isNonBlank(modelType) && embeddedType != null)
            {
                Logger log = _loadingComponentModel.getLogger();
                log.error(ServicesMessages.compTypeConflict(embeddedId, embeddedType, modelType));
            }

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

        if (isBlank(embeddedType) && isBlank(embeddedComponentClassName)) throw new TapestryException(
                ServicesMessages.noTypeForEmbeddedComponent(embeddedId, _loadingComponentModel.getComponentClassName()),
                token, null);

        final ComponentPageElement newComponent = _pageElementFactory.newComponentElement(_page, _loadingElement,
                                                                                          embeddedId, embeddedType,
                                                                                          embeddedComponentClassName,
                                                                                          elementName,
                                                                                          token.getLocation());

        addMixinsToComponent(newComponent, embeddedModel, token.getMixins());

        final Map<String, Binding> newComponentBindings = newMap();
        _componentIdToBindingMap.put(newComponent.getCompleteId(), newComponentBindings);

        if (embeddedModel != null)
            bindParametersFromModel(embeddedModel, _loadingElement, newComponent, newComponentBindings);

        addToBody(newComponent);

        // Remember to load the template for this new component
        _componentQueue.push(newComponent);

        // Any attribute tokens that immediately follow should be
        // used to bind parameters.

        _addAttributesAsComponentBindings = true;

        // Any attributes (including component parameters) that come up belong on this component.

        _activeElementStack.push(newComponent);

        // Set things up so that content inside the component is added to the component's body.

        _bodyPageElementStack.push(newComponent);

        // And clean that up when the end element is reached.


        final ComponentModel newComponentModel = newComponent.getComponentResources().getComponentModel();

        // If the component was from an embedded @Component annotation, and it is inheritting informal parameters,
        // and the component in question supports informal parameters, than get those inheritted informal parameters ...
        // but later (this helps ensure that <t:parameter> elements that may provide informal parameters are
        // visible when the informal parameters are copied to the child component).

        if (embeddedModel != null && embeddedModel.getInheritInformalParameters() && newComponentModel.getSupportsInformalParameters())
        {
            final ComponentPageElement loadingElement = _loadingElement;

            Runnable finalizer = new Runnable()
            {
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        return result;
    }

    public EmbeddedComponentModel getEmbeddedComponentModel(String componentId)
    {
        EmbeddedComponentModel result = InternalUtils.get(_embeddedComponents, componentId);

        if (result == null && _parentModel != null)
            result = _parentModel.getEmbeddedComponentModel(componentId);

        return result;
View Full Code Here

Examples of org.apache.tapestry.model.EmbeddedComponentModel

        // We know that if embeddedId is null, embeddedType is not.

        if (embeddedId == null) embeddedId = generateEmbeddedId(embeddedType, _idAllocator);

        EmbeddedComponentModel embeddedModel = _loadingComponentModel
                .getEmbeddedComponentModel(embeddedId);

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

            if (isNonBlank(modelType) && embeddedType != null)
            {
                Log log = _loadingComponentModel.getLog();
                log.error(ServicesMessages.compTypeConflict(embeddedId, embeddedType, modelType));
            }

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

        if (isBlank(embeddedType) && isBlank(embeddedComponentClassName))
            throw new TapestryException(ServicesMessages.noTypeForEmbeddedComponent(
                    embeddedId,
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)
            {
                String message = 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
                );

                throw new TapestryException(message, 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 (IllegalArgumentException 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
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.