Examples of ListAttribute


Examples of org.apache.tiles.ListAttribute

     */
    @SuppressWarnings("unchecked")
    private static Attribute replaceVarsInListAttribute(ListAttribute listAttr,
            Object... vars) {
        Attribute nuattr;
        ListAttribute nuListAttr = new ListAttribute();
        nuListAttr.setInherit(listAttr.isInherit());
        List<Object> nuItems = (List<Object>) nuListAttr.getValue();
        for (Object item : (List<Object>) listAttr.getValue()) {
            if (item instanceof Attribute) {
                Attribute child = (Attribute) item;
                child = replaceVarsInAttribute(child, vars);
                nuItems.add(child);
View Full Code Here

Examples of org.apache.tiles.ListAttribute

        definitionDao.setReader(new DigesterDefinitionsReader());
        EasyMock.replay(applicationContext);

        Definition definition = definitionDao.getDefinition(
                "test.inherit.list", Locale.ITALIAN);
        ListAttribute listAttribute = (ListAttribute) definition
                .getAttribute("list");
        List<Attribute> attributes = (List<Attribute>) listAttribute.getValue();
        assertEquals(2, attributes.size());
    }
View Full Code Here

Examples of org.apache.tiles.ListAttribute

     * @param role A comma-separated list of roles. If present, the attribute
     * will be rendered only if the current user belongs to one of the roles.
     * @since 2.2.0
     */
    public void start(ArrayStack<Object> composeStack, String role) {
        ListAttribute listAttribute = new ListAttribute();
        listAttribute.setRole(role);
        composeStack.push(listAttribute);
    }
View Full Code Here

Examples of org.apache.tiles.ListAttribute

     *
     * @param composeStack The composing stack.
     * @since 2.2.0
     */
    public void end(ArrayStack<Object> composeStack) {
        ListAttribute listAttribute = (ListAttribute) composeStack.pop();
        ListAttribute parent = (ListAttribute) composeStack.peek();
        parent.add(listAttribute);
    }
View Full Code Here

Examples of org.apache.tiles.ListAttribute

    @Test
    public void testStart() {
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        model.start(composeStack, "myRole");
        assertEquals(1, composeStack.size());
        ListAttribute listAttribute = (ListAttribute) composeStack.peek();
        assertEquals("myRole", listAttribute.getRole());
    }
View Full Code Here

Examples of org.apache.tiles.ListAttribute

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testEnd() {
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        ListAttribute listAttribute = new ListAttribute();
        ListAttribute parent = new ListAttribute();
        composeStack.push(parent);
        composeStack.push(listAttribute);
        model.end(composeStack);
        assertEquals(1, composeStack.size());
        assertEquals(parent, composeStack.peek());
        List<Attribute> attributes = (List<Attribute>) parent.getValue();
        assertEquals(1, attributes.size());
        assertEquals(listAttribute, attributes.get(0));
    }
View Full Code Here

Examples of org.apache.tiles.ListAttribute

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testReplacePlaceholdersListAttribute() {
        Map<String, Attribute> attributes = new HashMap<String, Attribute>();
        ListAttribute listAttribute = new ListAttribute();
        ListAttribute internalListAttribute = new ListAttribute();
        listAttribute.setInherit(true);
        attributes.put("myList", listAttribute);
        listAttribute.add(new Attribute("value{2}"));
        listAttribute.add(new Attribute("value{2}{3}"));
        listAttribute.add(internalListAttribute);
        internalListAttribute.add(new Attribute("secondvalue{2}"));
        internalListAttribute.add(new Attribute("secondvalue{2}{3}"));
        Definition definition = new Definition("definitionName", new Attribute(
                "template{1}"), attributes);
        Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef",
                "value0", "value1", "value2", "value3");
        assertEquals("nudef", nudef.getName());
        Attribute attribute = nudef.getTemplateAttribute();
        assertEquals("templatevalue1", attribute.getValue());
        ListAttribute nuListAttribute = (ListAttribute) nudef.getAttribute("myList");
        assertTrue(nuListAttribute.isInherit());
        List<Attribute> list = (List<Attribute>) nuListAttribute.getValue();
        assertEquals(LIST_ATTRIBUTE_SIZE, list.size());
        attribute = list.get(0);
        assertEquals("valuevalue2", attribute.getValue());
        attribute = list.get(1);
        assertEquals("valuevalue2value3", attribute.getValue());
        ListAttribute evaluatedListAttribute = (ListAttribute) list.get(2);
        assertFalse(evaluatedListAttribute.isInherit());
        list = (List<Attribute>) evaluatedListAttribute.getValue();
        assertEquals(2, list.size());
        attribute = list.get(0);
        assertEquals("secondvaluevalue2", attribute.getValue());
        attribute = list.get(1);
        assertEquals("secondvaluevalue2value3", attribute.getValue());
View Full Code Here

Examples of org.apache.ws.jaxme.test.misc.wildcards.ListAttribute

        return asString(anyAttribute);
    }

    protected String getMarshalledListAttribute() throws JAXBException {
        ObjectFactory objectFactory = new ObjectFactory();
        ListAttribute listAttribute = objectFactory.createListAttribute();
        listAttribute.setAnyAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards/2", "foo"), "value 1");
        listAttribute.setAnyAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards", "bar"), "value 2");
        return asString(listAttribute);
    }
View Full Code Here

Examples of org.apache.ws.jaxme.test.misc.wildcards.ListAttribute

        String got = getMarshalledListAttribute();
        assertEquals(expect, got);
    }

    public void testUnmarshalListAttribute() throws Exception {
        ListAttribute listAttribute = (ListAttribute) getUnmarshalledElement(getMarshalledListAttribute());
        WildcardAttribute[] attrs = listAttribute.getAnyAttributeArray();
        assertEquals(new WildcardAttribute[]{
      new WildcardAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards/2", "foo"), "value 1"),
      new WildcardAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards", "bar"), "value 2")
    }, attrs);
    }
View Full Code Here

Examples of org.apache.ws.jaxme.test.misc.wildcards.ListAttribute

        return asString(anyAttribute);
    }

    protected String getMarshalledListAttribute() throws JAXBException {
        ObjectFactory objectFactory = new ObjectFactory();
        ListAttribute listAttribute = objectFactory.createListAttribute();
        listAttribute.setAnyAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards/2", "foo"), "value 1");
        listAttribute.setAnyAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards", "bar"), "value 2");
        return asString(listAttribute);
    }
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.