Search in sources :

Example 21 with WText

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

the class WFigureRenderer_Test method testRenderedWithMargins.

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

Example 22 with WText

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

the class WHeadingRenderer_Test method testPaintWithDecoratedLabel.

@Test
public void testPaintWithDecoratedLabel() throws IOException, SAXException, XpathException {
    final String text1 = "WHeading_Test.testPaintWithDecoratedLabel.text1";
    final String text2 = "WHeading_Test.testPaintWithDecoratedLabel.text2";
    WHeading heading = new WHeading(HeadingLevel.H1, new WDecoratedLabel(new WText(text1)));
    assertSchemaMatch(heading);
    assertXpathEvaluatesTo(text1, "//ui:heading[@level=1]/ui:decoratedlabel/ui:labelbody/text()", heading);
    // Test WHeading's WText implementation
    heading.setText(text2);
    assertXpathEvaluatesTo(text2 + text1, "//ui:heading[@level=1]/ui:decoratedlabel/ui:labelbody/text()", heading);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WHeading(com.github.bordertech.wcomponents.WHeading) WDecoratedLabel(com.github.bordertech.wcomponents.WDecoratedLabel) Test(org.junit.Test)

Example 23 with WText

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

the class WListRenderer_Test method testRenderedFormatNoBorder.

@Test
public void testRenderedFormatNoBorder() throws IOException, SAXException {
    // non-empty list, no border
    WList list = new WList(WList.Type.STRIPED);
    list.setRepeatedComponent(new WText());
    setActiveContext(createUIContext());
    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)

Example 24 with WText

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

the class WTabGroupRenderer_Test method testDoPaint.

@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
    String groupName = "WTabGroupRenderer_Test.testDoPaint.groupName";
    WTabGroup tabGroup = new WTabGroup(groupName);
    WComponent wrapped = wrapTabGroup(tabGroup);
    assertXpathNotExists("//ui:tab", wrapped);
    tabGroup.addTab(new WText("dummy"), "dummy", TabMode.CLIENT);
    assertXpathExists("//ui:tab", wrapped);
    assertSchemaMatch(wrapped);
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WText(com.github.bordertech.wcomponents.WText) WTabGroup(com.github.bordertech.wcomponents.WTabGroup) Test(org.junit.Test)

Example 25 with WText

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

the class WTableRenderer_Test method createTableWithColumnFooters.

/**
 * @return a table setup with column footers
 */
private WTable createTableWithColumnFooters() {
    WTable table = new WTable();
    table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class, new WText("FOOTER1")));
    table.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    table.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class, new WText("FOOTER3")));
    // Turn on column footers
    table.setRenderColumnFooters(true);
    TableModel tableModel = createTableModel();
    table.setTableModel(tableModel);
    return table;
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WText(com.github.bordertech.wcomponents.WText) WTextField(com.github.bordertech.wcomponents.WTextField) TableModel(com.github.bordertech.wcomponents.WTable.TableModel) AdapterBasicTableModel(com.github.bordertech.wcomponents.AdapterBasicTableModel) SimpleTableModel(com.github.bordertech.wcomponents.SimpleTableModel)

Aggregations

WText (com.github.bordertech.wcomponents.WText)100 Test (org.junit.Test)63 WPanel (com.github.bordertech.wcomponents.WPanel)18 WCollapsible (com.github.bordertech.wcomponents.WCollapsible)10 WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)10 WHeading (com.github.bordertech.wcomponents.WHeading)10 UIContext (com.github.bordertech.wcomponents.UIContext)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 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)5 WImage (com.github.bordertech.wcomponents.WImage)5 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)5 WTextField (com.github.bordertech.wcomponents.WTextField)5 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)5