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

Public Member Functions

void populateList (String value, LinkedList list, int nRows)
 
String getTextFromObject (SaleProspect value)
 
String getDescriptionFromText (String text)
 
String getNameFromText (String text)
 
long getIdFromText (String text)
 
- Public Member Functions inherited from org.turro.zkoss.input.GenericCombobox< V >
 GenericCombobox ()
 
getObjectValue ()
 
void setObjectValue (V value)
 
boolean isAllowNotInModelValues ()
 
void setAllowNotInModelValues (boolean allowNotInModelValues)
 
void refreshModel ()
 
abstract String getTextFromObject (V value)
 
Object getRelatedEntity ()
 
void setRelatedEntity (Object relatedEntity)
 
void render (Comboitem item, Object data, int index) throws Exception
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 33 of file SaleProspectCombobox.java.

Member Function Documentation

◆ getDescriptionFromText()

String org.turro.crm.zul.sale.SaleProspectCombobox.getDescriptionFromText ( String  text)

Definition at line 66 of file SaleProspectCombobox.java.

66  {
67  String[] s = text.split(Chars.forward().regexp().spaced().toString());
68  if(s.length > 0) {
69  return s[0];
70  }
71  return null;
72  }
Here is the caller graph for this function:

◆ getIdFromText()

long org.turro.crm.zul.sale.SaleProspectCombobox.getIdFromText ( String  text)

Definition at line 84 of file SaleProspectCombobox.java.

84  {
85  long id = 0;
86  int p = text.lastIndexOf(Chars.forward().spaced().toString());
87  try {
88  if(p > -1) {
89  id = Long.valueOf(text.substring(p + 1));
90  } else {
91  id = Long.valueOf(text);
92  }
93  } catch(Exception ex) {}
94  return id;
95  }
Here is the caller graph for this function:

◆ getNameFromText()

String org.turro.crm.zul.sale.SaleProspectCombobox.getNameFromText ( String  text)

Definition at line 74 of file SaleProspectCombobox.java.

74  {
75  String[] s = text.split(Chars.forward().regexp().spaced().toString());
76  if(s.length > 1) {
77  return s[1];
78  } else if(s.length > 0) {
79  return s[0];
80  }
81  return null;
82  }
Here is the caller graph for this function:

◆ getTextFromObject()

String org.turro.crm.zul.sale.SaleProspectCombobox.getTextFromObject ( SaleProspect  value)

Definition at line 58 of file SaleProspectCombobox.java.

58  {
59  return Strings.truncateAndWarn(value.getDescription(), 50) +
60  Chars.forward().spaced().toString() +
61  value.getCustomer().getName() +
62  Chars.forward().spaced().toString() +
63  value.getId();
64  }
Here is the call graph for this function:

◆ populateList()

void org.turro.crm.zul.sale.SaleProspectCombobox.populateList ( String  value,
LinkedList  list,
int  nRows 
)

Reimplemented from org.turro.zkoss.input.GenericCombobox< V >.

Definition at line 36 of file SaleProspectCombobox.java.

36  {
37  WhereClause wc = new WhereClause();
38  wc.addClause("select distinct sp from SaleProspect as sp");
39  wc.addClause("where 1=1");
40  long id = getIdFromText(value);
41  if(id > 0) {
42  wc.addClause("and sp.id = :id");
43  wc.addNamedValue("id", id);
44  }
45  if(!Strings.isBlank(value)) {
46  wc.addClause("and (");
47  wc.setPrefix("");
48  wc.addLikeFields(new String[] {"sp.description"}, getDescriptionFromText(value));
49  wc.setPrefix("or");
50  wc.addLikeFields(new String[] {"sp.customer.name"}, getNameFromText(value));
51  wc.setPrefix(null);
52  wc.addClause(")");
53  }
54  list.addAll(new CrmPU().getResultList(wc, nRows));
55  }
Here is the call graph for this function:

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