18 package org.turro.dossier.zul.issue;
20 import java.util.HashSet;
22 import org.turro.dossier.entity.IssueResolution;
23 import org.turro.i18n.I_;
24 import org.zkoss.lang.Strings;
25 import org.zkoss.zk.ui.event.Event;
26 import org.zkoss.zk.ui.event.EventListener;
27 import org.zkoss.zk.ui.event.Events;
28 import org.zkoss.zk.ui.event.SelectEvent_506;
29 import org.zkoss.zul.Bandbox;
30 import org.zkoss.zul.Bandpopup;
31 import org.zkoss.zul.Listbox;
32 import org.zkoss.zul.Listitem;
40 private Set<IssueResolution> resolutionSet =
new HashSet<IssueResolution>();
41 private Listbox resolution;
53 this.resolutionSet = resolutionSet;
58 private void addPopup() {
59 Bandpopup popup =
new Bandpopup();
62 resolution =
new Listbox();
63 resolution.setWidth(
"100%");
64 resolution.setMultiple(
true);
65 resolution.setCheckmark(
true);
66 resolution.addEventListener(Events.ON_SELECT,
new EventListener() {
68 public void onEvent(Event event)
throws Exception {
73 resolutionSet.remove((IssueResolution) li.getValue());
78 popup.appendChild(resolution);
80 for(IssueResolution is : IssueResolution.values()) {
81 Listitem li =
new Listitem(I_.byKey(is.toString()));
83 resolution.appendChild(li);
87 private void updateCheckMarks() {
88 for(Object obj : resolution.getChildren()) {
89 if(obj instanceof Listitem) {
90 Listitem li = (Listitem) obj;
91 li.setSelected(resolutionSet.contains(li.getValue()));
97 private void updateText() {
99 for(Object obj : resolution.getChildren()) {
100 if(obj instanceof Listitem) {
101 Listitem li = (Listitem) obj;
102 newText += (Strings.isEmpty(newText) ?
"" :
",") +
103 (li.isSelected() ? I_.byKey(li.getValue().toString()) :
"");
Set< IssueResolution > getResolutionSet()
void setResolutionSet(Set< IssueResolution > resolutionSet)