Package org.apache.tapestry5

Examples of org.apache.tapestry5.ComponentResources


    {
        return new ComputedValue<FieldConduit<Object>>()
        {
            public FieldConduit<Object> get(InstanceContext context)
            {
                final ComponentResources resources = context.get(ComponentResources.class);

                return new ReadOnlyComponentFieldConduit(resources, fieldName)
                {
                    public Object get(Object instance, InstanceContext context)
                    {
                        return resources.getEmbeddedComponent(id);
                    }
                };
            }
        };
    }
View Full Code Here


    @Test
    public void no_anchor()
    {
        Link link = mockLink();
        ComponentResources resources = mockComponentResources();
        MarkupWriter writer = new MarkupWriterImpl();

        train_toURI(link, LINK_URI);
        //note that we aren't trying to test the parameters code here, so we only worry about the single, simplest branch.
        //The parameters code is fully tested in CoreBehaviorsTests.
        expect(resources.isBound("parameters")).andReturn(false);

        resources.renderInformalParameters(writer);

        replay();

        linkFixture.inject(null, resources);
View Full Code Here

    @Test
    public void with_anchor()
    {
        Link link = mockLink();
        ComponentResources resources = mockComponentResources();
        MarkupWriter writer = new MarkupWriterImpl();

        train_toURI(link, LINK_URI);

        //see note in no_anchor.
        expect(resources.isBound("parameters")).andReturn(false);

        resources.renderInformalParameters(writer);

        replay();

        linkFixture.inject("wilma", resources);
View Full Code Here

        this.outputCharset = outputCharset;
    }

    public ContentType findContentType(Page page)
    {
        ComponentResources pageResources = page.getRootComponent().getComponentResources();

        String contentTypeString = metaDataLocator.findMeta(MetaDataConstants.RESPONSE_CONTENT_TYPE, pageResources,
                String.class);

        // Draconian but necessary: overwrite the content type they selected with the application-wide output charset.
View Full Code Here

    {
        assetsField.injectComputed(new ComputedValue<Asset[]>()
        {
            public Asset[] get(InstanceContext context)
            {
                ComponentResources resources = context.get(ComponentResources.class);

                return convertPathsToAssetArray(resources, expandedPaths, libraryName);
            }
        });
    }
View Full Code Here

        ComputedValue<Asset> computedAsset = new ComputedValue<Asset>()
        {
            public Asset get(InstanceContext context)
            {
                ComponentResources resources = context.get(ComponentResources.class);

                // Note how this works: the resources represents the actual instantiated class, and the libraryName
                // comes from the componentModel, potentially, the componentModel of a base class (which may have
                // a different library name than the subclass).
                return assetSource.getComponentAsset(resources, assetPath, libraryName);
View Full Code Here

            this.validators = validators;
        }

        public void advise(MethodInvocation invocation)
        {
            ComponentResources resources = invocation.getInstanceContext().get(ComponentResources.class);

            for (ComponentIdValidator validator : validators)
            {
                validator.validate(resources);
            }
View Full Code Here

    }

    @Test
    public void command_failed()
    {
        ComponentResources foo = mockInternalComponentResources();
        ComponentResources bar = mockInternalComponentResources();
        ComponentResources baz = mockInternalComponentResources();

        final RuntimeException t = new RuntimeException("Oops.");

        RenderCommand rc = new RenderCommand()
        {
View Full Code Here

public class BeanEditorTest extends TapestryTestCase
{
    @Test
    public void object_created_as_needed()
    {
        ComponentResources resources = mockComponentResources();
        BeanModelSource source = mockBeanModelSource();
        BeanModel model = mockBeanModel();
        RegistrationData data = new RegistrationData();
        Messages messages = mockMessages();
        PropertyOverrides overrides = mockPropertyOverrides();
View Full Code Here


    @Test
    public void object_can_not_be_instantiated()
    {
        ComponentResources resources = mockComponentResources();
        BeanModelSource source = mockBeanModelSource();
        BeanModel model = mockBeanModel();
        Location l = mockLocation();
        Throwable exception = new RuntimeException("Fall down go boom.");
        PropertyOverrides overrides = mockPropertyOverrides();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ComponentResources

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.