Package org.apache.tapestry5

Examples of org.apache.tapestry5.Binding


    {
        if (value == null) return;

        if (value instanceof Binding)
        {
            Binding binding = (Binding) value;

            resources.bindParameter(parameterName, binding);
            return;
        }
View Full Code Here


            if (endx < 0) throw new TapestryException(ServicesMessages
                    .unclosedAttributeExpression(expression), location, null);

            String expansion = expression.substring(expansionx + 2, endx);

            final Binding binding = bindingSource.newBinding("attribute expansion", resources, resources,
                                                             BindingConstants.PROP, expansion, location);

            final StringProvider provider = new StringProvider()
            {
                public String provideString()
                {
                    try
                    {
                        Object raw = binding.get();

                        return typeCoercer.coerce(raw, String.class);
                    }
                    catch (Exception ex)
                    {
View Full Code Here

        };
    }

    public RenderCommand newExpansionElement(ComponentResources componentResources, ExpansionToken token)
    {
        Binding binding = bindingSource.newBinding("expansion", componentResources, componentResources,
                                                   BindingConstants.PROP, token.getExpression(), token.getLocation());

        return new ExpansionPageElement(binding, typeCoercer);
    }
View Full Code Here

        // Meta default of literal for the template.

        String defaultBindingPrefix = determineDefaultBindingPrefix(component, name,
                                                                    BindingConstants.LITERAL);

        Binding binding = findBinding(loadingElement, component, name, token.getValue(), defaultBindingPrefix,
                                      token.getLocation());

        if (binding != null)
        {
            component.bindParameter(name, binding);
View Full Code Here

            String value = model.getParameterValue(name);

            String defaultBindingPrefix = determineDefaultBindingPrefix(newComponent, name,
                                                                        BindingConstants.PROP);

            Binding binding = findBinding(loadingComponent, newComponent, name, value, defaultBindingPrefix,
                                          newComponent.getLocation());

            if (binding != null)
            {
                newComponent.bindParameter(name, binding);
View Full Code Here

            Map<String, Binding> loadingComponentBindingMap = componentIdToBindingMap
                    .get(loadingComponent.getCompleteId());

            // This may return null if the parameter is not bound in the loading component.

            Binding existing = loadingComponentBindingMap.get(loadingParameterName);

            if (existing == null) return null;

            String description = String.format("InheritedBinding[parameter %s %s(inherited from %s of %s)]", name,
                                               component.getCompleteId(), loadingParameterName,
View Full Code Here

        String name = token.getName();

        BlockImpl block = new BlockImpl(token.getLocation(),
                                        String.format("Parmeter %s of %s", name, element.getCompleteId()));

        Binding binding = new LiteralBinding("block parameter " + name, block, token.getLocation());

        // TODO: Check that the t:parameter doesn't appear outside of an embedded component.

        element.bindParameter(name, binding);
View Full Code Here

        for (String name : informals.keySet())
        {
            if (newComponentModel.getParameterModel(name) != null) continue;

            Binding binding = informals.get(name);

            newComponent.bindParameter(name, binding);
            newComponentBindings.put(name, binding);
        }
    }
View Full Code Here

        replay();

        BindingFactory factory = new LiteralBindingFactory();

        Binding b = factory.newBinding("test binding", res, null, "Tapestry5", l);

        assertSame(InternalUtils.locationOf(b), l);

        assertEquals(b.get(), "Tapestry5");
        assertTrue(b.isInvariant());
        assertSame(b.getBindingType(), String.class);

        try
        {
            b.set(null);
            unreachable();
        }
        catch (TapestryException ex)
        {
            assertSame(ex.getLocation(), l);
View Full Code Here

        replay();

        BindingFactory factory = new TranslateBindingFactory(source, new StringInternerImpl());

        Binding binding = factory.newBinding(description, resources, resources, expression, l);

        assertSame(binding.get(), translator);

        assertSame(InternalUtils.locationOf(binding), l);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.Binding

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.