18 package org.turro.dossier.zul.dossier;
20 import java.util.HashSet;
22 import org.turro.dossier.entity.ParticipantRole;
23 import org.turro.elephant.context.Application;
24 import org.turro.i18n.I_;
25 import org.zkoss.lang.Strings;
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.event.SelectEvent_506;
30 import org.zkoss.zul.Bandbox;
31 import org.zkoss.zul.Bandpopup;
32 import org.zkoss.zul.Listbox;
33 import org.zkoss.zul.Listitem;
41 private Set<ParticipantRole> roleSet =
new HashSet<ParticipantRole>();
54 this.roleSet = roleSet;
59 private void addPopup() {
60 Bandpopup popup =
new Bandpopup();
64 role.setWidth(
"100%");
65 role.setMultiple(
true);
66 role.setCheckmark(
true);
67 role.addEventListener(Events.ON_SELECT,
new EventListener() {
69 public void onEvent(Event event)
throws Exception {
74 roleSet.remove((ParticipantRole) li.getValue());
79 popup.appendChild(role);
81 for(ParticipantRole ipr : ParticipantRole.values()) {
82 Listitem li =
new Listitem(I_.byKey(ipr.toString()));
84 if(ipr.equals(ParticipantRole.PARTICIPANT_SUBJECT)) {
85 if(Application.getApplication().isInRole(
"dossier:all")) {
94 private void updateCheckMarks() {
95 for(Object obj : role.getChildren()) {
96 if(obj instanceof Listitem) {
97 Listitem li = (Listitem) obj;
98 li.setSelected(roleSet.contains(li.getValue()));
103 private void updateText() {
105 for(Object obj : role.getChildren()) {
106 if(obj instanceof Listitem) {
107 Listitem li = (Listitem) obj;
108 newText += (Strings.isEmpty(newText) ?
"" :
",") +
109 (li.isSelected() ? I_.byKey(li.getValue().toString()) :
"");
void setRoleSet(Set< ParticipantRole > roleSet)
Set< ParticipantRole > getRoleSet()