BrightSide Workbench Full Report + Source Code
org.turro.contacts.zul.contact.FieldValueComboModel Class Reference
Inheritance diagram for org.turro.contacts.zul.contact.FieldValueComboModel:
Collaboration diagram for org.turro.contacts.zul.contact.FieldValueComboModel:

Public Member Functions

 FieldValueComboModel (Object[] data, FieldDef fieldDef)
 
 FieldValueComboModel (List data, FieldDef fieldDef)
 
Object getElementAt (int index)
 
int getSize ()
 
void sort (Comparator cmpr, boolean ascending)
 
String getSortDirection (Comparator< Object > cmpr)
 
ListModel getSubModel (Object value, int nRows)
 

Detailed Description

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

Definition at line 37 of file FieldValueComboModel.java.

Constructor & Destructor Documentation

◆ FieldValueComboModel() [1/2]

org.turro.contacts.zul.contact.FieldValueComboModel.FieldValueComboModel ( Object[]  data,
FieldDef  fieldDef 
)

Definition at line 44 of file FieldValueComboModel.java.

44  {
45  this.data = data;
46  this.fieldDef = fieldDef;
47  }
Here is the caller graph for this function:

◆ FieldValueComboModel() [2/2]

org.turro.contacts.zul.contact.FieldValueComboModel.FieldValueComboModel ( List  data,
FieldDef  fieldDef 
)

Definition at line 49 of file FieldValueComboModel.java.

49  {
50  this.data = data.toArray(new Object[data.size()]);
51  this.fieldDef = fieldDef;
52  }

Member Function Documentation

◆ getElementAt()

Object org.turro.contacts.zul.contact.FieldValueComboModel.getElementAt ( int  index)

Definition at line 55 of file FieldValueComboModel.java.

55  {
56  if(data == null || data.length <= index) return null;
57  return data[index];
58  }

◆ getSize()

int org.turro.contacts.zul.contact.FieldValueComboModel.getSize ( )

Definition at line 61 of file FieldValueComboModel.java.

61  {
62  return data.length;
63  }

◆ getSortDirection()

String org.turro.contacts.zul.contact.FieldValueComboModel.getSortDirection ( Comparator< Object >  cmpr)

Definition at line 72 of file FieldValueComboModel.java.

72  {
73  return "natural";
74  }

◆ getSubModel()

ListModel org.turro.contacts.zul.contact.FieldValueComboModel.getSubModel ( Object  value,
int  nRows 
)

Definition at line 77 of file FieldValueComboModel.java.

77  {
78  Dao dao = new ContactsPU();
79  WhereClause wc = new WhereClause();
80  wc.addClause("select distinct fieldValue.value");
81  wc.addClause("from FieldValue as fieldValue");
82  wc.addClause("where fieldValue.fieldDef = :fieldDef");
83  wc.addLikeFields(new String[] { "fieldValue.value" }, value.toString());
84  wc.addClause("order by fieldValue.value");
85  wc.addNamedValue("fieldDef", fieldDef);
86  if(nRows < 1) nRows = 10;
87  return new FieldValueComboModel(dao.getResultList(wc, nRows), fieldDef);
88  }
Here is the call graph for this function:

◆ sort()

void org.turro.contacts.zul.contact.FieldValueComboModel.sort ( Comparator  cmpr,
boolean  ascending 
)

Definition at line 66 of file FieldValueComboModel.java.

66  {
67  Arrays.sort(data, cmpr);
68  fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
69  }

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