use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintPaginatedServer.
@Test
public void testDoPaintPaginatedServer() throws IOException, SAXException, XpathException {
WDataTable component = new WDataTable();
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));
TableDataModel tableModel = createTableModel();
component.setDataModel(tableModel);
component.setVisible(true);
component.setPaginationMode(PaginationMode.DYNAMIC);
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);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintSortableSortModeServer.
// SERVER outputs "dynamic" see https://github.com/BorderTech/wcomponents/issues/701
@Test
public void testDoPaintSortableSortModeServer() throws IOException, SAXException, XpathException {
WDataTable component = new WDataTable();
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));
// sortable data model
TableDataModel tableModel = createTableModelSortable();
component.setDataModel(tableModel);
component.setVisible(true);
component.setSortMode(SortMode.SERVER);
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);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintSelectModeMultipleSelectAllControlSubmitOnChangeAndGroupName.
@Test
public void testDoPaintSelectModeMultipleSelectAllControlSubmitOnChangeAndGroupName() throws IOException, SAXException, XpathException {
WDataTable component = new WDataTable();
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));
TableDataModel tableModel = createTableModel();
component.setDataModel(tableModel);
component.setVisible(true);
component.setSelectMode(WDataTable.SelectMode.MULTIPLE);
component.setSelectAllMode(WDataTable.SelectAllType.CONTROL);
component.setSelectGroup("TEST GROUP NAME");
component.setSubmitOnRowSelect(true);
setActiveContext(createUIContext());
assertXpathExists("//ui:table/ui:rowselection", component);
assertXpathEvaluatesTo(TRUE, "//ui:table/ui:rowselection/@multiple", component);
assertXpathEvaluatesTo("control", "//ui:table/ui:rowselection/@selectAll", component);
assertXpathEvaluatesTo(component.getSelectGroup(), "//ui:table/ui:rowselection/@groupName", component);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintWithColWidth.
@Test
public void testDoPaintWithColWidth() throws IOException, SAXException, XpathException {
WDataTable table = new WDataTable();
table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
table.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
table.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
table.getColumn(0).setWidth(0);
table.getColumn(1).setWidth(1);
table.getColumn(2).setWidth(100);
TableDataModel tableModel = createTableModel();
table.setDataModel(tableModel);
assertXpathNotExists("//ui:table/ui:thead/ui:th[1]/@width", table);
assertXpathEvaluatesTo("1", "//ui:table/ui:thead/ui:th[2]/@width", table);
assertXpathEvaluatesTo("100", "//ui:table/ui:thead/ui:th[3]/@width", table);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintPaginatedDynamic.
@Test
public void testDoPaintPaginatedDynamic() throws IOException, SAXException, XpathException {
WDataTable component = new WDataTable();
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));
TableDataModel tableModel = createTableModel();
component.setDataModel(tableModel);
component.setVisible(true);
component.setPaginationMode(PaginationMode.DYNAMIC);
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);
}
Aggregations