18 package org.turro.contacts.zul.contact;
20 import java.util.Arrays;
21 import java.util.Comparator;
22 import java.util.List;
23 import java.util.stream.Collectors;
24 import org.turro.tags.Tags;
25 import org.zkoss.zul.AbstractListModel;
26 import org.zkoss.zul.ListModel;
27 import org.zkoss.zul.ListSubModel;
28 import org.zkoss.zul.event.ListDataEvent;
29 import org.zkoss.zul.ext.Sortable;
35 public class TagNameComboModel extends AbstractListModel implements Sortable<String>, ListSubModel, java.io.Serializable {
37 private static final long serialVersionUID = 20081029L;
39 private Object[] data;
46 this.data = data.toArray(
new Object[data.size()]);
51 if(data ==
null || data.length <= index)
return null;
61 public void sort(Comparator cmpr,
boolean ascending) {
62 Arrays.sort(data, cmpr);
63 fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
73 if(nRows < 1) nRows = 10;
75 .stream().map(t -> t.getTagName()).collect(Collectors.toList()));