Click
Click Examples

Source Viewer : WEB-INF/classes/org/apache/click/examples/page/introduction/SimpleTablePage.java

package org.apache.click.examples.page.introduction;

import java.util.List;

import javax.annotation.Resource;

import org.apache.click.control.Column;
import org.apache.click.control.Table;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.service.CustomerService;
import org.springframework.stereotype.Component;

/**
 * Provides an simple Table usage example Page.
 */
@Component
public class SimpleTablePage extends BorderPage {

    private static final long serialVersionUID = 1L;

    @Resource(name="customerService")
    private CustomerService customerService;

    private Table table;

    // Constructor ------------------------------------------------------------

    public SimpleTablePage() {
        table = new Table("table");

        table.setClass(Table.CLASS_ITS);

        table.addColumn(new Column("id"));
        table.addColumn(new Column("name"));
        table.addColumn(new Column("email"));
        table.addColumn(new Column("investments"));

        addControl(table);
    }

    // Event Handlers ---------------------------------------------------------

    /**
     * @see org.apache.click.Page#onRender()
     */
    @Override
    public void onRender() {
        List list = customerService.getCustomersSortedByName(10);
        table.setRowList(list);
    }
}