Examples of MutableEmbeddedComponentModel


Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        replay();

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
                                                                        null);

        fred.addParameter("city", "bedrock");

        try
        {
            fred.addParameter("city", "slateville");
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(ex.getMessage(),
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        replay();

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
                                                                        null);

        assertTrue(fred.getMixinClassNames().isEmpty());

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        replay();

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
                                                                        null);

        fred.addMixin("zip.zop.Zoom");
        fred.addMixin("foo.bar.Baz");

        assertEquals(fred.getMixinClassNames(), Arrays.asList("zip.zop.Zoom", "foo.bar.Baz"));

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        replay();

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false);

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
                                                                        null);

        fred.addMixin("zip.zop.Zoom");

        try
        {
            fred.addMixin("zip.zop.Zoom");
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(ex.getMessage(), "Mixin zip.zop.Zoom (for component fred) has already been defined.");
        }

        // Make sure it wasn't actually added.

        assertEquals(fred.getMixinClassNames(), Arrays.asList("zip.zop.Zoom"));

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        String type = field.getType();

        Location location = new StringLocation(String.format("%s.%s", transformation.getClassName(), fieldName), 0);

        MutableEmbeddedComponentModel embedded = model.addEmbeddedComponent(id, annotation.type(), type, annotation
                .inheritInformalParameters(), location);

        addParameters(embedded, annotation.parameters());

        updateModelWithPublishedParameters(embedded, annotation);
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

            embeddedComponents = CollectionFactory.newCaseInsensitiveMap();
        else if (embeddedComponents.containsKey(id))
            throw new IllegalArgumentException(ModelMessages.duplicateComponentId(id,
                    this.componentClassName));

        MutableEmbeddedComponentModel embedded = new MutableEmbeddedComponentModelImpl(id, type,
                componentClassName, this.componentClassName, inheritInformalParameters, location);

        embeddedComponents.put(id, embedded);

        return embedded; // So that parameters can be filled in
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

            String type = transformation.getFieldType(fieldName);

            Location location = new StringLocation(String.format("%s.%s", transformation
                    .getClassName(), fieldName), 0);

            MutableEmbeddedComponentModel embedded = model.addEmbeddedComponent(id, annotation
                    .type(), type, annotation.inheritInformalParameters(), location);

            addParameters(embedded, annotation.parameters());


            String names = annotation.publishParameters();
            if (InternalUtils.isNonBlank(names))
            {
                embedded.setPublishedParameters(CollectionFactory.newList(TapestryInternalUtils.splitAtCommas(names)));
            }


            transformation.makeReadOnly(fieldName);
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);

        assertTrue(model.getEmbeddedComponentIds().isEmpty());

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false, l);

        assertEquals(fred.getId(), "fred");
        assertEquals(fred.getComponentType(), "Fred");
        assertFalse(fred.getInheritInformalParameters());
        assertSame(fred.getLocation(), l);

        MutableEmbeddedComponentModel barney = model.addEmbeddedComponent("barney", "Barney", COMPONENT_CLASS_NAME,
                                                                          false, null);

        assertEquals(model.getEmbeddedComponentIds(), Arrays.asList("barney", "fred"));

        assertSame(model.getEmbeddedComponentModel("fred"), fred);
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);

        assertTrue(model.getEmbeddedComponentIds().isEmpty());

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, true, l);

        assertTrue(fred.getInheritInformalParameters());

        assertEquals(fred.toString(),
                     "EmbeddedComponentModel[id=fred type=Fred class=org.example.components.Fred inheritInformals=true]");

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.model.MutableEmbeddedComponentModel

        replay();

        MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null);

        MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false,
                                                                        null);

        assertTrue(fred.getParameterNames().isEmpty());

        fred.addParameter("city", "bedrock");
        fred.addParameter("job", "crane operator");

        assertEquals(fred.getParameterNames(), Arrays.asList("city", "job"));

        assertEquals(fred.getParameterValue("city"), "bedrock");

        verify();
    }
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.