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

Public Member Functions

 AddressNameComboModel (Object[] data)
 
 AddressNameComboModel (List data)
 
Object getElementAt (int index)
 
int getSize ()
 
void sort (Comparator cmpr, boolean ascending)
 
String getSortDirection (Comparator< String > 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 36 of file AddressNameComboModel.java.

Constructor & Destructor Documentation

◆ AddressNameComboModel() [1/2]

org.turro.contacts.zul.contact.AddressNameComboModel.AddressNameComboModel ( Object[]  data)

Definition at line 42 of file AddressNameComboModel.java.

42  {
43  this.data = data;
44  }
Here is the caller graph for this function:

◆ AddressNameComboModel() [2/2]

org.turro.contacts.zul.contact.AddressNameComboModel.AddressNameComboModel ( List  data)

Definition at line 46 of file AddressNameComboModel.java.

46  {
47  this.data = data.toArray(new Object[data.size()]);
48  }

Member Function Documentation

◆ getElementAt()

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

Definition at line 51 of file AddressNameComboModel.java.

51  {
52  if(data == null || data.length <= index) return null;
53  return data[index];
54  }

◆ getSize()

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

Definition at line 57 of file AddressNameComboModel.java.

57  {
58  return data.length;
59  }

◆ getSortDirection()

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

Definition at line 68 of file AddressNameComboModel.java.

68  {
69  return "natural";
70  }

◆ getSubModel()

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

Definition at line 73 of file AddressNameComboModel.java.

73  {
74  Dao dao = new ContactsPU();
75  WhereClause wc = new WhereClause();
76  wc.addClause("select distinct address.description");
77  wc.addClause("from Address as address");
78  wc.addClause("where 1=1");
79  wc.addLikeFields(new String[]{ "address.description" }, value.toString());
80  wc.addClause("order by address.description");
81  if(nRows < 1) nRows = 10;
82  return new AddressNameComboModel(dao.getResultList(wc, nRows));
83  }
Here is the call graph for this function:

◆ sort()

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

Definition at line 62 of file AddressNameComboModel.java.

62  {
63  Arrays.sort(data, cmpr);
64  fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
65  }

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