18 package org.turro.dossier.zul.dossier;
20 import java.util.Iterator;
21 import org.turro.command.Command;
22 import org.turro.command.Context;
23 import org.turro.contacts.Contact;
24 import org.turro.contacts.zul.label.ContactInfo;
25 import org.turro.dossier.entity.CategoryParticipant;
26 import org.turro.dossier.entity.Dossier;
27 import org.turro.dossier.entity.IDossierParticipant;
28 import org.turro.dossier.entity.Participant;
29 import org.turro.i18n.I_;
30 import org.turro.zkoss.dialog.SelectionDialog;
31 import org.turro.zkoss.grid.PagingGrid;
32 import org.zkoss.zk.ui.event.Event;
33 import org.zkoss.zk.ui.event.EventListener;
34 import org.zkoss.zk.ui.event.Events;
35 import org.zkoss.zul.Column;
36 import org.zkoss.zul.Columns;
37 import org.zkoss.zul.Hlayout;
38 import org.zkoss.zul.Image;
39 import org.zkoss.zul.Label;
40 import org.zkoss.zul.Row;
41 import org.zkoss.zul.Rows;
42 import org.zkoss.zul.Toolbarbutton;
51 private final Rows rows;
52 private Toolbarbutton editButton;
63 dpg.setSclass(
"grid-header-wrap");
67 dpg,
"900px",
"500px",
new Command() {
69 public Object execute(Context context) {
72 Events.postEvent(
new Event(Events.ON_CHANGE));
80 this.dossier = dossier;
81 rows.getChildren().clear();
93 private void addColumns() {
94 Columns cols =
new Columns();
95 cols.setSizable(
true);
96 cols.setMenupopup(
"auto");
99 Column col =
new Column(
I_.
get(
"Name"));
100 cols.appendChild(col);
102 col =
new Column(
I_.
get(
"Role"));
103 col.setWidth(
"100px");
104 cols.appendChild(col);
106 col =
new Column(
I_.
get(
"Discriminator"));
107 col.setWidth(
"110px");
108 cols.appendChild(col);
116 rows.appendChild(row);
118 Hlayout hbox =
new Hlayout();
119 row.appendChild(hbox);
121 hbox.appendChild(
new Image(
"/_zul/images/forward.png"));
123 if(p.isShowAllAttachments()) {
124 hbox.appendChild(
new Image(
"/_zul/images/clip.png"));
126 if(p.isShowAllIssues()) {
127 hbox.appendChild(
new Image(
"/_zul/images/issue.png"));
129 if(p.isReceiveAllEmails()) {
130 hbox.appendChild(
new Image(
"/_zul/images/mail_forward.png"));
132 if(p.isShowParticipants()) {
133 hbox.appendChild(
new Image(
"/_zul/images/contacts.png"));
135 if(p.isBindingVote()) {
136 hbox.appendChild(
new Image(
"/_zul/images/accepted.png"));
139 hbox.appendChild(
new Image(
"/_zul/images/driver.png"));
141 if(p.isCoordinator()) {
142 hbox.appendChild(
new Image(
"/_zul/images/coordinator.png"));
144 if(p.isBeneficiary()) {
145 hbox.appendChild(
new Image(
"/_zul/images/beneficiary.png"));
148 hbox.appendChild(
new Image(
"/_zul/images/offerer.png"));
151 hbox.appendChild(
new Image(
"/_zul/images/research.png"));
154 hbox.appendChild(
new Image(
"/_zul/images/funding.png"));
157 hbox.appendChild(
new Image(
"/_zul/images/support.png"));
159 if(p.isConsortium()) {
160 hbox.appendChild(
new Image(
"/_zul/images/consortium.png"));
163 hbox.appendChild(
new Image(
"/_zul/images/admin.png"));
167 Label label =
new Label(
I_.
byKey(p.getRole().toString()));
168 row.appendChild(label);
169 label =
new Label(p.getDiscriminator());
170 row.appendChild(label);
175 private void addToolbarButtons() {
176 editButton =
new Toolbarbutton(
177 I_.
get(
"Edit participants"),
178 "/_zul/images/edit.png"
180 editButton.addEventListener(Events.ON_CLICK,
new EventListener() {
182 public void onEvent(Event event)
throws Exception {
187 getParent().appendChild(editButton);
190 private void doClean() {
192 while(it.hasNext()) {
193 Participant p = it.next();
197 p.setIContact(p.getIContact());
203 private boolean isEmpty(IDossierParticipant p) {
204 if(p instanceof CategoryParticipant) {
205 return ((CategoryParticipant) p).isEmpty();
206 }
else if(p instanceof Participant) {
207 return ((Participant) p).isEmpty();
Set< Participant > getParticipants()
ParticipantSet< IDossierParticipant > getFullParticipants()
void setDossier(Dossier dossier)
void setAddToolbar(boolean addToolbar)
static String byKey(String key)
static String get(String msg)
static void showComponent(Page page, String title, Component component, String width, String height, final Command command)
void setAllowDeletions(boolean allowDeletions)
void setAllowInsertions(boolean allowInsertions)
void setRowCount(int rows)