Package org.apache.tapestry

Examples of org.apache.tapestry.Binding


        String defaultBindingPrefix = determineDefaultBindingPrefix(
                component,
                name,
                TapestryConstants.LITERAL_BINDING_PREFIX);

        Binding binding = _bindingSource.newBinding(
                "parameter " + name,
                _loadingElement.getComponentResources(),
                component.getComponentResources(),
                defaultBindingPrefix,
                token.getValue(),
View Full Code Here


                    TapestryConstants.PROP_BINDING_PREFIX);

            // At some point we may add meta data to control what the default prefix is within a
            // component.

            Binding binding = _bindingSource.newBinding(
                    "parameter " + name,
                    loadingComponent.getComponentResources(),
                    component.getComponentResources(),
                    defaultBindingPrefix,
                    value,
View Full Code Here

    private void parameter(ParameterToken token)
    {
        BlockImpl block = new BlockImpl(token.getLocation());
        String name = token.getName();

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

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

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

        return _element.getContainingPage().getRootComponent();
    }

    public boolean isInvariant(String parameterName)
    {
        Binding b = getBinding(parameterName);

        return b != null && b.isInvariant();
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public <T> T readParameter(String parameterName, Class<T> expectedType)
    {
        Binding b = getBinding(parameterName);

        try
        {
            // Will throw NPE if binding is null, but this should never be called if the
            // parameter is not bound.

            Object boundValue = b.get();

            return _typeCoercer.coerce(boundValue, expectedType);
        }
        catch (Exception ex)
        {
View Full Code Here

        }
    }

    public Class getBoundType(String parameterName)
    {
        Binding b = getBinding(parameterName);

        return b != null ? b.getBindingType() : null;
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public <T> void writeParameter(String parameterName, T parameterValue)
    {
        Binding b = getBinding(parameterName);

        Class bindingType = b.getBindingType();

        try
        {
            Object coerced = _typeCoercer.coerce(parameterValue, bindingType);

            b.set(coerced);
        }
        catch (Exception ex)
        {
            throw new TapestryException(StructureMessages.writeParameterFailure(
                    parameterName,
View Full Code Here

            // Skip all formal parameters.

            if (_componentModel.getParameterModel(name) != null)
                continue;

            Binding b = _bindings.get(name);

            Object value = b.get();

            if (value == null)
                continue;

            // Because Blocks can be passed in (right from the template, using <t:parameter>,
View Full Code Here

    }

    public PageElement newExpansionElement(ComponentResources componentResources,
            ExpansionToken token)
    {
        Binding binding = _bindingSource.newBinding(
                "expansion",
                componentResources,
                componentResources,
                TapestryConstants.PROP_BINDING_PREFIX,
                token.getExpression(),
View Full Code Here

        ComponentResources resources = newComponentResources(bean);
        Location l = newLocation();

        replay();

        Binding binding = _factory.newBinding("test binding", resources, null, "readOnly", l);

        assertEquals(binding.get(), "ReadOnly");

        try
        {
            binding.set("fail");
            unreachable();
        }
        catch (TapestryException ex)
        {
            assertEquals(
View Full Code Here

TOP

Related Classes of org.apache.tapestry.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.