18 package org.turro.contacts.zul.contact;
20 import java.util.Arrays;
21 import java.util.Comparator;
22 import java.util.List;
23 import org.turro.contacts.db.ContactsPU;
24 import org.turro.elephant.db.WhereClause;
25 import org.turro.jpa.Dao;
26 import org.zkoss.zul.AbstractListModel;
27 import org.zkoss.zul.ListModel;
28 import org.zkoss.zul.ListSubModel;
29 import org.zkoss.zul.event.ListDataEvent;
30 import org.zkoss.zul.ext.Sortable;
36 public class ConnectorNameComboModel extends AbstractListModel implements Sortable<String>, ListSubModel, java.io.Serializable {
38 private static final long serialVersionUID = 20081029L;
40 private Object[] data;
47 this.data = data.toArray(
new Object[data.size()]);
52 if(data ==
null || data.length <= index)
return null;
62 public void sort(Comparator cmpr,
boolean ascending) {
63 Arrays.sort(data, cmpr);
64 fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
76 wc.
addClause(
"select distinct connector.description");
77 wc.
addClause(
"from Connector as connector");
79 wc.
addLikeFields(
new String[]{
"connector.description" }, value.toString());
80 wc.
addClause(
"order by connector.description");
81 if(nRows < 1) nRows = 10;
void addClause(String clause)
void addLikeFields(String[] fields, String value)