Examples of IBindingSpecification


Examples of org.apache.tapestry.spec.IBindingSpecification

    public void test_With_Bindings()
    {
        Location l = newLocation();
        IContainedComponent cc = run("componentWithBindings", "getComponentWithBindings", l);

        IBindingSpecification bs1 = cc.getBinding("condition");
        assertSame(l, bs1.getLocation());
        assertEquals(BindingType.PREFIXED, bs1.getType());
        assertEquals("message", bs1.getValue());

        IBindingSpecification bs2 = cc.getBinding("element");
        assertEquals("div", bs2.getValue());
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

    {
        Location l = newLocation();

        IContainedComponent cc = run("whitespace", "getWhitespace", l);

        IBindingSpecification bs1 = cc.getBinding("value");
        assertSame(l, bs1.getLocation());
        assertEquals(BindingType.PREFIXED, bs1.getType());
        assertEquals("email", bs1.getValue());

        IBindingSpecification bs2 = cc.getBinding("displayName");
        assertEquals("message:email-label", bs2.getValue());
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

        Location l = newLocation();
        IComponentSpecification spec = new ComponentSpecification();
        run(spec, "componentWithBindings", "getComponentWithBindings", l);
        IContainedComponent cc = run(spec, "aComponentCopy", "getComponentWithBindingsCopy", l);
       
        IBindingSpecification bs1 = cc.getBinding("condition");
        assertSame(l, bs1.getLocation());
        assertEquals(BindingType.PREFIXED, bs1.getType());
        assertEquals("message", bs1.getValue());

        IBindingSpecification bs2 = cc.getBinding("element");
        assertEquals("div", bs2.getValue());
    }    
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

        {
            String name = (String) i.next();

            boolean isFormal = spec.getParameter(name) != null;

            IBindingSpecification bspec = contained.getBinding(name);

            // If not allowing informal parameters, check that each binding
            // matches
            // a formal parameter.

            if (formalOnly && !isFormal)
                throw new ApplicationRuntimeException(PageloadMessages.formalParametersOnly(
                        component,
                        name), component, bspec.getLocation(), null);

            // If an informal parameter that conflicts with a reserved name,
            // then skip it.

            if (!isFormal && spec.isReservedParameterName(name))
                continue;

            // The type determines how to interpret the value:
            // As a simple static String
            // As a nested property name (relative to the component)
            // As the name of a binding inherited from the containing component.
            // As the name of a public field
            // As a script for a listener

            BindingType type = bspec.getType();

            // For inherited bindings, defer until later. This gives components
            // a chance to setup bindings from static values and expressions in
            // the template. The order of operations is tricky, template bindings
            // come later. Note that this is a hold over from the Tapestry 3.0 DTD
            // and will some day no longer be supported.

            if (type == BindingType.INHERITED)
            {
                QueuedInheritedBinding queued = new QueuedInheritedBinding(component, bspec
                        .getValue(), name);
                _inheritedBindingQueue.add(queued);
                continue;
            }
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

            invalidBinding(binding);

        String name = binding.substring(0, equalsx).trim();
        String value = binding.substring(equalsx + 1).trim();

        IBindingSpecification bs = new BindingSpecification();
        bs.setType(BindingType.PREFIXED);
        bs.setValue(value);
        bs.setLocation(location);

        component.setBinding(name, bs);
    }   
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

    public void tesMessageBinding() throws Exception
    {
        IComponentSpecification spec = parseComponent("TestMessageBinding.jwc");

        IBindingSpecification bs = spec.getComponent("hello").getBinding("value");

        assertEquals("type", BindingType.PREFIXED, bs.getType());
        assertEquals("key", "message:label.hello", bs.getValue());

        checkLine(bs, 25);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

    public void testBinding31() throws Exception
    {
        IComponentSpecification spec = parseComponent("Binding31.jwc");
        IContainedComponent cc = spec.getComponent("component");

        IBindingSpecification bs = cc.getBinding("simple");

        assertEquals(BindingType.PREFIXED, bs.getType());
        assertEquals("message:some-key", bs.getValue());

        bs = cc.getBinding("enclosed");

        assertEquals(BindingType.PREFIXED, bs.getType());
        assertEquals("ognl:zip.zap.zoop", bs.getValue());
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

        IContainedComponent c = spec.getComponent("c");

        checkLine(c, 24);

        IBindingSpecification b = c.getBinding("fred");
        checkLine(b, 25);

        assertEquals("literal:flintstone", b.getValue());

        b = c.getBinding("barney");
        checkLine(b, 26);

        assertEquals("literal:rubble", b.getValue());

        b = c.getBinding("rock");
        checkLine(b, 27);
        assertEquals("literal:hudson", b.getValue());
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

        assertEquals("Insert", source.getType());
        assertEquals("Insert", copy.getType());
        assertEquals("Insert", override.getType());

        IBindingSpecification b = source.getBinding("value");

        assertEquals(BindingType.PREFIXED, b.getType());
        assertEquals("ognl:date", b.getValue());

        assertSame(b, copy.getBinding("value"));

        IBindingSpecification b2 = override.getBinding("value");
        assertEquals("ognl:tomorrow", b2.getValue());

        b = copy.getBinding("foo");

        assertSame(b, override.getBinding("foo"));
View Full Code Here

Examples of org.apache.tapestry.spec.IBindingSpecification

        Iterator i = source.getBindingNames().iterator();
        while (i.hasNext())
        {
            String bindingName = (String) i.next();
            IBindingSpecification binding = source.getBinding(bindingName);
            target.setBinding(bindingName, binding);
        }

        target.setType(source.getType());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.