Package org.apache.tapestry

Examples of org.apache.tapestry.Binding


    @Test
    public void parameter_with_default() throws Exception
    {
        final BindingSource source = mockBindingSource();
        final InternalComponentResources resources = mockInternalComponentResources();
        final Binding binding = mockBinding();
        String boundValue = "howdy!";

        MutableComponentModel model = mockMutableComponentModel();

        model.addParameter("value", false, TapestryConstants.PROP_BINDING_PREFIX);
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

        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>,
            // we want to skip those when rending informal parameters.
View Full Code Here

    public void parameter_is_bound()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        Binding binding = mockBinding();
        TypeCoercer coercer = mockTypeCoercer();

        Instantiator ins = newInstantiator(component, model);

        train_getParameterModel(model, "barney", null);
View Full Code Here

    public void verify_required_parameters_all_are_bound()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        Binding binding = mockBinding();
        TypeCoercer coercer = mockTypeCoercer();
        ParameterModel pmodel = mockParameterModel();

        Instantiator ins = newInstantiator(component, model);
View Full Code Here

    public void is_invariant()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        Binding binding = mockBinding();
        TypeCoercer coercer = mockTypeCoercer();
        ParameterModel pmodel = mockParameterModel();

        Instantiator ins = newInstantiator(component, model);
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.