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.DivisionManager;
import com.pre.web.OptionBinder;
import com.pre.web.WebApplication;
import com.pre.web.base.renderers.DivisionRowRenderer;
public class DivisionWindow extends Window {
/**
*
*/
private static final long serialVersionUID = -3879661220933336001L;
private DivisionManager manager;
public void onCreate(){
_init();
createMenubar();
refresh();
}
private void _init() {
manager=(DivisionManager)WebApplication.lookup(DivisionManager.LocalJNDIName);
Grid divisionsGrid=(Grid)getFellow("divisionsGrid");
divisionsGrid.setRowRenderer(new DivisionRowRenderer());
divisionsGrid.setModel(new ListModelList());
}
private void createMenubar() {
OptionBinder.bindStandardOptions(this, "divisionsGrid", "details/DivisionDetails.zul");
}
private void feedGrid() {
Grid divisionsGrid=(Grid)getFellow("divisionsGrid");
ListModelList model=(ListModelList)divisionsGrid.getModel();
model.clear();
model.addAll(manager.findAll());
}
private void refresh(){
feedGrid();
}
}