Search in sources :

Example 61 with WText

use of com.github.bordertech.wcomponents.WText 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 62 with WText

use of com.github.bordertech.wcomponents.WText 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 63 with WText

use of com.github.bordertech.wcomponents.WText 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 64 with WText

use of com.github.bordertech.wcomponents.WText 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)

Example 65 with WText

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

the class WListRenderer_Test method testRenderedFormatWithBorder.

@Test
public void testRenderedFormatWithBorder() throws IOException, SAXException {
    // non-empty list, no border
    WList list = new WList(WList.Type.STRIPED);
    list.setRenderBorder(true);
    list.setRepeatedComponent(new WText());
    list.setData(Arrays.asList(new String[] { "row1", "row2", "row3" }));
    assertSchemaMatch(list);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WList(com.github.bordertech.wcomponents.WList) Test(org.junit.Test)

Aggregations

WText (com.github.bordertech.wcomponents.WText)97 Test (org.junit.Test)63 WPanel (com.github.bordertech.wcomponents.WPanel)17 WCollapsible (com.github.bordertech.wcomponents.WCollapsible)10 WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)10 UIContext (com.github.bordertech.wcomponents.UIContext)9 WHeading (com.github.bordertech.wcomponents.WHeading)9 WTabSet (com.github.bordertech.wcomponents.WTabSet)7 DefaultWComponent (com.github.bordertech.wcomponents.DefaultWComponent)6 WList (com.github.bordertech.wcomponents.WList)6 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)6 MockResponse (com.github.bordertech.wcomponents.util.mock.MockResponse)6 MockServletConfig (com.github.bordertech.wcomponents.util.mock.servlet.MockServletConfig)6 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)5 WComponent (com.github.bordertech.wcomponents.WComponent)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)5 WImage (com.github.bordertech.wcomponents.WImage)5 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)5 MockHttpServletRequest (com.github.bordertech.wcomponents.util.mock.servlet.MockHttpServletRequest)5