use of com.github.bordertech.wcomponents.TableDataModel 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.TableDataModel 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.TableDataModel 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);
}
use of com.github.bordertech.wcomponents.TableDataModel in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintSelectModeMultipleSelectAllControl.
@Test
public void testDoPaintSelectModeMultipleSelectAllControl() 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);
assertXpathExists("//ui:table/ui:rowselection", component);
assertXpathEvaluatesTo(TRUE, "//ui:table/ui:rowselection/@multiple", component);
assertXpathEvaluatesTo("control", "//ui:table/ui:rowselection/@selectAll", component);
}
use of com.github.bordertech.wcomponents.TableDataModel in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintPaginatedClient.
@Test
public void testDoPaintPaginatedClient() 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.CLIENT);
setActiveContext(createUIContext());
assertXpathEvaluatesTo("client", "//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