Search in sources :

Example 1 with WDataTable

use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.

the class TableCellWithActionExample method createTable.

/**
 * Creates and configures the table to be used by the example. The table is configured with global rather than user
 * data. Although this is not a realistic scenario, it will suffice for this example.
 *
 * @return a new configured table.
 */
private WDataTable createTable() {
    WDataTable table = new WDataTable();
    table.addColumn(new WTableColumn("First name", new WTextField()));
    table.addColumn(new WTableColumn("Last name", new WTextField()));
    table.addColumn(new WTableColumn("DOB", new WDateField()));
    table.addColumn(new WTableColumn("Action", new ExampleButton()));
    table.setExpandMode(ExpandMode.CLIENT);
    table.setDataModel(createTableModel());
    return table;
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Example 2 with WDataTable

use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.

the class TreeTableExample method createTable.

/**
 * Creates and configures the table to be used by the example. The table is configured with global rather than user
 * data. Although this is not a realistic scenario, it will suffice for this example.
 *
 * @return a new configured table.
 */
private WDataTable createTable() {
    WDataTable tbl = new WDataTable();
    tbl.addColumn(new WTableColumn("First name", new WTextField()));
    tbl.addColumn(new WTableColumn("Last name", new WTextField()));
    tbl.addColumn(new WTableColumn("DOB", new WDateField()));
    tbl.setExpandMode(ExpandMode.CLIENT);
    TableTreeNode root = createTree();
    tbl.setDataModel(new ExampleTreeTableModel(root));
    return tbl;
}
Also used : TableTreeNode(com.github.bordertech.wcomponents.TableTreeNode) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDataTable(com.github.bordertech.wcomponents.WDataTable) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Example 3 with WDataTable

use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.

the class DataTableBeanProviderExample method createTable.

/**
 * Creates and configures the table to be used by the example. The table is configured with global rather than user
 * data. Although this is not a realistic scenario, it will suffice for this example.
 *
 * @return a new configured table.
 */
private WDataTable createTable() {
    WDataTable tbl = new WDataTable();
    tbl.addColumn(new WTableColumn("First name", new WText()));
    tbl.addColumn(new WTableColumn("Last name", new WText()));
    tbl.addColumn(new WTableColumn("DOB", new WText()));
    return tbl;
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WText(com.github.bordertech.wcomponents.WText) WDataTable(com.github.bordertech.wcomponents.WDataTable)

Example 4 with WDataTable

use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.

the class DataTableOptionsExample method createExpandedDataTable.

/**
 * @return a table that has expanded content.
 */
private WDataTable createExpandedDataTable() {
    WDataTable table = new WDataTable();
    table.setType(WDataTable.Type.TABLE);
    table.addColumn(new WTableColumn("Column1", WText.class));
    table.addColumn(new WTableColumn("Column2", WText.class));
    table.addColumn(new WTableColumn("Column3", WText.class));
    table.setRowsPerPage(DEFAULT_ROWS_PER_PAGE);
    table.setSummary("Expanded content table summary");
    table.setCaption("Expanded content table caption");
    TableTreeNode root = createTree();
    table.setDataModel(new ExampleTreeTableModel(root));
    return table;
}
Also used : TableTreeNode(com.github.bordertech.wcomponents.TableTreeNode) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WText(com.github.bordertech.wcomponents.WText) WDataTable(com.github.bordertech.wcomponents.WDataTable)

Example 5 with WDataTable

use of com.github.bordertech.wcomponents.WDataTable in project wcomponents by BorderTech.

the class DataTableOptionsExample method createHierarchicDataTable.

/**
 * @return a hierarchic table
 */
private WDataTable createHierarchicDataTable() {
    WDataTable table = new WDataTable();
    table.setType(WDataTable.Type.HIERARCHIC);
    table.addColumn(new WTableColumn("Column1", WText.class));
    table.addColumn(new WTableColumn("Column2", WText.class));
    table.addColumn(new WTableColumn("Column3", WText.class));
    table.setRowsPerPage(DEFAULT_ROWS_PER_PAGE);
    table.setSummary("Hierarchic table summary");
    table.setCaption("Hierarchic table caption");
    TableTreeNode root = createHierarchicTree();
    table.setDataModel(new ExampleTreeTableModel(root));
    return table;
}
Also used : TableTreeNode(com.github.bordertech.wcomponents.TableTreeNode) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WText(com.github.bordertech.wcomponents.WText) WDataTable(com.github.bordertech.wcomponents.WDataTable)

Aggregations

WDataTable (com.github.bordertech.wcomponents.WDataTable)41 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)38 WTextField (com.github.bordertech.wcomponents.WTextField)29 Test (org.junit.Test)28 SimpleTableDataModel (com.github.bordertech.wcomponents.SimpleTableDataModel)23 TableDataModel (com.github.bordertech.wcomponents.TableDataModel)23 WText (com.github.bordertech.wcomponents.WText)8 TableTreeNode (com.github.bordertech.wcomponents.TableTreeNode)5 WButton (com.github.bordertech.wcomponents.WButton)5 ActionConstraint (com.github.bordertech.wcomponents.WDataTable.ActionConstraint)4 WDateField (com.github.bordertech.wcomponents.WDateField)4 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)3 UIContext (com.github.bordertech.wcomponents.UIContext)2 TreeTableDataModel (com.github.bordertech.wcomponents.TreeTableDataModel)1 WComponent (com.github.bordertech.wcomponents.WComponent)1 WDataTableRowRenderer (com.github.bordertech.wcomponents.WDataTableRowRenderer)1 WRepeater (com.github.bordertech.wcomponents.WRepeater)1 SubUIContext (com.github.bordertech.wcomponents.WRepeater.SubUIContext)1 SystemException (com.github.bordertech.wcomponents.util.SystemException)1 TreeNode (com.github.bordertech.wcomponents.util.TreeNode)1