Source Viewer : WEB-INF/classes/org/apache/click/examples/page/panel/ListPanelDemo.java
package org.apache.click.examples.page.panel;
import java.util.List;
import javax.annotation.Resource;
import org.apache.click.control.Panel;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.panel.ListPanel;
import org.springframework.stereotype.Component;
/**
* Provides an ListPanel demonstration.
* <p/>
* Please note the ListPanel control will be automatically add to the Page using
* the fields name "listPanel".
*/
@Component
public class ListPanelDemo extends BorderPage {
private static final long serialVersionUID = 1L;
private ListPanel listPanel = new ListPanel("listPanel");
@Resource(name="customerService")
private CustomerService customerService;
public ListPanelDemo() {
addControl(listPanel);
listPanel.add(new Panel("panel1", "/panel/customersPanel1.htm"));
listPanel.add(new Panel("panel2", "/panel/customersPanel2.htm"));
listPanel.add(new Panel("panel3", "/panel/customersPanel3.htm"));
}
/**
* @see org.apache.click.Page#onRender()
*/
@Override
public void onRender() {
List<Customer> customers = customerService.getCustomersSortedByName(12);
addModel("customers", customers);
}
}