Search in sources :

Example 21 with TableDataModel

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);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) SimpleTableDataModel(com.github.bordertech.wcomponents.SimpleTableDataModel) TableDataModel(com.github.bordertech.wcomponents.TableDataModel) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 22 with TableDataModel

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);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) SimpleTableDataModel(com.github.bordertech.wcomponents.SimpleTableDataModel) TableDataModel(com.github.bordertech.wcomponents.TableDataModel) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 23 with TableDataModel

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);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) SimpleTableDataModel(com.github.bordertech.wcomponents.SimpleTableDataModel) TableDataModel(com.github.bordertech.wcomponents.TableDataModel) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 24 with TableDataModel

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);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) SimpleTableDataModel(com.github.bordertech.wcomponents.SimpleTableDataModel) TableDataModel(com.github.bordertech.wcomponents.TableDataModel) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 25 with TableDataModel

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);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) SimpleTableDataModel(com.github.bordertech.wcomponents.SimpleTableDataModel) TableDataModel(com.github.bordertech.wcomponents.TableDataModel) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Aggregations

TableDataModel (com.github.bordertech.wcomponents.TableDataModel)28 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)24 WDataTable (com.github.bordertech.wcomponents.WDataTable)23 SimpleTableDataModel (com.github.bordertech.wcomponents.SimpleTableDataModel)22 Test (org.junit.Test)22 WTextField (com.github.bordertech.wcomponents.WTextField)21 TreeTableDataModel (com.github.bordertech.wcomponents.TreeTableDataModel)6 TableTreeNode (com.github.bordertech.wcomponents.TableTreeNode)4 WButton (com.github.bordertech.wcomponents.WButton)4 ActionConstraint (com.github.bordertech.wcomponents.WDataTable.ActionConstraint)4 UIContext (com.github.bordertech.wcomponents.UIContext)3 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)3 WComponent (com.github.bordertech.wcomponents.WComponent)2 WRepeater (com.github.bordertech.wcomponents.WRepeater)2 TreeNode (com.github.bordertech.wcomponents.util.TreeNode)2 AbstractTableDataModel (com.github.bordertech.wcomponents.AbstractTableDataModel)1 AbstractTreeTableDataModel (com.github.bordertech.wcomponents.AbstractTreeTableDataModel)1 WDataTableRowRenderer (com.github.bordertech.wcomponents.WDataTableRowRenderer)1 SubUIContext (com.github.bordertech.wcomponents.WRepeater.SubUIContext)1 WText (com.github.bordertech.wcomponents.WText)1