Package org.apache.tapestry

Examples of org.apache.tapestry.INamespace


        source.setComponentResourceResolver(new ComponentResourceResolverImpl());

        IComponentSpecification spec = newSpec(MOCK1);
        spec.setLocation(_locationFixture);

        INamespace namespace = new Namespace(null, null, newLibrarySpec(), null);

        IPage page = newPage(spec, source, new Locale("fr"));
        page.setNamespace(namespace);

        assertEquals("multilocale_fr", source.getMessages(page).getMessage("multilocale"));
View Full Code Here


@Test
public class TestNamespaceClassSearchComponentClassProvider extends BaseComponentTestCase
{
    private INamespace newNamespace(String key, String prefixes)
    {
        INamespace namespace = newMock(INamespace.class);

        expect(namespace.getPropertyValue(key)).andReturn(prefixes);

        return namespace;
    }
View Full Code Here

        return finder;
    }

    public void testFound()
    {
        INamespace namespace = newNamespace("zip", "org.apache.tapestry.pageload");
        ClassFinder finder = newClassFinder(
                "org.apache.tapestry.pageload",
                "bar.Baz",
                PageLoaderTest.class);
View Full Code Here

        verify();
    }

    public void testNotFound()
    {
        INamespace namespace = newNamespace("zap", "org.foo");
        ClassFinder finder = newClassFinder("org.foo", "bar.Baz", null);

        IComponentSpecification spec = newSpec();

        replay();
View Full Code Here

        IComponentSpecification spec = newSpec(location);

        IPage page = newPage(spec, locale);

        INamespace namespace = new Namespace(null, null, newLibrarySpec(), null, null);

        page.setNamespace(namespace);

        return source.getMessages(page);
    }
View Full Code Here

    }

    private INamespace newNamespace(String id)
    {
        MockControl control = newControl(INamespace.class);
        INamespace ns = (INamespace) control.getMock();

        ns.getId();
        control.setReturnValue(id);

        return ns;
    }
View Full Code Here

        verifyControls();
    }

    public void testNotApplicationNamespace()
    {
        INamespace ns = newNamespace("library");
        IPage page = newPage(ns, null);
        IRequestCycle cycle = newRequestCycle(page, "/");
        IMarkupWriter writer = newWriter("http://foo.com/context/");

        run(writer, cycle);
View Full Code Here

            firstId = id.substring(0, index);
            nextIds = id.substring(index + 1);
        }

        // Get the first namespace
        INamespace result = (INamespace) _children.get(firstId);

        if (result == null)
        {
            result = createNamespace(firstId);

            _children.put(firstId, result);
        }

        // If the id is a dot separated sequence, recurse to find
        // the needed namespace
        if (result != null && nextIds != null)
            result = result.getChildNamespace(nextIds);

        return result;
    }
View Full Code Here

        ILocation location)
    {
        reset();
        _type = type;

        INamespace namespace = null;

        if (libraryId != null)
            namespace = containerNamespace.getChildNamespace(libraryId);
        else
            namespace = containerNamespace;

        setNamespace(namespace);

        if (namespace.containsComponentType(type))
            setSpecification(namespace.getComponentSpecification(type));
        else
            searchForComponent(cycle);

        // If not found after search, check to see if it's in
        // the framework instead.

        if (getSpecification() == null)
        {

            throw new ApplicationRuntimeException(
                Tapestry.format(
                    "Namespace.no-such-component-type",
                    type,
                    namespace.getNamespaceId()),
                location,
                null);

        }
View Full Code Here

        establishDefaultParameters();
    }

    private void searchForComponent(IRequestCycle cycle)
    {
        INamespace namespace = getNamespace();

        if (LOG.isDebugEnabled())
            LOG.debug("Resolving unknown component '" + _type + "' in " + namespace);

        String expectedName = _type + ".jwc";
        IResourceLocation namespaceLocation = namespace.getSpecificationLocation();

        // Look for appropriate file in same folder as the library (or application)
        // specificaiton.

        if (found(namespaceLocation.getRelativeLocation(expectedName)))
            return;

        if (namespace.isApplicationNamespace())
        {

            // The application namespace gets some extra searching.

            if (found(getWebInfAppLocation().getRelativeLocation(expectedName)))
                return;

            if (found(getWebInfLocation().getRelativeLocation(expectedName)))
                return;

            if (found(getApplicationRootLocation().getRelativeLocation(expectedName)))
                return;
        }

        // Not in the library or app spec; does it match a component
        // provided by the Framework?

        INamespace framework = getSpecificationSource().getFrameworkNamespace();

        if (framework.containsComponentType(_type))
        {
            setSpecification(framework.getComponentSpecification(_type));
            return;
        }

        IComponentSpecification specification =
            getDelegate().findComponentSpecification(cycle, namespace, _type);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.INamespace

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.