18 package org.turro.erp.resource;
20 import java.util.Collection;
21 import org.turro.elephant.context.Application;
22 import org.turro.elephant.util.DecimalFormats;
23 import org.turro.erp.db.ErpPU;
24 import org.turro.erp.entity.AptitudeDegree;
25 import org.turro.erp.menu.ErpMenu;
26 import org.turro.erp.entity.Resource;
27 import org.turro.zkoss.grid.PagingGrid;
28 import org.turro.zkoss.label.LabelTypes;
29 import org.turro.elephant.zkoss.ElLabel;
30 import org.zkoss.zk.ui.event.Event;
31 import org.zkoss.zk.ui.event.EventListener;
32 import org.zkoss.zk.ui.event.Events;
33 import org.zkoss.zk.ui.ext.AfterCompose;
34 import org.zkoss.zul.A;
35 import org.zkoss.zul.Column;
36 import org.zkoss.zul.Columns;
37 import org.zkoss.zul.Hlayout;
38 import org.zkoss.zul.Image;
39 import org.zkoss.zul.Label;
40 import org.zkoss.zul.Row;
41 import org.zkoss.zul.Rows;
42 import org.zkoss.zul.Vlayout;
60 private void addRows() {
63 Collection<Resource> list =
new ErpPU().getResultList(
64 "select res from Resource res " +
67 Rows rows =
new Rows();
72 rows.appendChild(row);
74 row.setSclass(
"draft");
76 row.appendChild(
new Label(res.getId() +
""));
77 Vlayout vbox =
new Vlayout();
78 row.appendChild(vbox);
79 A b =
new A(res.getName());
80 if(app.
isInRole(
"erp-config:edit")) {
81 b.addEventListener(Events.ON_CLICK,
new EventListener() {
83 public void onEvent(Event event)
throws Exception {
84 ErpMenu.showResource(res.getId());
90 if(!res.getAptitudeDegrees().isEmpty()) {
91 Hlayout hbox =
new Hlayout();
92 vbox.appendChild(hbox);
93 hbox.appendChild(
new Image(
"/_zul/images/aptitude.png"));
94 for(AptitudeDegree od : res.getAptitudeDegrees()) {
95 hbox.appendChild(LabelTypes.getSoftLabel(od.getFullDescription()));
99 row.appendChild(
new Label(DecimalFormats.format(res.getCostHour())));
100 row.appendChild(
new Label(DecimalFormats.format(res.getPriceHour())));
106 private void addColumns() {
107 Columns cols =
new Columns();
110 Column col =
new Column(
"#",
null,
"50px");
111 cols.appendChild(col);
113 col =
new Column(Application.getString(
"lName"));
114 cols.appendChild(col);
116 col =
new Column(Application.getString(
"lCost"),
null,
"120px");
117 col.setAlign(
"right");
118 cols.appendChild(col);
120 col =
new Column(Application.getString(
"lPrice"),
null,
"120px");
121 col.setAlign(
"right");
122 cols.appendChild(col);
boolean isInRole(String role)
static Application getApplication()
void setRowCount(int rows)