BrightSide Workbench Full Report + Source Code
org.turro.crm.zul.customer.CustomerOwnerGrid Class Reference
Inheritance diagram for org.turro.crm.zul.customer.CustomerOwnerGrid:
Collaboration diagram for org.turro.crm.zul.customer.CustomerOwnerGrid:

Public Member Functions

 CustomerOwnerGrid ()
 
void setEditable (boolean editable)
 
void setCustomer (Customer customer)
 
void setAddToolbar (boolean addToolbar)
 
void addRows ()
 

Detailed Description

Author
llturro

Definition at line 28 of file CustomerOwnerGrid.java.

Constructor & Destructor Documentation

◆ CustomerOwnerGrid()

org.turro.crm.zul.customer.CustomerOwnerGrid.CustomerOwnerGrid ( )

Definition at line 36 of file CustomerOwnerGrid.java.

36  {
37  rows = new Rows();
38  appendChild(rows);
39  }

Member Function Documentation

◆ addRows()

void org.turro.crm.zul.customer.CustomerOwnerGrid.addRows ( )

Definition at line 65 of file CustomerOwnerGrid.java.

65  {
66  for(final CustomerOwner co : customer.getOwnedBy()) {
67  final Row row = new Row();
68  row.setValue(co);
69  rows.appendChild(row);
70 
71  Vbox vbox = new Vbox();
72  row.appendChild(vbox);
73 
74  if(editable) {
75  Hbox hbox = new Hbox();
76  vbox.appendChild(hbox);
77 
78  final VendorCombobox vendor = new VendorCombobox();
79  vendor.setObjectValue(co.getVendor());
80  vendor.addEventListener(Events.ON_CHANGE, new EventListener() {
81  @Override
82  public void onEvent(Event event) throws Exception {
83  co.setVendor(vendor.getObjectValue());
84  co.setOwningDate(new Date());
85  }
86  });
87  hbox.appendChild(vendor);
88 
89  final Image img = new Image("/_zul/images/delete.png");
90  img.setStyle("cursor:pointer");
91  img.addEventListener(Events.ON_CLICK, new EventListener() {
92  @Override
93  public void onEvent(Event event) throws Exception {
94  Messages.confirmDeletion().show(() -> {
95  customer.getOwnedBy().remove(co);
96  setCustomer(customer);
97  });
98  }
99  });
100  hbox.appendChild(img);
101 
102  final FormulaListbox comission = new FormulaListbox();
103  comission.setFormulaType(FormulaType.FORMULA_COMISSION);
104  comission.setObjectValue(co.getComission());
105  comission.addEventListener(Events.ON_SELECT, new EventListener() {
106  @Override
107  public void onEvent(Event event) throws Exception {
108  co.setComission(comission.getObjectValue());
109  }
110  });
111  vbox.appendChild(comission);
112  comission.afterCompose();
113 
114  final FormulaListbox alert = new FormulaListbox();
115  alert.setFormulaType(FormulaType.FORMULA_ALERT);
116  alert.setObjectValue(co.getAlert());
117  alert.addEventListener(Events.ON_SELECT, new EventListener() {
118  @Override
119  public void onEvent(Event event) throws Exception {
120  co.setAlert(alert.getObjectValue());
121  }
122  });
123  vbox.appendChild(alert);
124  alert.afterCompose();
125 
126  } else {
127  Label label = new Label(co.getVendor() != null ? co.getVendor().getName() : "***");
128  row.appendChild(label);
129 
130  label = new Label(co.getComission().getName());
131  row.appendChild(label);
132 
133  label = new Label(co.getAlert().getName());
134  row.appendChild(label);
135  }
136  }
137  }
Set< CustomerOwner > getOwnedBy()
Definition: Customer.java:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAddToolbar()

void org.turro.crm.zul.customer.CustomerOwnerGrid.setAddToolbar ( boolean  addToolbar)

Definition at line 57 of file CustomerOwnerGrid.java.

57  {
58  if(addToolbar) {
59  toolbar = new Toolbar();
60  getParent().appendChild(toolbar);
61  addToolbarButtons();
62  }
63  }

◆ setCustomer()

void org.turro.crm.zul.customer.CustomerOwnerGrid.setCustomer ( Customer  customer)

Definition at line 49 of file CustomerOwnerGrid.java.

49  {
50  this.customer = customer;
51  rows.getChildren().clear();
52  if(customer != null) {
53  addRows();
54  }
55  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEditable()

void org.turro.crm.zul.customer.CustomerOwnerGrid.setEditable ( boolean  editable)

Definition at line 41 of file CustomerOwnerGrid.java.

41  {
42  this.editable = editable;
43  if(customer != null) {
44  setCustomer(customer);
45  }
46  updateButtons();
47  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: