Package org.apache.tapestry.spec

Examples of org.apache.tapestry.spec.IComponentSpecification


        INamespace namespace = newNamespace("org.foo");

        MockControl crc = newControl(ClassResolver.class);
        ClassResolver cr = (ClassResolver) crc.getMock();

        IComponentSpecification spec = newSpec();

        cr.checkForClass("org.foo.bar.Baz");
        crc.setReturnValue(null);

        cr.checkForClass("bar.Baz");
View Full Code Here


     * Adds bindings based on attributes in the template.
     */

    private void addTemplateBindings(IComponent component, OpenToken token)
    {
        IComponentSpecification spec = component.getSpecification();

        Map attributes = token.getAttributesMap();

        if (attributes != null)
        {
            Iterator i = attributes.entrySet().iterator();

            while (i.hasNext())
            {
                Map.Entry entry = (Map.Entry) i.next();

                String name = (String) entry.getKey();
                String value = (String) entry.getValue();

                String description = ImplMessages.templateParameterName(name);

                // For informal parameters, or formal parameters that don't define a default binding
                // type,
                // treat the value as a literal.

                String defaultBindingType = BindingUtils.getDefaultBindingType(
                        spec,
                        name,
                        BindingConstants.LITERAL_PREFIX);

                IBinding binding = _bindingSource.createBinding(
                        _loadComponent,
                        description,
                        value,
                        defaultBindingType,
                        token.getLocation());

                addBinding(component, spec, name, binding);
            }
        }

        // if the component defines a templateTag parameter and
        // there is no established binding for that parameter,
        // add a static binding carrying the template tag

        if (spec.getParameter(TemplateSource.TEMPLATE_TAG_PARAMETER_NAME) != null
                && component.getBinding(TemplateSource.TEMPLATE_TAG_PARAMETER_NAME) == null)
        {
            IBinding binding = _bindingSource.createBinding(
                    component,
                    TemplateSource.TEMPLATE_TAG_PARAMETER_NAME,
View Full Code Here

        _frameworkNamespace = null;
    }

    protected IComponentSpecification parseSpecification(Resource resource, boolean asPage)
    {
        IComponentSpecification result = null;

        try
        {
            if (asPage)
                result = _parser.parsePageSpecification(resource);
View Full Code Here

     *
     */

    public synchronized IComponentSpecification getComponentSpecification(Resource resourceLocation)
    {
        IComponentSpecification result =
            (IComponentSpecification) _componentCache.get(resourceLocation);

        if (result == null)
        {
            result = parseSpecification(resourceLocation, false);
View Full Code Here

        return result;
    }

    public synchronized IComponentSpecification getPageSpecification(Resource resourceLocation)
    {
        IComponentSpecification result = (IComponentSpecification) _pageCache.get(resourceLocation);

        if (result == null)
        {
            result = parseSpecification(resourceLocation, true);
View Full Code Here

     * Reads the template for the component.
     */

    public ComponentTemplate getTemplate(IRequestCycle cycle, IComponent component)
    {
        IComponentSpecification specification = component.getSpecification();
        Resource resource = specification.getSpecificationLocation();

        Locale locale = component.getPage().getLocale();

        Object key = new MultiKey(new Object[]
        { resource, locale }, false);
View Full Code Here

    {
        INamespace namespace = _component.getNamespace();

        _resolver.resolve(_cycle, namespace, libraryId, type, location);

        IComponentSpecification spec = _resolver.getSpecification();

        return spec.getAllowBody();
    }
View Full Code Here

        return result;
    }

    private IPropertySource createSourceForComponent(IComponent component)
    {
        IComponentSpecification specification = component.getSpecification();

        List sources = new ArrayList();

        sources.add(new PropertyHolderPropertySource(specification));
        sources.add(getSourceForNamespace(component.getNamespace()));
View Full Code Here

    {
        ErrorLog log = (ErrorLog) newMock(ErrorLog.class);
        Location l = fabricateLocation(11);

        MockControl specControl = newControl(IComponentSpecification.class);
        IComponentSpecification spec = (IComponentSpecification) specControl.getMock();

        spec.getLocation();
        specControl.setReturnValue(l);

        log
                .error(
                        "Method 'public abstract void org.apache.tapestry.enhance.TestEnhancedClassValidator$AbstractBase.foo()' (declared in class org.apache.tapestry.enhance.TestEnhancedClassValidator$AbstractBase) has no implementation in class org.apache.tapestry.enhance.TestEnhancedClassValidator$AbstractBase (or enhanced subclass org.apache.tapestry.enhance.TestEnhancedClassValidator$Incomplete).",
View Full Code Here

    }

    private IComponentSpecification newSpec(String propertyName, String persistence)
    {
        MockControl specc = newControl(IComponentSpecification.class);
        IComponentSpecification spec = (IComponentSpecification) specc.getMock();

        MockControl psc = newControl(IPropertySpecification.class);
        IPropertySpecification ps = (IPropertySpecification) psc.getMock();

        spec.getPropertySpecification(propertyName);
        specc.setReturnValue(ps);

        ps.getPersistence();
        psc.setReturnValue(persistence);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.spec.IComponentSpecification

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.