Package org.apache.tapestry.binding

Examples of org.apache.tapestry.binding.BindingFactory


    public void test_Known_Prefix()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        expect(factory.createBinding(component, "bar", "path part of locator", l)).andReturn(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix("prefix");
        c.setFactory(factory);
View Full Code Here


    public void test_Prefix_No_Match()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        expect(factory.createBinding(component, "zip", "unknown:path part of locator", l)).andReturn(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix(BindingConstants.LITERAL_PREFIX);
        c.setFactory(factory);
View Full Code Here

    public void test_Single_Character_Prefix()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        expect(factory.createBinding(component, "bar", "path part of locator", l)).andReturn(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix("c");
        c.setFactory(factory);
View Full Code Here

    public void test_Empty_Character_Prefix()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        expect(factory.createBinding(component, "bar", "path part of locator", l)).andReturn(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix("");
        c.setFactory(factory);
View Full Code Here

                path = reference.substring(colonx + 1);
            }
        }

        BindingFactory factory = (BindingFactory) _factoryMap.get(prefix);

        return factory.createBinding(component, bindingDescription, path, location);
    }
View Full Code Here

    public IBinding createBinding(IComponent component, IParameterSpecification parameter, String description,
                                  String reference, String defaultBindingType, Location location)
    {
        String prefix = null;
        String path = reference;
        BindingFactory factory = null;

        int colonx = reference.indexOf(':');

        if (colonx > -1)
        {
            String pathPrefix = reference.substring(0, colonx);

            if (_factoryMap.containsKey(pathPrefix))
            {
                prefix = pathPrefix;

                path = reference.substring(colonx + 1);
            }
        } else if (parameter != null && _propertyMap.containsKey(parameter.getParameterName()))
        {
           
            factory = (BindingFactory) _propertyMap.get(parameter.getParameterName());
        }

        if (prefix == null)
        {
            prefix = defaultBindingType;
        }

        if (factory == null)
        {
            factory = (BindingFactory) _factoryMap.get(prefix);
        }
       
        return factory.createBinding(component, description, path, location);
    }
View Full Code Here

{
    public void testNoPrefix()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix(BindingConstants.LITERAL_PREFIX);
        c.setFactory(factory);

        // Training

        factory.createBinding(component, "foo", "a literal value without a prefix", l);
        setReturnValue(factory,binding);

        replayControls();

        BindingSourceImpl bs = new BindingSourceImpl();
View Full Code Here

    public void testNoPrefixWithDefault()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        factory.createBinding(component, "foo", "an-expression", l);
        setReturnValue(factory,binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix(BindingConstants.OGNL_PREFIX);
        c.setFactory(factory);
View Full Code Here

    public void testKnownPrefix()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        factory.createBinding(component, "bar", "path part of locator", l);
        setReturnValue(factory,binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix("prefix");
        c.setFactory(factory);
View Full Code Here

    public void testPrefixNoMatch()
    {
        IComponent component = newComponent();
        IBinding binding = newBinding();
        BindingFactory factory = newFactory();
        Location l = newLocation();

        // Training

        factory.createBinding(component, "zip", "unknown:path part of locator", l);
        setReturnValue(factory,binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix(BindingConstants.LITERAL_PREFIX);
        c.setFactory(factory);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.binding.BindingFactory

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.