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