use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintMissingAttributesColumnStriping.
@Test
public void testDoPaintMissingAttributesColumnStriping() 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.setTableModel(createTableModel());
component.setVisible(true);
component.setStripingType(WTable.StripingType.COLUMNS);
component.setSeparatorType(WTable.SeparatorType.VERTICAL);
assertXpathNotExists("//ui:table/@caption", component);
assertXpathEvaluatesTo("table", "//ui:table/@type", component);
assertXpathEvaluatesTo("cols", "//ui:table/@striping", component);
assertXpathEvaluatesTo("vertical", "//ui:table/@separators", component);
}
use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintWithInvisibleColumnAndNoColumnHeaders.
@Test
public void testDoPaintWithInvisibleColumnAndNoColumnHeaders() 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);
final int testColIndex = 1;
final boolean testShowColHeaders = false;
component.getColumn(testColIndex).setVisible(false);
component.setShowColumnHeaders(testShowColHeaders);
// head hidden=true
assertXpathEvaluatesTo(TRUE, "//ui:table/ui:thead/@hidden", component);
// column headers - only COL1 and COL3 showing - in positions 1 and 2 respectively - only 2 cols
assertXpathEvaluatesTo(COL1_HEADING_TEST, "//ui:table/ui:thead/ui:th[1]/ui:decoratedlabel/ui:labelbody", component);
assertXpathEvaluatesTo(COL3_HEADING_TEST, "//ui:table/ui:thead/ui:th[2]/ui:decoratedlabel/ui:labelbody", component);
assertXpathNotExists("//ui:table/ui:thead/ui:th[3]/ui:decoratedlabel/ui:labelbody", component);
// first row - col1 and col3 from model in positions 1 and 2 respectively - only 2 cols showing
List<Integer> row = new ArrayList<>();
row.add(0);
String firstName = (String) tableModel.getValueAt(row, 0);
String entryDate = (String) tableModel.getValueAt(row, 2);
assertXpathEvaluatesTo(firstName, "//ui:table/ui:tbody/ui:tr[1]/ui:td[1]/ui:textfield", component);
assertXpathEvaluatesTo(entryDate, "//ui:table/ui:tbody/ui:tr[1]/ui:td[2]/ui:textfield", component);
assertXpathNotExists("//ui:table/ui:tbody/ui:tr[1]/ui:td[3]/ui:textfield", component);
}
use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintToggleSubRowSelection.
@Test
public void testDoPaintToggleSubRowSelection() 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.setSelectMode(WTable.SelectMode.MULTIPLE);
component.setToggleSubRowSelection(true);
component.setExpandMode(ExpandMode.CLIENT);
assertXpathExists("//ui:table/ui:rowselection", component);
assertXpathEvaluatesTo(TRUE, "//ui:table/ui:rowselection/@toggle", component);
}
use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintExpandModeClient.
@Test
public void testDoPaintExpandModeClient() 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.setExpandMode(ExpandMode.CLIENT);
assertXpathEvaluatesTo("client", "//ui:table/ui:rowexpansion/@mode", component);
}
use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.
the class WTableRenderer_Test method testDoPaintExpandModeLazy.
@Test
public void testDoPaintExpandModeLazy() 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.setExpandMode(ExpandMode.LAZY);
assertXpathEvaluatesTo("lazy", "//ui:table/ui:rowexpansion/@mode", component);
}
Aggregations