Search in sources :

Example 1 with SimpleBeanListTableDataModel

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

the class AjaxWPaginationExample method preparePaintComponent.

/**
 * Override preparePaintComponent in order to set up the example data the first time through.
 *
 * @param request the request being responded to.
 */
@Override
protected void preparePaintComponent(final Request request) {
    super.preparePaintComponent(request);
    if (!isInitialised()) {
        List<Serializable> items = new ArrayList<>();
        items.add(new SimpleTableBean("A", "none", "thing"));
        items.add(new SimpleTableBean("B", "some", "thing2"));
        items.add(new SimpleTableBean("C", "little", "thing3"));
        items.add(new SimpleTableBean("D", "lots", "thing4"));
        items.add(new SimpleTableBean("E", "none", "thing5"));
        items.add(new SimpleTableBean("F", "some", "thing6"));
        items.add(new SimpleTableBean("G", "little", "thing7"));
        items.add(new SimpleTableBean("H", "lots", "thing8"));
        items.add(new SimpleTableBean("I", "none", "thing9"));
        items.add(new SimpleTableBean("J", "some", "thing10"));
        items.add(new SimpleTableBean("K", "little", "thing11"));
        items.add(new SimpleTableBean("L", "lots", "thing12"));
        table.setDataModel(new SimpleBeanListTableDataModel(new String[] { "name", "type", "thing" }, items));
        setInitialised(true);
    }
}
Also used : Serializable(java.io.Serializable) ArrayList(java.util.ArrayList) SimpleTableBean(com.github.bordertech.wcomponents.examples.common.SimpleTableBean) SimpleBeanListTableDataModel(com.github.bordertech.wcomponents.SimpleBeanListTableDataModel)

Example 2 with SimpleBeanListTableDataModel

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

the class ExampleTablePanel method setData.

/**
 * Sets the table data.
 *
 * @param data a list of {@link ExampleDataBean}s.
 */
public void setData(final List data) {
    // Bean properties to render
    String[] properties = new String[] { "colour", "shape", "animal" };
    simpleTable.setDataModel(new SimpleBeanListTableDataModel(properties, data));
}
Also used : SimpleBeanListTableDataModel(com.github.bordertech.wcomponents.SimpleBeanListTableDataModel)

Aggregations

SimpleBeanListTableDataModel (com.github.bordertech.wcomponents.SimpleBeanListTableDataModel)2 SimpleTableBean (com.github.bordertech.wcomponents.examples.common.SimpleTableBean)1 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1