Package org.apache.tapestry.spec

Examples of org.apache.tapestry.spec.IContainedComponent


    public void testInheritInformalParameters() throws Exception
    {
        IComponentSpecification spec = parseComponent("TestInheritInformal.jwc");

        IContainedComponent border = spec.getComponent("border");
        assertEquals(border.getInheritInformalParameters(), false);

        IContainedComponent textField = spec.getComponent("textField");
        assertEquals(textField.getInheritInformalParameters(), true);
    }
View Full Code Here


    public void testComponentProperty() throws Exception
    {
        IComponentSpecification cs = parseComponent("ComponentProperty.jwc");

        IContainedComponent cc = cs.getComponent("body");

        assertEquals("my-value", cc.getProperty("my-property"));
    }
View Full Code Here

    public void testComponentInjectProperty() throws Exception
    {
        IComponentSpecification cs = parseComponent("ComponentInjectProperty.jwc");

        IContainedComponent cc = cs.getComponent("body");

        assertEquals("myProperty", cc.getPropertyName());

        cc = cs.getComponent("fred");

        assertNull(cc.getPropertyName());
    }
View Full Code Here

    public void testComponentCopyOf() throws Exception
    {
        IComponentSpecification cs = parseComponent("ComponentCopyOf.jwc");

        IContainedComponent source = cs.getComponent("source");
        IContainedComponent copy = cs.getComponent("copy");
        IContainedComponent override = cs.getComponent("override");

        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"));

        b = copy.getBinding("formatter");

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

                Tapestry.format("SpecificationParser.both-type-and-copy-of", id),
                getResourceLocation());

        IComponentSpecification spec = (IComponentSpecification) digester.getRoot();

        IContainedComponent source = spec.getComponent(copyOf);
        if (source == null)
            throw new DocumentParseException(
                Tapestry.format("SpecificationParser.unable-to-copy", copyOf),
                getResourceLocation());

        IContainedComponent target = (IContainedComponent) digester.peek();

        target.setType(source.getType());
        target.setCopyOf(copyOf);

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

                String id = (String) ids.get(i);

                // Get the sub-component specification from the
                // container's specification.

                IContainedComponent contained = containerSpec.getComponent(id);

                String type = contained.getType();
                ILocation location = contained.getLocation();

                _componentResolver.resolve(cycle, namespace, type, location);

                IComponentSpecification componentSpecification =
                    _componentResolver.getSpecification();
View Full Code Here

     */

    public void testBinding40() throws Exception
    {
        IComponentSpecification spec = parseComponent("Binding40.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

    {
        IComponentSpecification spec = parsePage("StaticBindingValue.page");

        checkLine(spec, 22);

        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

    public void testListenerBinding() throws Exception
    {
        IComponentSpecification spec = parsePage("ListenerBinding.page");

        checkLine(spec, 22);
        IContainedComponent c = spec.getComponent("c");

        checkLine(c, 24);

        IListenerBindingSpecification lbs = (ListenerBindingSpecification) c.getBinding("listener");

        checkLine(lbs, 25);

        String expectedScript = buildExpectedScript(new String[]
        { "if page.isFormInputValid():", "  cycle.page = \"Results\"", "else:",
View Full Code Here

    public void testInheritInformalParameters() throws Exception
    {
        IComponentSpecification spec = parseComponent("TestInheritInformal.jwc");

        IContainedComponent border = spec.getComponent("border");
        assertEquals(border.getInheritInformalParameters(), false);

        IContainedComponent textField = spec.getComponent("textField");
        assertEquals(textField.getInheritInformalParameters(), true);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.spec.IContainedComponent

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.