19 package org.turro.contacts.util;
21 import java.util.Collection;
22 import org.turro.contacts.Contact;
23 import org.turro.contacts.zul.label.ContactInfo;
24 import org.turro.elephant.util.Images;
25 import org.turro.plugin.contacts.IContact;
26 import org.zkoss.zk.ui.event.Event;
27 import org.zkoss.zk.ui.event.EventListener;
28 import org.zkoss.zk.ui.event.Events;
29 import org.zkoss.zk.ui.ext.AfterCompose;
30 import org.zkoss.zul.A;
31 import org.zkoss.zul.Hlayout;
32 import org.zkoss.zul.Vlayout;
40 private Collection<String> attendees;
42 private boolean readOnly, allowExternals;
52 this.attendees = attendees;
56 this.provider = provider;
65 this.readOnly = readOnly;
69 this.allowExternals = allowExternals;
77 private void addAttendees() {
78 getChildren().clear();
79 if(attendees !=
null) {
80 for(
final String a : attendees) {
81 final Hlayout row =
new Hlayout();
85 del.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
87 public void onEvent(Event event) throws Exception {
90 Events.postEvent(new Event(Events.ON_CHANGE, AttendeesList.this, null));
99 Hlayout hbox =
new Hlayout();
100 hbox.setSclass(
"z-valign-middle");
101 hbox.setValign(
"middle");
102 if(provider !=
null) {
103 final ContactListbox cl =
new ContactListbox();
104 cl.setMold(
"select");
105 cl.setAllowNull(
true);
106 cl.setProvider((Contact) provider.
getContact());
107 cl.addEventListener(Events.ON_SELECT,
new EventListener<Event>() {
109 public void onEvent(Event event) throws Exception {
110 Contact c = cl.getObjectValue();
111 if(c != null) attendees.add(c.getId());
112 Events.postEvent(new Event(Events.ON_CHANGE, AttendeesList.this, null));
116 hbox.appendChild(cl);
119 final ContactCombobox cc =
new ContactCombobox();
120 cc.addEventListener(Events.ON_SELECT,
new EventListener<Event>() {
122 public void onEvent(Event event) throws Exception {
123 Contact c = cc.getContact();
124 if(c != null) attendees.add(c.getId());
125 Events.postEvent(new Event(Events.ON_CHANGE, AttendeesList.this, null));
129 hbox.appendChild(cc);
131 if(!hbox.getChildren().isEmpty()) {
static String getImage(String image)