Search in sources :

Example 6 with WList

use of com.github.bordertech.wcomponents.WList in project wcomponents by BorderTech.

the class WListRenderer_Test method testRenderedFormaGap.

@Test
public void testRenderedFormaGap() throws IOException, SAXException, XpathException {
    // No hgap, vgap
    WList list = new WList(WList.Type.STRIPED);
    list.setRepeatedComponent(new WText());
    list.setData(Arrays.asList(new String[] { "row1", "row2", "row3" }));
    assertSchemaMatch(list);
    assertXpathNotExists("//ui:panel/ui:listlayout/@gap", list);
    // With gap
    list = new WList(WList.Type.STRIPED, GAP);
    list.setRepeatedComponent(new WText());
    list.setData(Arrays.asList(new String[] { "row1", "row2", "row3" }));
    assertSchemaMatch(list);
    assertXpathEvaluatesTo(String.valueOf(GAP), "//ui:panel/ui:listlayout/@gap", list);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WList(com.github.bordertech.wcomponents.WList) Test(org.junit.Test)

Example 7 with WList

use of com.github.bordertech.wcomponents.WList in project wcomponents by BorderTech.

the class WListRenderer_Test method testLayoutCorrectlyConfigured.

@Test
public void testLayoutCorrectlyConfigured() {
    WList component = new WList(WList.Type.STRIPED);
    Assert.assertTrue("Incorrect layout supplied", getWebXmlRenderer(component) instanceof WListRenderer);
}
Also used : WList(com.github.bordertech.wcomponents.WList) Test(org.junit.Test)

Example 8 with WList

use of com.github.bordertech.wcomponents.WList in project wcomponents by BorderTech.

the class WListRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WList list = new WList(WList.Type.STRIPED);
    list.setRepeatedComponent(new WText());
    assertXpathNotExists("//ui:panel/ui:margin", list);
    Margin margin = new Margin(0);
    list.setMargin(margin);
    assertXpathNotExists("//ui:panel/ui:margin", list);
    margin = new Margin(Size.SMALL);
    list.setMargin(margin);
    assertSchemaMatch(list);
    assertXpathEvaluatesTo("sm", "//ui:panel/ui:margin/@all", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@north", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@east", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@south", list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@west", list);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    list.setMargin(margin);
    assertSchemaMatch(list);
    assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@all", list);
    assertXpathEvaluatesTo("sm", "//ui:panel/ui:margin/@north", list);
    assertXpathEvaluatesTo("med", "//ui:panel/ui:margin/@east", list);
    assertXpathEvaluatesTo("lg", "//ui:panel/ui:margin/@south", list);
    assertXpathEvaluatesTo("xl", "//ui:panel/ui:margin/@west", list);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WList(com.github.bordertech.wcomponents.WList) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 9 with WList

use of com.github.bordertech.wcomponents.WList in project wcomponents by BorderTech.

the class WListRenderer_Test method testRenderedFormatHgapVgap.

// deprecated hgap vgap constructor render
@Test
public void testRenderedFormatHgapVgap() throws IOException, SAXException, XpathException {
    WList list;
    for (WList.Type t : WList.Type.values()) {
        list = new WList(t, SpaceUtil.sizeToInt(GAP), SpaceUtil.sizeToInt(BIG_GAP));
        list.setRepeatedComponent(new WText());
        list.setData(Arrays.asList(new String[] { "row1", "row2", "row3" }));
        assertSchemaMatch(list);
        if (t == WList.Type.FLAT) {
            assertXpathEvaluatesTo(GAP.toString(), "//ui:panel/ui:listlayout/@gap", list);
        } else {
            assertXpathEvaluatesTo(BIG_GAP.toString(), "//ui:panel/ui:listlayout/@gap", list);
        }
    }
}
Also used : WText(com.github.bordertech.wcomponents.WText) WList(com.github.bordertech.wcomponents.WList) Test(org.junit.Test)

Example 10 with WList

use of com.github.bordertech.wcomponents.WList in project wcomponents by BorderTech.

the class WListRenderer_Test method testRenderedFormatEmptyNoBorder.

@Test
public void testRenderedFormatEmptyNoBorder() throws IOException, SAXException, XpathException {
    // empty list, no border
    WList list = new WList(WList.Type.STRIPED);
    list.setRepeatedComponent(new WText());
    for (WList.Type t : WList.Type.values()) {
        list.setType(t);
        assertSchemaMatch(list);
        assertXpathEvaluatesTo(t.toString().toLowerCase(), "//ui:listlayout/@type", list);
        assertXpathNotExists("//ui:listlayout/@separator", list);
        assertXpathNotExists("//ui:panel/@type", list);
    }
    for (WList.Separator s : WList.Separator.values()) {
        list.setSeparator(s);
        assertSchemaMatch(list);
        if (s == WList.Separator.NONE) {
            assertXpathNotExists("//ui:listlayout/@separator", list);
        } else {
            assertXpathEvaluatesTo(s.toString().toLowerCase(), "//ui:listlayout/@separator", list);
        }
    }
}
Also used : WText(com.github.bordertech.wcomponents.WText) WList(com.github.bordertech.wcomponents.WList) Test(org.junit.Test)

Aggregations

WList (com.github.bordertech.wcomponents.WList)12 Test (org.junit.Test)8 WText (com.github.bordertech.wcomponents.WText)7 SimpleTableBean (com.github.bordertech.wcomponents.examples.common.SimpleTableBean)2 ArrayList (java.util.ArrayList)2 Margin (com.github.bordertech.wcomponents.Margin)1 Size (com.github.bordertech.wcomponents.Size)1 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)1 SystemException (com.github.bordertech.wcomponents.util.SystemException)1 List (java.util.List)1