BrightSide Workbench Full Report + Source Code
VendorCombobox.java
Go to the documentation of this file.
1 package org.turro.crm.zul.vendor;
2 
3 import java.util.LinkedList;
4 import org.turro.auth.Authentication;
5 import org.turro.crm.db.CrmPU;
6 import org.turro.crm.entity.Vendor;
7 import org.turro.elephant.db.WhereClause;
8 import org.turro.jpa.Dao;
9 import org.turro.zkoss.input.GenericCombobox;
10 
15 public class VendorCombobox extends GenericCombobox<Vendor> {
16 
17  public void setSelectSelf(boolean selectSelf) {
18  if(selectSelf) {
19  Dao dao = new CrmPU();
20  WhereClause wc = new WhereClause();
21  wc.addClause("select vendor from Vendor as vendor");
22  wc.addClause("where vendor.idContact = :id");
25  }
26  }
27 
28  @Override
29  public void populateList(String value, LinkedList list, int nRows) {
30  Dao dao = new CrmPU();
31  WhereClause wc = new WhereClause();
32  wc.addClause("select vendor from Vendor as vendor");
33  wc.addClause("where 1=1");
34  wc.addLikeFields(new String[] {"vendor.name"}, value);
35  wc.addClause("order by vendor.name");
36  list.addAll(dao.getResultList(wc, nRows));
37  }
38 
39  @Override
40  public String getTextFromObject(Vendor value) {
41  return value.getName();
42  }
43 
44 }
void populateList(String value, LinkedList list, int nRows)
void setSelectSelf(boolean selectSelf)
void addLikeFields(String[] fields, String value)
void addNamedValue(String name, Object value)
Object getSingleResultOrNull(SqlClause sc)
Definition: Dao.java:419