Package org.apache.tapestry.internal

Examples of org.apache.tapestry.internal.InternalComponentResources


    }

    @Test
    public void inject_field() throws Exception
    {
        InternalComponentResources resources = newInternalComponentResources();

        Log log = newLog();

        replay();
View Full Code Here


     * field read/field write substitions.
     */
    @Test
    public void override_field_read_and_write() throws Exception
    {
        InternalComponentResources resources = newInternalComponentResources();

        Log log = newLog();

        replay();

View Full Code Here

        return createComponent(classname);
    }

    private Component createComponent(String classname)
    {
        InternalComponentResources resources = newInternalComponentResources();

        replay();

        // Can't wait for the HiveMind code base to start using some generics for this kind of
        // thing.
View Full Code Here

        int dotx = parameterName.lastIndexOf('.');

        if (dotx > 0)
        {
            String mixinName = parameterName.substring(0, dotx);
            InternalComponentResources mixinResources = InternalUtils.get(
                    _mixinsByShortName,
                    mixinName);

            if (mixinResources == null)
                throw new TapestryException(StructureMessages.missingMixinForParameter(
                        _completeId,
                        mixinName,
                        parameterName), binding, null);

            String simpleName = parameterName.substring(dotx + 1);

            mixinResources.bindParameter(simpleName, binding);
            return;
        }

        InternalComponentResources informalParameterResources = null;

        // Does it match a formal parameter name of the core component? That takes precedence

        if (_coreResources.getComponentModel().getParameterModel(parameterName) != null)
        {
            _coreResources.bindParameter(parameterName, binding);
            return;
        }

        for (String mixinName : InternalUtils.sortedKeys(_mixinsByShortName))
        {
            InternalComponentResources resources = _mixinsByShortName.get(mixinName);
            if (resources.getComponentModel().getParameterModel(parameterName) != null)
            {
                resources.bindParameter(parameterName, binding);
                return;
            }

            if (informalParameterResources == null
                    && resources.getComponentModel().getSupportsInformalParameters())
                informalParameterResources = resources;
        }

        // An informal parameter
View Full Code Here

        int dotx = parameterName.lastIndexOf('.');

        if (dotx > 0)
        {
            String mixinName = parameterName.substring(0, dotx);
            InternalComponentResources mixinResources = InternalUtils.get(
                    _mixinsByShortName,
                    mixinName);

            if (mixinResources == null)
                throw new TapestryException(StructureMessages.missingMixinForParameter(
                        _completeId,
                        mixinName,
                        parameterName), null, null);

            String simpleName = parameterName.substring(dotx + 1);

            ParameterModel pm = mixinResources.getComponentModel().getParameterModel(simpleName);

            return pm != null ? pm.getDefaultBindingPrefix() : null;
        }

        // A formal parameter of the core component?

        ParameterModel pm = _coreResources.getComponentModel().getParameterModel(parameterName);

        if (pm != null)
            return pm.getDefaultBindingPrefix();

        // Search for mixin that it is a formal parameter of

        for (String mixinName : InternalUtils.sortedKeys(_mixinsByShortName))
        {
            InternalComponentResources resources = _mixinsByShortName.get(mixinName);

            pm = resources.getComponentModel().getParameterModel(parameterName);

            if (pm != null)
                return pm.getDefaultBindingPrefix();
        }
View Full Code Here

        int dotx = parameterName.lastIndexOf('.');

        if (dotx > 0)
        {
            String mixinName = parameterName.substring(0, dotx);
            InternalComponentResources mixinResources = InternalUtils.get(
                    _mixinsByShortName,
                    mixinName);

            if (mixinResources == null)
                throw new TapestryException(StructureMessages.missingMixinForParameter(
                        _completeId,
                        mixinName,
                        parameterName), binding, null);

            String simpleName = parameterName.substring(dotx + 1);

            mixinResources.bindParameter(simpleName, binding);
            return;
        }

        InternalComponentResources informalParameterResources = null;

        // Does it match a formal parameter name of the core component? That takes precedence

        if (_coreResources.getComponentModel().getParameterModel(parameterName) != null)
        {
            _coreResources.bindParameter(parameterName, binding);
            return;
        }

        for (String mixinName : InternalUtils.sortedKeys(_mixinsByShortName))
        {
            InternalComponentResources resources = _mixinsByShortName.get(mixinName);
            if (resources.getComponentModel().getParameterModel(parameterName) != null)
            {
                resources.bindParameter(parameterName, binding);
                return;
            }

            if (informalParameterResources == null
                    && resources.getComponentModel().getSupportsInformalParameters())
                informalParameterResources = resources;
        }

        // An informal parameter
View Full Code Here

        int dotx = parameterName.lastIndexOf('.');

        if (dotx > 0)
        {
            String mixinName = parameterName.substring(0, dotx);
            InternalComponentResources mixinResources = InternalUtils.get(
                    _mixinsByShortName,
                    mixinName);

            if (mixinResources == null)
                throw new TapestryException(StructureMessages.missingMixinForParameter(
                        _completeId,
                        mixinName,
                        parameterName), null, null);

            String simpleName = parameterName.substring(dotx + 1);

            ParameterModel pm = mixinResources.getComponentModel().getParameterModel(simpleName);

            return pm != null ? pm.getDefaultBindingPrefix() : null;
        }

        // A formal parameter of the core component?

        ParameterModel pm = _coreResources.getComponentModel().getParameterModel(parameterName);

        if (pm != null) return pm.getDefaultBindingPrefix();

        // Search for mixin that it is a formal parameter of

        for (String mixinName : InternalUtils.sortedKeys(_mixinsByShortName))
        {
            InternalComponentResources resources = _mixinsByShortName.get(mixinName);

            pm = resources.getComponentModel().getParameterModel(parameterName);

            if (pm != null) return pm.getDefaultBindingPrefix();
        }

        // Not a formal parameter of the core component or any mixin.
View Full Code Here

    }

    @Test
    public void add_injected_field() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        CtClass targetObjectCtClass = findCtClass(TargetObject.class);

        Logger logger = mockLogger();
View Full Code Here

    @Test
    public void add_injected_field_from_parent_transformation() throws Exception
    {
        final String value = "from the parent";

        InternalComponentResources resources = mockInternalComponentResources();

        CtClass targetObjectCtClass = findCtClass(TargetObject.class);

        Logger logger = mockLogger();
View Full Code Here

    }

    @Test
    public void add_interface_to_class() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        CtClass targetObjectCtClass = findCtClass(TargetObject.class);

        Logger logger = mockLogger();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.internal.InternalComponentResources

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.