19 package org.turro.erp.reference;
22 import java.util.TreeMap;
23 import org.turro.elephant.context.Application;
24 import org.turro.elephant.util.Images;
25 import org.turro.erp.entity.Budget;
26 import org.turro.erp.entity.OrderReference;
27 import org.turro.erp.entity.WorkOrder;
28 import org.zkoss.zk.ui.event.Event;
29 import org.zkoss.zk.ui.event.EventListener;
30 import org.zkoss.zk.ui.event.Events;
31 import org.zkoss.zul.Hlayout;
32 import org.zkoss.zul.Toolbarbutton;
41 private TreeMap<Long, String> budgets;
42 private boolean hasSelection =
false;
45 this.workOrder = workOrder;
53 private void addComponents() {
54 getChildren().clear();
57 for(
final Map.Entry<Long, String> entry : budgets.entrySet()) {
58 Toolbarbutton tbb =
new Toolbarbutton(entry.getKey() +
"",
Images.
getImage(entry.getValue()));
59 tbb.addEventListener(Events.ON_CLICK,
new EventListener() {
61 public void onEvent(Event event)
throws Exception {
62 Events.postEvent(
new Event(Events.ON_SELECT,
BudgetSelector.this, entry.getKey()));
68 Toolbarbutton tbb =
new Toolbarbutton(Application.getString(
"lNew"), Images.getImage(
"document_new"));
69 tbb.addEventListener(Events.ON_CLICK,
new EventListener() {
71 public void onEvent(Event event)
throws Exception {
72 Events.postEvent(
new Event(Events.ON_SELECT, BudgetSelector.this, 0L));
78 tbb =
new Toolbarbutton(Application.getString(
"lDelete"), Images.getImage(
"document_del"));
79 tbb.addEventListener(Events.ON_CLICK,
new EventListener() {
81 public void onEvent(Event event)
throws Exception {
82 Events.postEvent(
new Event(Events.ON_SELECT, BudgetSelector.this, -1L));
90 private void generateMap() {
91 budgets =
new TreeMap<Long, String>();
94 for(Budget b : or.getBudgets()) {
95 String status = budgets.get(b.getBudgetNumber());
97 budgets.put(b.getBudgetNumber(),
"ok");
98 }
else if(b.isRefused()) {
99 if(!
"ok".equals(status)) {
100 budgets.put(b.getBudgetNumber(),
"cancel");
102 }
else if(b.isDelivered()) {
104 budgets.put(b.getBudgetNumber(),
"mail_send");
107 budgets.put(b.getBudgetNumber(),
"document");
static String getImage(String image)
Set< OrderReference > getOrderReferences()
void setWorkOrder(WorkOrder workOrder)