Package org.apache.tapestry5.model

Examples of org.apache.tapestry5.model.ComponentModel


    @Test
    public void invalidation() throws Exception
    {
        File rootDir = createClasspathRoot();
        URLClassLoader loader = newLoaderWithClasspathRoot(rootDir);
        ComponentModel model = mockComponentModel();

        File packageDir = new File(rootDir, "baz");
        packageDir.mkdirs();

        File f = new File(packageDir, "Biff.tml");
View Full Code Here


    public void localization_to_same()
    {
        Resource resource = mockResource();
        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        ComponentResourceLocator locator = newMock(ComponentResourceLocator.class);

        train_getComponentClassName(model, PACKAGE + ".Fred");

        expect(locator.locateTemplate(model, english)).andReturn(resource).once();
View Full Code Here

    @Test
    public void no_template_found()
    {
        TemplateParser parser = mockTemplateParser();
        ComponentModel model = mockComponentModel();
        Resource baseResource = mockResource();
        Resource missingResource = mockResource();

        train_getComponentClassName(model, PACKAGE + ".Barney");
View Full Code Here

    @Test
    public void child_component_inherits_parent_template()
    {
        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        ComponentModel parentModel = mockComponentModel();
        Resource resource = mockResource();
        ComponentResourceLocator locator = mockLocator(model, english, null);

        train_getComponentClassName(model, "foo.Bar");
View Full Code Here

        return parser.parseTemplate(r);
    }

    private Resource locateTemplateResource(ComponentModel initialModel, Locale locale)
    {
        ComponentModel model = initialModel;
        while (model != null)
        {

            Resource baseResource = baseResourceForModel(model);
            Resource localized = baseResource.forLocale(locale);

            // In a race condition, we may hit this method a couple of times, and overwrite previous
            // results with identical new results.

            // If found a properly localized version of the base resource for the model,
            // then we've found a match (even if we had to ascend a couple of levels
            // to reach it).

            if (localized != null) return localized;

            // Not on the classpath, the the locator see if its a) a page and b) a resource inside
            // the context

            localized = locator.findPageTemplateResource(model, locale);

            if (localized != null) return localized;

            // Otherwise, this component doesn't have its own template ... lets work up to its
            // base class and check there.

            model = model.getParentModel();
        }

        // This will be a Resource whose URL is null, which will be picked up later and force the
        // return of the empty template.
View Full Code Here

    @Test
    public void declared_parameter_names_does_not_include_superclass_parameters()
    {
        Resource r = mockResource();
        Logger logger = mockLogger();
        ComponentModel parent = mockComponentModel();

        train_getPersistentFieldNames(parent);
        train_getParameterNames(parent, "betty");

        expect(parent.getParameterModel("fred")).andReturn(null);
        expect(parent.getParameterModel("wilma")).andReturn(null);
        expect(parent.getParameterModel("barney")).andReturn(null);

        replay();

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, parent, false);
View Full Code Here

    {
        Resource r = mockResource();
        Logger logger = mockLogger();

        replay();
        ComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);

        assertTrue(model.getMixinClassNames().isEmpty());

        verify();
    }
View Full Code Here

        template.add(element);
    }

    private void addUnboundParameterNames(String prefix, List<String> unbound, InternalComponentResources resource)
    {
        ComponentModel model = resource.getComponentModel();

        for (String name : model.getParameterNames())
        {
            if (resource.isBound(name))
                continue;

            ParameterModel parameterModel = model.getParameterModel(name);

            if (parameterModel.isRequired())
            {
                String fullName = prefix == null ? name : prefix + "." + name;
View Full Code Here

                        // Force the creation of the class (and the transformation of the class). This will first
                        // trigger transformations of any base classes.

                        final ClassInstantiator<Component> plasticInstantiator = manager.getClassInstantiator(className);

                        final ComponentModel model = classToModel.get(className);

                        return new Instantiator()
                        {
                            public Component newInstance(InternalComponentResources resources)
                            {
View Full Code Here

                        String className = plasticClass.getClassName();
                        String parentClassName = plasticClass.getSuperClassName();

                        // The parent model may not exist, if the super class is not in a controlled package.

                        ComponentModel parentModel = classToModel.get(parentClassName);

                        final boolean isRoot = parentModel == null;

                        if (isRoot
                                && !(parentClassName.equals("java.lang.Object") || parentClassName
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.model.ComponentModel

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.