use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintSortableSortModeDynamic.
@Test
public void testDoPaintSortableSortModeDynamic() 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 = createTableModelSortable();
component.setDataModel(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);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintWithColAlignment.
@Test
public void testDoPaintWithColAlignment() 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).setAlign(WTableColumn.Alignment.LEFT);
table.getColumn(1).setAlign(WTableColumn.Alignment.CENTER);
table.getColumn(2).setAlign(WTableColumn.Alignment.RIGHT);
TableDataModel tableModel = createTableModel();
table.setDataModel(tableModel);
assertXpathNotExists("//ui:table/ui:thead/ui:th[1]/@align", table);
assertXpathEvaluatesTo("center", "//ui:table/ui:thead/ui:th[2]/@align", table);
assertXpathEvaluatesTo("right", "//ui:table/ui:thead/ui:th[3]/@align", table);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintEmptyTableNoAttributes.
@Test
public void testDoPaintEmptyTableNoAttributes() 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));
component.setVisible(true);
setActiveContext(createUIContext());
assertXpathEvaluatesTo(component.getNoDataMessage(), "//ui:table/ui:tbody/ui:nodata", component);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintExpandModeLazy.
@Test
public void testDoPaintExpandModeLazy() 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.setExpandMode(ExpandMode.LAZY);
assertXpathEvaluatesTo("lazy", "//ui:table/ui:rowexpansion/@mode", component);
}
use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintSortableSortModeDynamicClientSettings.
@Test
public void testDoPaintSortableSortModeDynamicClientSettings() 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 tableDataModel = createTableModelSortable();
component.setDataModel(tableDataModel);
component.setVisible(true);
component.setSortMode(SortMode.DYNAMIC);
setActiveContext(createUIContext());
MockRequest request = new MockRequest();
String colIndexStr = "0";
request.setParameter(component.getId() + "-h", "x");
request.setParameter(component.getId() + ".sort", colIndexStr);
request.setParameter(component.getId() + ".sortDesc", TRUE);
component.handleRequest(request);
assertXpathEvaluatesTo("dynamic", "//ui:table/ui:sort/@mode", component);
assertXpathEvaluatesTo(colIndexStr, "//ui:table/ui:sort/@col", component);
assertXpathEvaluatesTo(TRUE, "//ui:table/ui:sort/@descending", 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);
}
Aggregations