19 package org.turro.erp.time;
21 import java.util.List;
22 import org.turro.elephant.context.Application;
23 import org.turro.erp.entity.HumanResource;
24 import org.turro.erp.entity.TimeControl;
25 import org.turro.erp.task.Workload;
26 import org.turro.erp.task.WorkloadSet;
27 import org.turro.zkoss.label.LabelExtended;
28 import org.turro.zkoss.label.LabelTypes;
29 import org.zkoss.zk.ui.event.Event;
30 import org.zkoss.zk.ui.event.EventListener;
31 import org.zkoss.zk.ui.event.Events;
32 import org.zkoss.zul.Button;
33 import org.zkoss.zul.Grid;
34 import org.zkoss.zul.Label;
35 import org.zkoss.zul.Row;
36 import org.zkoss.zul.Rows;
37 import org.zkoss.zul.Space;
38 import org.zkoss.zul.Vlayout;
47 boolean canGetIn =
true;
49 Rows rows = getRows();
51 rows.getChildren().clear();
62 final Row row =
new Row();
64 rows.appendChild(row);
66 row.appendChild(
new LabelExtended().setDateTime(tc.getStartTime()));
68 if(tc.getTask() !=
null) {
69 row.appendChild(
new Label(tc.getTask().getFullDescription()));
71 row.appendChild(
new Space());
76 select.setHflex(
"true");
77 select.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
79 public void onEvent(Event event) throws Exception {
80 Events.postEvent(new Event(Events.ON_CHANGE, TaskSelector.this, row.getValue()));
83 row.appendChild(select);
87 final Row rowStart =
new Row();
88 rows.appendChild(rowStart);
92 rowStart.appendChild(
new Space());
95 butStart.setHflex(
"true");
96 butStart.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
98 public void onEvent(Event event) throws Exception {
99 Events.postEvent(new Event(Events.ON_USER, TaskSelector.this, null));
102 rowStart.appendChild(butStart);
105 final Row rowCancel =
new Row();
106 rows.appendChild(rowCancel);
108 rowCancel.appendChild(
new Space());
109 rowCancel.appendChild(
new Space());
111 Button butCancel =
new Button(Application.getString(
"lCancel"));
112 butCancel.setHflex(
"true");
113 butCancel.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
115 public void onEvent(Event event) throws Exception {
116 Events.postEvent(new Event(Events.ON_CANCEL, TaskSelector.this));
119 rowCancel.appendChild(butCancel);
121 WorkloadSet wls =
new WorkloadSet(humanResource,
true);
123 for(Workload wl : wls) {
124 final Row row =
new Row();
126 rows.appendChild(row);
128 row.appendChild(
new Label(Application.getString(
"lNow")));
130 Vlayout vbox =
new Vlayout();
131 row.appendChild(vbox);
132 vbox.appendChild(
new Label(wl.getTask().getName()));
133 vbox.appendChild(LabelTypes.getSoftLabel(wl.getTask().getDescription()));
134 vbox.appendChild(
new Label(wl.getTask().getOrderReference().getWorkOrder().getFullDescription()));
135 vbox.appendChild(
new Label(wl.getTask().getOrderReference().getWorkOrder().getContract().getName()));
137 Button select =
new Button(Application.getString(
"lStart") +
" " +Application.getString(
"lTask"));
138 select.setHflex(
"true");
139 select.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
141 public void onEvent(Event event) throws Exception {
142 Events.postEvent(new Event(Events.ON_CHANGE, TaskSelector.this, row.getValue()));
145 row.appendChild(select);
static String getString(String key)
void setHumanResource(HumanResource humanResource)
void setHumanResource(HumanResource humanResource)
List< TimeControl > getPendingControl()