18 package org.turro.dossier.zul.dossier;
20 import java.util.Iterator;
21 import org.turro.contacts.util.ContactCombobox;
22 import org.turro.dossier.entity.Category;
23 import org.turro.dossier.entity.CategoryParticipant;
24 import org.turro.dossier.entity.ParticipantRole;
25 import org.turro.i18n.I_;
26 import org.turro.plugin.contacts.IContact;
27 import org.zkoss.zk.ui.event.Event;
28 import org.zkoss.zk.ui.event.EventListener;
29 import org.zkoss.zk.ui.event.Events;
30 import org.zkoss.zul.Checkbox;
31 import org.zkoss.zul.Column;
32 import org.zkoss.zul.Columns;
33 import org.zkoss.zul.Grid;
34 import org.zkoss.zul.Listbox;
35 import org.zkoss.zul.Listitem;
36 import org.zkoss.zul.Row;
37 import org.zkoss.zul.Rows;
38 import org.zkoss.zul.Toolbar;
39 import org.zkoss.zul.Toolbarbutton;
40 import org.zkoss.zul.Vbox;
50 private Toolbar toolbar;
51 private Toolbarbutton addButton;
60 this.category = category;
62 if(category !=
null) {
69 toolbar =
new Toolbar();
70 getParent().appendChild(toolbar);
75 private void addColumns() {
76 Columns cols =
new Columns();
77 cols.setSizable(
true);
78 cols.setMenupopup(
"auto");
81 Column col =
new Column(
I_.
get(
"Name"));
82 cols.appendChild(col);
84 col =
new Column(
I_.
get(
"Role"));
85 cols.appendChild(col);
92 rows.appendChild(row);
94 Vbox vbox =
new Vbox();
95 vbox.setWidth(
"100%");
96 row.appendChild(vbox);
99 contact.
setRole(
"dossier:list");
101 contact.addEventListener(Events.ON_CHANGE,
new EventListener() {
103 public void onEvent(Event event)
throws Exception {
105 p.setIdContact(ci.
getId());
112 vbox.appendChild(contact);
114 final Checkbox cbAttach =
new Checkbox(
I_.
get(
"Show all attachments"));
115 cbAttach.setStyle(
"font-size:11px;color:#444;");
116 cbAttach.setChecked(p.isShowAllAttachments());
117 cbAttach.addEventListener(Events.ON_CHECK,
new EventListener() {
120 public void onEvent(Event event)
throws Exception {
121 p.setShowAllAttachments(cbAttach.isChecked());
125 vbox.appendChild(cbAttach);
127 final Checkbox cbIssues =
new Checkbox(
I_.
get(
"Show all issues"));
128 cbIssues.setStyle(
"font-size:11px;color:#444;");
129 cbIssues.setChecked(p.isShowAllIssues());
130 cbIssues.addEventListener(Events.ON_CHECK,
new EventListener() {
133 public void onEvent(Event event)
throws Exception {
134 p.setShowAllIssues(cbIssues.isChecked());
138 vbox.appendChild(cbIssues);
140 final Checkbox cbEmails =
new Checkbox(
I_.
get(
"Receive all emails"));
141 cbEmails.setStyle(
"font-size:11px;color:#444;");
142 cbEmails.setChecked(p.isReceiveAllEmails());
143 cbEmails.addEventListener(Events.ON_CHECK,
new EventListener() {
146 public void onEvent(Event event)
throws Exception {
147 p.setReceiveAllEmails(cbEmails.isChecked());
151 vbox.appendChild(cbEmails);
153 final Checkbox cbParticipants =
new Checkbox(
I_.
get(
"Show participants"));
154 cbParticipants.setStyle(
"font-size:11px;color:#444;");
155 cbParticipants.setChecked(p.isShowParticipants());
156 cbParticipants.addEventListener(Events.ON_CHECK,
new EventListener() {
159 public void onEvent(Event event)
throws Exception {
160 p.setShowParticipants(cbParticipants.isChecked());
164 vbox.appendChild(cbParticipants);
166 final Checkbox cbBinding =
new Checkbox(
I_.
get(
"Binding votes"));
167 cbBinding.setStyle(
"font-size:11px;color:#444;");
168 cbBinding.setChecked(p.isBindingVote());
169 cbBinding.addEventListener(Events.ON_CHECK,
new EventListener() {
172 public void onEvent(Event event)
throws Exception {
173 p.setBindingVote(cbBinding.isChecked());
177 vbox.appendChild(cbBinding);
179 final Listbox role =
new Listbox();
180 role.setMold(
"select");
181 role.addEventListener(Events.ON_SELECT,
new EventListener() {
184 public void onEvent(Event event)
throws Exception {
189 contact.
setRole(
"dossier:list");
194 row.appendChild(role);
197 Listitem li =
new Listitem(
I_.
byKey(pr.toString()));
199 li.setSelected(li.getValue().equals(p.getRole()));
200 role.appendChild(li);
206 private void addToolbarButtons() {
207 addButton =
new Toolbarbutton(
208 I_.
get(
"Add participant"),
209 "/_zul/images/new.png"
211 addButton.addEventListener(Events.ON_CLICK,
new EventListener() {
214 public void onEvent(Event event)
throws Exception {
223 toolbar.appendChild(addButton);
227 Iterator<CategoryParticipant> it = category.
getParticipants().iterator();
228 while(it.hasNext()) {
void setRole(ParticipantRole role)
void setCategory(Category category)
Set< Category > getChildren()
Set< CategoryParticipant > getParticipants()
void setCategory(Category category)
CategoryParticipantGrid2()
void setAddToolbar(boolean addToolbar)
static String byKey(String key)
static String get(String msg)