Search in sources :

Example 41 with WTableColumn

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

the class SelectableDataTableExample 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 WText()));
    table.addColumn(new WTableColumn("Last name", new WText()));
    table.addColumn(new WTableColumn("DOB", new WText()));
    String[][] data = new String[][] { new String[] { "Joe", "Bloggs", "01/02/1973" }, new String[] { "Jane", "Bloggs", "04/05/1976" }, new String[] { "Kid", "Bloggs", "31/12/1999" } };
    table.setDataModel(new SimpleTableDataModel(data));
    return table;
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WText(com.github.bordertech.wcomponents.WText) WDataTable(com.github.bordertech.wcomponents.WDataTable) SimpleTableDataModel(com.github.bordertech.wcomponents.SimpleTableDataModel)

Example 42 with WTableColumn

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

the class TreeTableHierarchyExample 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.setType(WDataTable.Type.HIERARCHIC);
    tbl.addColumn(new WTableColumn("First name", new WText()));
    tbl.addColumn(new WTableColumn("Last name", new WText()));
    tbl.addColumn(new WTableColumn("DOB", new WDateField()));
    tbl.setExpandMode(ExpandMode.CLIENT);
    tbl.setStripingType(WDataTable.StripingType.ROWS);
    TableTreeNode root = createTree();
    tbl.setDataModel(new ExampleTreeTableModel(root));
    return tbl;
}
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) WDateField(com.github.bordertech.wcomponents.WDateField)

Example 43 with WTableColumn

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

the class TableLoadPerformance method setupWTable.

/**
 * Setup WTable.
 */
private void setupWTable() {
    WTextField col1 = new WTextField();
    col1.setIdName("my1");
    col1.setReadOnly(true);
    WTextField col2 = new WTextField();
    col2.setIdName("my2");
    col2.setReadOnly(true);
    WDateField col3 = new WDateField();
    col3.setIdName("my3");
    col3.setReadOnly(true);
    table.addColumn(new WTableColumn("COL1", col1));
    table.addColumn(new WTableColumn("COL2", col2));
    table.addColumn(new WTableColumn("COL3", col3));
    table.setExpandMode(WTable.ExpandMode.CLIENT);
    table.setIdName("wt");
    LevelDetails level = new LevelDetails("documents", TravelDocPanel.class, true);
    SimpleBeanBoundTableModel model = new SimpleBeanBoundTableModel(new String[] { "firstName", "lastName", "dateOfBirth" }, level);
    table.setTableModel(model);
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) SimpleBeanBoundTableModel(com.github.bordertech.wcomponents.SimpleBeanBoundTableModel) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField) LevelDetails(com.github.bordertech.wcomponents.SimpleBeanBoundTableModel.LevelDetails)

Example 44 with WTableColumn

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

the class TableLoadPerformance method setupWDataTable.

/**
 * Setup WTable.
 */
private void setupWDataTable() {
    WTextField col1 = new WTextField();
    col1.setIdName("my1");
    col1.setReadOnly(true);
    WTextField col2 = new WTextField();
    col2.setIdName("my2");
    col2.setReadOnly(true);
    WDateField col3 = new WDateField();
    col3.setIdName("my3");
    col3.setReadOnly(true);
    datatable.addColumn(new WTableColumn("COL1", col1));
    datatable.addColumn(new WTableColumn("COL2", col2));
    datatable.addColumn(new WTableColumn("COL3", col3));
    datatable.setExpandMode(WDataTable.ExpandMode.CLIENT);
    datatable.setIdName("wdt");
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Example 45 with WTableColumn

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

the class WTableOptionsExample method addColumns.

/**
 * @param table the table to add columns
 */
private void addColumns(final WTable table) {
    // Column - First name
    WTextField textField = new WTextField();
    textField.setToolTip("First name");
    table.addColumn(new WTableColumn("First name", textField));
    // Column - Last name
    textField = new WTextField();
    textField.setToolTip("Last name");
    table.addColumn(new WTableColumn("Last name", textField));
    // Column - Date field
    WDateField dateField = new WDateField();
    dateField.setToolTip("Date of birth");
    table.addColumn(new WTableColumn("Date of birth", dateField));
}
Also used : WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WDateField(com.github.bordertech.wcomponents.WDateField) WTextField(com.github.bordertech.wcomponents.WTextField)

Aggregations

WTableColumn (com.github.bordertech.wcomponents.WTableColumn)73 WTextField (com.github.bordertech.wcomponents.WTextField)60 Test (org.junit.Test)56 WDataTable (com.github.bordertech.wcomponents.WDataTable)38 WTable (com.github.bordertech.wcomponents.WTable)30 TableModel (com.github.bordertech.wcomponents.WTable.TableModel)25 TableDataModel (com.github.bordertech.wcomponents.TableDataModel)24 AdapterBasicTableModel (com.github.bordertech.wcomponents.AdapterBasicTableModel)23 SimpleTableDataModel (com.github.bordertech.wcomponents.SimpleTableDataModel)23 SimpleTableModel (com.github.bordertech.wcomponents.SimpleTableModel)23 WText (com.github.bordertech.wcomponents.WText)9 WButton (com.github.bordertech.wcomponents.WButton)8 WDateField (com.github.bordertech.wcomponents.WDateField)7 TableTreeNode (com.github.bordertech.wcomponents.TableTreeNode)5 ActionConstraint (com.github.bordertech.wcomponents.WDataTable.ActionConstraint)4 ActionConstraint (com.github.bordertech.wcomponents.WTable.ActionConstraint)4 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)4 UIContext (com.github.bordertech.wcomponents.UIContext)3 TreeTableDataModel (com.github.bordertech.wcomponents.TreeTableDataModel)2 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)2