Package org.apache.tapestry5

Examples of org.apache.tapestry5.ComponentResources


    @Test
    public void unknown_property()
    {
        TargetBean bean = new TargetBean();
        ComponentResources resources = mockComponentResources();
        Location l = mockLocation();

        train_getComponent(resources, bean);

        replay();
View Full Code Here


    @Test(dataProvider = "values")
    public void special_prop_binding_values(String expression, Object expected)
    {
        Location l = mockLocation();
        String description = "my description";
        ComponentResources resources = mockComponentResources();
        Component component = mockComponent();

        train_getComponent(resources, component);
        train_getCompleteId(resources, "Does.not.matter");
View Full Code Here

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

                return convertPathsToAssetArray(baseResource, resources.getLocale(), expandedPaths);
            }
        });
    }
View Full Code Here

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

                try
                {
                    return createConduit(resources, fieldTypeName, fieldName, possibleNames);
                } catch (Exception ex)
                {
                    throw new TapestryException(String.format(
                            "Failure binding parameter field '%s' of mixin %s (type %s): %s", fieldName, resources
                            .getCompleteId(), resources.getComponentModel().getComponentClassName(),
                            InternalUtils.toMessage(ex)), ex);
                }
            }

        };
View Full Code Here

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

                    return new InjectedComponentFieldValueConduit(resources, fieldName, type, componentId);
                }
            };
View Full Code Here

{
    abstract static class ResourceProvider<T> implements ComputedValue<T>
    {
        public T get(InstanceContext context)
        {
            ComponentResources resources = context.get(ComponentResources.class);

            return get(resources);
        }
View Full Code Here

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

                return new ReadOnlyComponentFieldConduit(resources, fieldName)
                {
                    public Object get(Object instance, InstanceContext context)
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

        context.add(new PageAssemblyAction()
        {
            public void execute(PageAssembly pageAssembly)
            {
                ComponentResources resources = pageAssembly.activeElement.peek().getComponentResources();

                RenderCommand command = elementFactory.newExpansionElement(resources, token);

                pageAssembly.addRenderCommand(command);
            }
View Full Code Here

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

                return new ReadOnlyComponentFieldConduit(resources, fieldName)
                {
                    public Object get(Object instance, InstanceContext context)
                    {
                        Component container = resources.getContainer();

                        if (!fieldType.isInstance(container))
                        {
                            String message = String.format(
                                    "Component %s (type %s) is not assignable to field %s.%s (of type %s).", container
                                    .getComponentResources().getCompleteId(), container.getClass().getName(), resources.getComponentModel()
                                    .getComponentClassName(), fieldName, fieldTypeName);

                            throw new RuntimeException(message);
                        }
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.