use of com.github.bordertech.wcomponents.TableTreeNode 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;
}
use of com.github.bordertech.wcomponents.TableTreeNode in project wcomponents by BorderTech.
the class TreeTableHierarchyExample method createTree.
/**
* @return a tree containing the data for this example.
*/
private TableTreeNode createTree() {
TableTreeNode root = new TableTreeNode(null);
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
try {
TableTreeNode joe = new TableTreeNode(new PersonBean("Joe", "Bloggs", sdf.parse("01/02/1934")));
TableTreeNode jane = new TableTreeNode(new PersonBean("Jane", "Bloggs", sdf.parse("02/03/1935")));
TableTreeNode child = new TableTreeNode(new PersonBean("Child", "Bloggs", sdf.parse("03/04/1976")));
TableTreeNode grandChild1 = new TableTreeNode(new PersonBean("Grandchild-One", "Bloggs", sdf.parse("04/05/2006")));
TableTreeNode grandChild2 = new TableTreeNode(new PersonBean("Grandchild-Two", "Bloggs", sdf.parse("05/06/2007")));
root.add(joe);
root.add(jane);
joe.add(child);
child.add(grandChild1);
child.add(grandChild2);
} catch (ParseException e) {
LogFactory.getLog(getClass()).error("Failed to create test data", e);
}
return root;
}
use of com.github.bordertech.wcomponents.TableTreeNode in project wcomponents by BorderTech.
the class TableLoadPerformance method createTree.
/**
* @param beans the beans to load
* @return the tree of nodes required by WDataTable
*/
private TableTreeNode createTree(final List<PersonBean> beans) {
TableTreeNode top = new TableTreeNode(null);
// Build tree
for (PersonBean bean : beans) {
TableTreeNode row = new TableTreeNode(bean);
List<TravelDoc> docs = bean.getDocuments();
if (docs != null) {
for (TravelDoc doc : docs) {
TableTreeNode expandNode = new ExpandNode(doc);
row.add(expandNode);
}
}
top.add(row);
}
return top;
}
use of com.github.bordertech.wcomponents.TableTreeNode 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;
}
use of com.github.bordertech.wcomponents.TableTreeNode in project wcomponents by BorderTech.
the class DataTableOptionsExample method createTree.
/**
* @return a TableTreeNode containing sample data.
*/
private TableTreeNode createTree() {
TableTreeNode root = new TableTreeNode(null);
TableTreeNode row1 = new TableTreeNode(new ExampleBean("A1", "H2", "G3"));
TableTreeNode row2 = new TableTreeNode(new ExampleBean("B1", "G2", "E3"));
TableTreeNode row3 = new TableTreeNode(new ExampleBean("C1", "F2", "C3"));
TableTreeNode row4 = new TableTreeNode(new ExampleBean("D1", "E2", "A3"));
TableTreeNode row5 = new TableTreeNode(new ExampleBean("E1", "D2", "B3"));
TableTreeNode row6 = new TableTreeNode(new ExampleBean("F1", "C2", "D3"));
TableTreeNode row7 = new TableTreeNode(new ExampleBean("G1", "B2", "F3"));
TableTreeNode row8 = new TableTreeNode(new ExampleBean("H1", "A2", "H3"));
TableTreeNode extra1 = new ExtraDetailsNode(new ExtraBean("X1-A", "X1-B", "X1-C"));
TableTreeNode extra2 = new ExtraDetailsNode(new ExtraBean("Y1-A", "Y1-B", "Y1-C"));
TableTreeNode extra3 = new ExtraDetailsNode(new ExtraBean("Y2-A", "Y2-B", "Y2-C"));
TableTreeNode extra4 = new ExtraDetailsNode(new ExtraBean("Z1-A", "Z1-B", "Z1-C"));
root.add(row1);
root.add(row2);
root.add(row3);
root.add(row4);
root.add(row5);
root.add(row6);
root.add(row7);
root.add(row8);
row1.add(extra1);
row3.add(extra2);
row3.add(extra3);
row7.add(extra4);
return root;
}
Aggregations