19 package org.turro.zul.convocation;
21 import java.util.Collection;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.collections.CollectionUtil;
25 import org.turro.command.Command;
26 import org.turro.command.Context;
27 import org.turro.contacts.Attendee;
28 import org.turro.contacts.Connector;
29 import org.turro.contacts.Contact;
30 import org.turro.contacts.Convocation;
31 import org.turro.contacts.filter.ContactFilter;
32 import org.turro.contacts.filter.ContactFilterGrid;
33 import org.turro.contacts.util.ContactListbox;
34 import org.turro.contacts.zul.label.ContactInfo;
35 import org.turro.elephant.security.IUser;
36 import org.turro.elephant.util.Images;
37 import org.turro.i18n.I_;
38 import org.turro.zkoss.filter.GenericFilterListbox;
39 import org.turro.zkoss.grid.DefaultRowRenderer;
40 import org.turro.zkoss.grid.PagingGrid;
41 import org.turro.zul.frame.Framework;
42 import org.zkoss.zk.ui.event.Event;
43 import org.zkoss.zk.ui.event.EventListener;
44 import org.zkoss.zk.ui.event.Events;
45 import org.zkoss.zul.Column;
46 import org.zkoss.zul.Columns;
47 import org.zkoss.zul.Group;
48 import org.zkoss.zul.Image;
49 import org.zkoss.zul.ListModelList;
50 import org.zkoss.zul.Row;
51 import org.zkoss.zul.Space;
52 import org.zkoss.zul.Toolbarbutton;
63 this.convocation = convocation;
71 Events.postEvent(
new Event(Events.ON_CHANGE));
78 Events.postEvent(
new Event(Events.ON_CHANGE));
86 contacts.
show(
I_.
get(
"Contacts"),
"800px",
"600px",
new Command() {
88 public Object execute(Context context) {
89 if(contacts !=
null) {
94 Events.postEvent(
new Event(Events.ON_CHANGE));
103 if(contacts !=
null) {
104 for(
Contact contact : contacts) {
106 if(email !=
null && !Strings.isBlank(email.
getValue())) {
119 private void addRows() {
120 getRows(
true).getChildren().clear();
122 if(convocation ==
null)
return;
126 protected void renderRow(
final Row row,
final Attendee value) {
132 row.appendChild(
new Space());
135 Toolbarbutton sendAttendee =
new Toolbarbutton();
136 sendAttendee.setImage(
"/_zul/images/mail_send.png");
137 sendAttendee.addEventListener(Events.ON_CLICK,
new EventListener() {
139 public void onEvent(Event event)
throws Exception {
140 Events.postEvent(
new Event(Events.ON_USER, AttendeesGrid.this, value));
143 row.appendChild(sendAttendee);
145 Toolbarbutton delAttendee =
new Toolbarbutton();
146 delAttendee.setImage(
"/_zul/images/edit-delete.png");
147 delAttendee.addEventListener(Events.ON_CLICK,
new EventListener() {
149 public void onEvent(Event event)
throws Exception {
150 CollectionUtil.from(convocation.
getAttendees()).remove(a -> a.getContact().getId(), value);
151 Events.postEvent(
new Event(Events.ON_CHANGE));
155 row.appendChild(delAttendee);
159 protected void renderGroup(Group group, Attendee value) {
165 setModel(
new ListModelList(list));
170 private void addColumns() {
172 cols.getChildren().clear();
174 cols.appendChild(
new Column(I_.get(
"Contact")));
175 cols.appendChild(
new Column(
null,
null,
"40px"));
176 cols.appendChild(
new Column(
null,
null,
"40px"));
177 cols.appendChild(
new Column(
null,
null,
"40px"));
static String getImage(String image)
static String get(String msg)
void show(String title, String width, String height, Command command)
Collection< E > getObjectValues()
Columns getColumns(boolean create)
Rows getRows(boolean create)
void setRowCount(int rows)
void setConvocation(Convocation convocation)
void addAttendeesByEntity(boolean deep)
void addContact(Contact contact)
static FrameClipboard getClipboard()
static final String CONNECTOR_EMAIL