package com.akbank.pys.controller.hgo; import java.io.Serializable; import org.zkoss.zul.Group; import org.zkoss.zul.Groupfoot; import org.zkoss.zul.Label; import org.zkoss.zul.Row; import org.zkoss.zul.RowRenderer; import org.zkoss.zul.Textbox; import com.akbank.pys.orm.KpiValue; public class KpiGroupRenderer implements RowRenderer,Serializable { private static final long serialVersionUID = -5589722680992827682L; double weight=0; double score=0; double rate=0; double suggestedScore=0; @Override public void render(Row row, Object obj, int index) throws Exception { if (row instanceof Group) { Group grp=(Group) row; grp.appendChild(new Label()); grp.appendChild(new Label(obj.toString())); } else if (row instanceof Groupfoot) { Groupfoot grpFoot=(Groupfoot) row; grpFoot.appendChild(new Label()); grpFoot.appendChild(new Label("Grup Özeti")); grpFoot.appendChild(new Label(weight+"")); grpFoot.appendChild(new Label(score+"")); grpFoot.appendChild(new Label(suggestedScore+"")); grpFoot.appendChild(new Label()); grpFoot.setVisible(false); Group grp=grpFoot.getGroup(); grp.appendChild(new Label(weight+"")); grp.appendChild(new Label(score+"")); grp.appendChild(new Label(suggestedScore+"")); grp.appendChild(new Label()); weight=0; score=0; suggestedScore=0; rate=0; } else { KpiValue data = (KpiValue) obj; row.appendChild(new Label(data.getKpi().getId().getId()+ "")); row.appendChild(new Label(data.getKpi().getName())); row.appendChild(new Label(data.getWeight() + "")); row.appendChild(new Label(data.getRate() + "")); row.appendChild(new Label(data.getScore() + "")); row.appendChild(new Label(data.getSuggestedScore() + "")); Textbox tb = new Textbox(data.getExplanation()); tb.setWidth("200px"); tb.setHeight("30px"); tb.setMultiline(true); row.appendChild(tb); weight+=data.getWeight(); score+=data.getScore(); suggestedScore+=data.getSuggestedScore(); rate+=data.getRate(); } } }