Search in sources :

Example 1 with SimpleTableBean

use of com.github.bordertech.wcomponents.examples.common.SimpleTableBean in project wcomponents by BorderTech.

the class WListExample method preparePaintComponent.

/**
 * Override preparePaintComponent to perform initialisation the first time through.
 *
 * @param request the request being responded to.
 */
@Override
public void preparePaintComponent(final Request request) {
    if (!isInitialised()) {
        List<SimpleTableBean> 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"));
        for (WList list : lists) {
            list.setData(items);
        }
        setInitialised(true);
    }
}
Also used : ArrayList(java.util.ArrayList) SimpleTableBean(com.github.bordertech.wcomponents.examples.common.SimpleTableBean) WList(com.github.bordertech.wcomponents.WList)

Example 2 with SimpleTableBean

use of com.github.bordertech.wcomponents.examples.common.SimpleTableBean 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 3 with SimpleTableBean

use of com.github.bordertech.wcomponents.examples.common.SimpleTableBean in project wcomponents by BorderTech.

the class WListOptionsExample method applySettings.

/**
 * Apply settings is responsible for building the list to be displayed and adding it to the container.
 */
private void applySettings() {
    container.reset();
    WList list = new WList((com.github.bordertech.wcomponents.WList.Type) ddType.getSelected());
    List<String> selected = (List<String>) cgBeanFields.getSelected();
    SimpleListRenderer renderer = new SimpleListRenderer(selected, cbRenderUsingFieldLayout.isSelected());
    list.setRepeatedComponent(renderer);
    list.setSeparator((Separator) ddSeparator.getSelected());
    list.setRenderBorder(cbRenderBorder.isSelected());
    container.add(list);
    List<SimpleTableBean> 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"));
    list.setData(items);
    list.setVisible(cbVisible.isSelected());
}
Also used : ArrayList(java.util.ArrayList) SimpleTableBean(com.github.bordertech.wcomponents.examples.common.SimpleTableBean) ArrayList(java.util.ArrayList) List(java.util.List) WList(com.github.bordertech.wcomponents.WList) WList(com.github.bordertech.wcomponents.WList)

Aggregations

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