use of com.github.bordertech.wcomponents.TableDataModel in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintTableActions.
@Test
public void testDoPaintTableActions() 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.addAction(new WButton(TEST_ACTION_ONE));
component.addAction(new WButton(TEST_ACTION_TWO));
assertXpathExists("//ui:table/ui:actions", component);
assertXpathEvaluatesTo(TEST_ACTION_ONE, "//ui:table/ui:actions/ui:action[1]/html:button", component);
assertXpathEvaluatesTo(TEST_ACTION_TWO, "//ui:table/ui:actions/ui:action[2]/html:button", component);
}
use of com.github.bordertech.wcomponents.TableDataModel in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintAttributesAndContent.
@Test
public void testDoPaintAttributesAndContent() throws IOException, SAXException, XpathException {
WDataTable component = new WDataTable();
// renderer class
component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
// renderer instance
component.addColumn(new WTableColumn(COL2_HEADING_TEST, new WTextField()));
component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
TableDataModel tableModel = createTableModel();
component.setDataModel(tableModel);
component.setVisible(true);
component.setSummary(TABLE_SUMMARY_TEST);
component.setCaption(CAPTION_TEST);
component.setType(WDataTable.Type.HIERARCHIC);
setActiveContext(createUIContext());
// check ui:table attributes
String tableId = component.getId();
assertXpathEvaluatesTo(tableId, "//ui:table/@id", component);
assertXpathEvaluatesTo(CAPTION_TEST, "//ui:table/@caption", component);
assertXpathEvaluatesTo("hierarchic", "//ui:table/@type", component);
// check header values
String[] colHeaders = { COL1_HEADING_TEST, COL2_HEADING_TEST, COL3_HEADING_TEST };
for (int i = 0; i < component.getColumnCount(); i++) {
assertXpathEvaluatesTo(colHeaders[i], "//ui:table/ui:thead/ui:th[" + (i + 1) + "]/ui:decoratedlabel/ui:labelbody", component);
}
// check table content
for (int i = 0; i < tableModel.getRowCount(); i++) {
for (int j = 0; j < component.getColumnCount(); j++) {
assertXpathEvaluatesTo((String) tableModel.getValueAt(i, j), "//ui:table/ui:tbody/ui:tr[" + (i + 1) + "]/ui:td[" + (j + 1) + "]/ui:textfield", component);
}
}
}
use of com.github.bordertech.wcomponents.TableDataModel in project wcomponents by BorderTech.
the class WDataTableRenderer_Test method testDoPaintExpandModeServer.
// SERVER outputs "dynamic" see https://github.com/BorderTech/wcomponents/issues/701
@Test
public void testDoPaintExpandModeServer() 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.SERVER);
assertXpathEvaluatesTo("dynamic", "//ui:table/ui:rowexpansion/@mode", component);
}
Aggregations