Search in sources :

Example 36 with WTable

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

the class WTableRenderer_Test method testDoPaintEmptyTableNoAttributes.

@Test
public void testDoPaintEmptyTableNoAttributes() throws IOException, SAXException, XpathException {
    WTable component = new WTable();
    component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    component.setVisible(true);
    setActiveContext(createUIContext());
    assertXpathEvaluatesTo(component.getNoDataMessage(), "//ui:table/ui:tbody/ui:nodata", component);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 37 with WTable

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

the class WTableRenderer_Test method testDoPaintWithRowsPerPageOptions.

@Test
public void testDoPaintWithRowsPerPageOptions() throws IOException, SAXException, XpathException {
    WTable component = new WTable();
    component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    TableModel tableModel = createTableModel();
    component.setTableModel(tableModel);
    component.setVisible(true);
    component.setPaginationMode(PaginationMode.DYNAMIC);
    component.setRowsPerPageOptions(Arrays.asList(10, 20, 30));
    setActiveContext(createUIContext());
    assertXpathEvaluatesTo("dynamic", "//ui:table/ui:pagination/@mode", component);
    assertXpathEvaluatesTo((new Integer(component.getCurrentPage())).toString(), "//ui:table/ui:pagination/@currentPage", component);
    assertXpathEvaluatesTo((new Integer(component.getRowsPerPage())).toString(), "//ui:table/ui:pagination/@rowsPerPage", component);
    assertXpathEvaluatesTo((new Integer(tableModel.getRowCount())).toString(), "//ui:table/ui:pagination/@rows", component);
    assertXpathEvaluatesTo("10", "//ui:table/ui:pagination/ui:rowsselect/ui:option[1]/@value", component);
    assertXpathEvaluatesTo("20", "//ui:table/ui:pagination/ui:rowsselect/ui:option[2]/@value", component);
    assertXpathEvaluatesTo("30", "//ui:table/ui:pagination/ui:rowsselect/ui:option[3]/@value", component);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) 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) Test(org.junit.Test)

Example 38 with WTable

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

the class WTableRenderer_Test method testDoPaintSortableSortModeDynamic.

@Test
public void testDoPaintSortableSortModeDynamic() throws IOException, SAXException, XpathException {
    WTable component = new WTable();
    component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    TableModel tableModel = createTableModelSortable();
    component.setTableModel(tableModel);
    component.setVisible(true);
    // sortMode dynamic
    component.setSortMode(SortMode.DYNAMIC);
    assertXpathEvaluatesTo("dynamic", "//ui:table/ui:sort/@mode", component);
    assertXpathEvaluatesTo(TRUE, "//ui:table/ui:thead/ui:th[1]/@sortable", component);
    assertXpathNotExists("//ui:table/ui:thead/ui:th[2]/@sortable", component);
    assertXpathEvaluatesTo(TRUE, "//ui:table/ui:thead/ui:th[3]/@sortable", component);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) 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) Test(org.junit.Test)

Aggregations

WTable (com.github.bordertech.wcomponents.WTable)38 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)30 Test (org.junit.Test)30 WTextField (com.github.bordertech.wcomponents.WTextField)28 TableModel (com.github.bordertech.wcomponents.WTable.TableModel)25 AdapterBasicTableModel (com.github.bordertech.wcomponents.AdapterBasicTableModel)23 SimpleTableModel (com.github.bordertech.wcomponents.SimpleTableModel)23 WButton (com.github.bordertech.wcomponents.WButton)5 ActionConstraint (com.github.bordertech.wcomponents.WTable.ActionConstraint)4 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)4 UIContext (com.github.bordertech.wcomponents.UIContext)3 RowIdWrapper (com.github.bordertech.wcomponents.WTable.RowIdWrapper)3 ArrayList (java.util.ArrayList)2 Margin (com.github.bordertech.wcomponents.Margin)1 LevelDetails (com.github.bordertech.wcomponents.SimpleBeanBoundTableModel.LevelDetails)1 WComponent (com.github.bordertech.wcomponents.WComponent)1 WRepeater (com.github.bordertech.wcomponents.WRepeater)1 SubUIContext (com.github.bordertech.wcomponents.WRepeater.SubUIContext)1 WTableRowRenderer (com.github.bordertech.wcomponents.WTableRowRenderer)1 WText (com.github.bordertech.wcomponents.WText)1