Search in sources :

Example 76 with WPanel

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

the class FlowLayoutRenderer_Test method testHVGapsWithContentAlign.

@Test
public void testHVGapsWithContentAlign() throws IOException, SAXException, XpathException {
    WPanel panel = new WPanel();
    String expected;
    for (FlowLayout.Alignment a : FlowLayout.Alignment.values()) {
        for (FlowLayout.ContentAlignment c : FlowLayout.ContentAlignment.values()) {
            panel.setLayout(new FlowLayout(a, 3, 16, c));
            assertSchemaMatch(panel);
            expected = a == FlowLayout.VERTICAL ? BIG_GAP.toString() : GAP.toString();
            assertXpathEvaluatesTo(expected, "//ui:panel/ui:flowlayout/@gap", panel);
        }
    }
}
Also used : FlowLayout(com.github.bordertech.wcomponents.layout.FlowLayout) WPanel(com.github.bordertech.wcomponents.WPanel) Test(org.junit.Test)

Example 77 with WPanel

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

the class ListLayoutRenderer_Test method testDoRender.

@Test
public void testDoRender() throws IOException, SAXException, XpathException {
    final String text1 = "FlowRenderer_Test.testPaint.text1";
    final String text2 = "FlowRenderer_Test.testPaint.text2";
    WPanel panel = new WPanel();
    panel.setLayout(new ListLayout(ListLayout.Type.STRIPED, ListLayout.Alignment.LEFT, ListLayout.Separator.DOT, true, GAP));
    assertSchemaMatch(panel);
    assertXpathNotExists("//ui:panel/ui:listlayout/ui:cell", panel);
    panel.add(new WText(text1));
    panel.add(new WText(text2));
    assertXpathEvaluatesTo("2", "count(//ui:panel/ui:listlayout/ui:cell)", panel);
    assertXpathEvaluatesTo(text1, "normalize-space(//ui:panel/ui:listlayout/ui:cell[1])", panel);
    assertXpathEvaluatesTo(text2, "normalize-space(//ui:panel/ui:listlayout/ui:cell[2])", panel);
}
Also used : ListLayout(com.github.bordertech.wcomponents.layout.ListLayout) WText(com.github.bordertech.wcomponents.WText) WPanel(com.github.bordertech.wcomponents.WPanel) Test(org.junit.Test)

Aggregations

WPanel (com.github.bordertech.wcomponents.WPanel)77 Test (org.junit.Test)39 WHeading (com.github.bordertech.wcomponents.WHeading)17 WText (com.github.bordertech.wcomponents.WText)17 FlowLayout (com.github.bordertech.wcomponents.layout.FlowLayout)16 WButton (com.github.bordertech.wcomponents.WButton)13 ColumnLayout (com.github.bordertech.wcomponents.layout.ColumnLayout)10 WContainer (com.github.bordertech.wcomponents.WContainer)9 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)9 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)8 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)8 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)7 WLabel (com.github.bordertech.wcomponents.WLabel)7 Action (com.github.bordertech.wcomponents.Action)6 WTextField (com.github.bordertech.wcomponents.WTextField)6 ArrayList (java.util.ArrayList)6 Size (com.github.bordertech.wcomponents.Size)5 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)5 BorderLayout (com.github.bordertech.wcomponents.layout.BorderLayout)5 Alignment (com.github.bordertech.wcomponents.layout.ColumnLayout.Alignment)5