18 package org.turro.dossier.zul.issue;
20 import org.turro.dossier.entity.Issue;
21 import org.turro.dossier.entity.IssueStatus;
22 import org.turro.dossier.entity.IssueType;
23 import org.turro.dossier.issue.IssueWrapper;
24 import org.turro.dossier.zul.attach.IssueAttachTree;
25 import org.turro.dossier.zul.dossier.DossierLabel;
26 import org.turro.elephant.context.Application;
27 import org.turro.elephant.util.Messages;
28 import org.turro.i18n.I_;
29 import org.turro.log.SystemLogType;
30 import org.turro.log.SystemLogger;
31 import org.turro.registry.Changes;
32 import org.turro.zkoss.dialog.SelectionDialog;
33 import org.turro.zkoss.label.LabelExtended;
34 import org.turro.zkoss.label.LabelTypes;
35 import org.turro.zul.frame.Framework;
36 import org.zkoss.lang.Strings;
37 import org.zkoss.zk.ui.event.Event;
38 import org.zkoss.zk.ui.event.EventListener;
39 import org.zkoss.zk.ui.event.Events;
40 import org.zkoss.zul.*;
50 super.setValue(value);
54 Hlayout hbox =
new Hlayout();
58 hbox.appendChild(img);
60 hbox.appendChild(label);
62 Vlayout vbox =
new Vlayout();
66 hbox.setSclass(
"z-valign-middle");
67 hbox.setValign(
"middle");
68 vbox.appendChild(hbox);
71 if(!Strings.isBlank(img.getSrc())) {
72 hbox.appendChild(img);
75 if(!Strings.isBlank(img.getSrc())) {
76 hbox.appendChild(img);
85 hbox.appendChild(
new Space());
88 protected void refreshBase() {
89 IssueRow.this.getChildren().clear();
90 IssueRow.this.setValue(wissue);
94 if(wissue.getIssue().getDossier() !=
null) {
96 dl.setSclass(
"softLabel");
100 if(IssueType.TYPE_DOCUMENT.equals(wissue.getIssue().getType())) {
102 Toolbarbutton a =
new Toolbarbutton(I_.get(
"Attachments"),
"/_zul/images/clip.png");
103 a.addEventListener(Events.ON_CLICK,
new EventListener() {
105 public void onEvent(Event event)
throws Exception {
106 IssueAttachTree iat =
new IssueAttachTree();
107 iat.setEntity(wissue.getIssue());
108 iat.setChanges(
new Changes());
109 SelectionDialog.showComponent(getPage(), I_.get(
"Attachments"),
110 iat,
"80%",
"80%",
null);
121 if(!wissue.canStartBySources()) {
122 for(String s : wissue.getWaitingReason()) {
123 lext =
new LabelExtended();
124 lext.setStyle(
"color:#444;font-size:11px;");
126 lext.setMaxChars(70);
127 lext.setShowTooltip(
true);
128 vbox.appendChild(lext);
132 lext =
new LabelExtended();
133 lext.setDate(wissue.getIssue().getIssueDate());
136 lext =
new LabelExtended();
137 lext.setDate(wissue.getIssue().getStartDate());
140 lext =
new LabelExtended();
141 lext.setDate(wissue.getIssue().getDelivery());
144 lext =
new LabelExtended();
145 lext.setDate(wissue.getIssue().getControlDate());
148 vbox =
new Vlayout();
151 lext =
new LabelExtended();
152 lext.setStyle(
"color:navy");
153 lext.setResourceValue(wissue.getIssue().getType().toString());
154 vbox.appendChild(lext);
156 lext =
new LabelExtended();
157 lext.setResourceValue(wissue.getIssue().getStatus().toString());
158 vbox.appendChild(lext);
160 if(wissue.getIssue().getStatus().isFinished()) {
161 lext =
new LabelExtended();
162 lext.setStyle(
"color:gray");
163 lext.setResourceValue(wissue.getIssue().getResolution().toString());
164 vbox.appendChild(lext);
167 if(Application.getApplication().isInRole(
"issue:delete")) {
168 img =
new Image(
"/_zul/images/edit-delete.png");
169 img.setStyle(
"cursor:pointer");
170 img.addEventListener(Events.ON_CLICK,
new EventListener() {
172 public void onEvent(Event event)
throws Exception {
173 Messages.confirmDeletion().show(() -> {
174 SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, wissue.getIssue(),
"deleted",
175 wissue.getIssue().getId() +
" - " + wissue.getIssue().getDescription());
177 Framework.getCurrent().invalidateSelected();
185 if(value instanceof IssueWrapper) {
186 Issue i = ((IssueWrapper) value).getIssue();
187 if(i.getStatus() == IssueStatus.STATUS_NEW) {
188 setStyle(
"background-color: #f5eeee");
189 }
else if(i.getStatus() == IssueStatus.STATUS_INCOMPLETE) {
190 setStyle(
"background-color: #f8eeee");
191 }
else if(i.getStatus() == IssueStatus.STATUS_STARTED) {
192 setStyle(
"background-color: #fffff0");
193 }
else if(i.getStatus() == IssueStatus.STATUS_REOPENED) {
194 setStyle(
"background-color: #f0f9e0");
195 }
else if(i.getStatus() == IssueStatus.STATUS_RESOLVED) {
196 setStyle(
"background-color: #e0f5ee");
197 }
else if(i.getStatus() == IssueStatus.STATUS_FROZEN) {
198 setStyle(
"background-color: #a0f5f5");
199 }
else if(i.getStatus() == IssueStatus.STATUS_REUNION) {
200 setStyle(
"background-color: #e5e5a0");
201 }
else if(i.getStatus() == IssueStatus.STATUS_CLOSED) {
202 setStyle(
"background-color: #ffffff");
String getVersionString()
DossierVersion getVersion()
String getPriorityImage()
void setValue(Object value)
static Label getTinyLabel(String value)