package com.pre.web.base;
import org.zkoss.zul.Grid;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Window;
import com.pre.session.base.CompanyManager;
import com.pre.web.OptionBinder;
import com.pre.web.WebApplication;
import com.pre.web.base.renderers.CompanyRowRenderer;
public class CompanyWindow extends Window{
/**
*
*/
private static final long serialVersionUID = -3879661220933336001L;
private CompanyManager manager;
private void _init() {
manager=(CompanyManager)WebApplication.lookup(CompanyManager.LocalJNDIName);
Grid companiesGrid=(Grid)getFellow("companiesGrid");
companiesGrid.setRowRenderer(new CompanyRowRenderer());
companiesGrid.setModel(new ListModelList());
}
public void onCreate(){
_init();
createMenubar();
feedGrid();
}
private void createMenubar() {
OptionBinder.bindStandardOptions(this, "companiesGrid", "details/CompanyDetails.zul");
}
private void feedGrid() {
Grid companiesGrid=(Grid)getFellow("companiesGrid");
ListModelList model=(ListModelList)companiesGrid.getModel();
model.clear();
model.addAll(manager.findAll());
}
private void refresh(){
feedGrid();
}
public void onRefresh(){
refresh();
}
}