18 package org.turro.dossier.zul.issue;
20 import org.turro.string.Strings;
21 import org.turro.action.Contacts;
22 import org.turro.attach.db.AttachPU;
23 import org.turro.attach.entity.Attachment;
24 import org.turro.attach.zul.PreviewButton;
25 import org.turro.contacts.CommentIt;
26 import org.turro.contacts.StarIt;
27 import org.turro.contacts.VoteIt;
28 import org.turro.contacts.db.ContactsPU;
29 import org.turro.dossier.db.DossierPU;
30 import org.turro.dossier.entity.Issue;
31 import org.turro.dossier.entity.IssueComment;
32 import org.turro.dossier.entity.IssuePredecessor;
33 import org.turro.elephant.context.Application;
34 import org.turro.elephant.util.DateFormats;
35 import org.turro.elephant.util.Images;
36 import org.turro.elephant.util.Messages;
37 import org.turro.i18n.I_;
38 import org.turro.jpa.DaoTransaction;
39 import org.turro.plugin.contacts.IContact;
40 import org.turro.zkoss.label.LabelExtended;
41 import org.turro.zkoss.label.Labels;
42 import org.turro.zul.frame.Framework;
43 import org.zkoss.zk.ui.event.Event;
44 import org.zkoss.zk.ui.event.EventListener;
45 import org.zkoss.zk.ui.event.Events;
46 import org.zkoss.zul.Filedownload;
47 import org.zkoss.zul.Hbox;
48 import org.zkoss.zul.Hlayout;
49 import org.zkoss.zul.Image;
50 import org.zkoss.zul.Label;
51 import org.zkoss.zul.Row;
52 import org.zkoss.zul.Space;
53 import org.zkoss.zul.Vlayout;
61 private final Issue issue;
69 super.setValue(value);
76 Vlayout vbox =
new Vlayout();
80 label.setSclass(
"participant");
81 vbox.appendChild(label);
84 label.setSclass(
"modification");
85 vbox.appendChild(label);
91 lext.setSclass(
"comment");
95 vbox.appendChild(lext);
97 Hbox hbox =
new Hbox();
98 hbox.setSclass(
"values");
99 boolean hasValues =
false;
102 label =
new Label(
I_.
get(
"Expenses"));
103 label.setSclass(
"caption");
104 hbox.appendChild(label);
106 label.setSclass(
"value");
107 hbox.appendChild(label);
112 label =
new Label(
I_.
get(
"Hours"));
113 label.setSclass(
"caption");
114 hbox.appendChild(label);
115 label =
new Label(ic.
getHours() +
"");
116 label.setSclass(
"value");
117 hbox.appendChild(label);
122 label =
new Label(
I_.
get(
"Price"));
123 label.setSclass(
"caption");
124 hbox.appendChild(label);
125 label =
new Label(ic.
getPrice() +
"");
126 label.setSclass(
"value");
127 hbox.appendChild(label);
132 vbox.appendChild(hbox);
136 Image img =
new Image(
"/_zul/images/edit-delete.png");
137 img.setStyle(
"cursor:pointer");
138 img.addEventListener(Events.ON_CLICK,
new EventListener() {
140 public void onEvent(Event event)
throws Exception {
154 Vlayout vbox =
new Vlayout();
158 label.setSclass(
"modification");
159 vbox.appendChild(label);
161 vbox =
new Vlayout();
164 Hlayout hbox =
new Hlayout();
168 vbox.appendChild(hbox);
172 Vlayout vbox =
new Vlayout();
178 Label label =
new Label(contact !=
null ? contact.
getName() : attachment.
getOwner());
179 label.setSclass(
"participant");
180 vbox.appendChild(label);
183 label.setSclass(
"modification");
184 vbox.appendChild(label);
186 vbox =
new Vlayout();
189 Hlayout hbox =
new Hlayout();
191 label.setSclass(
"attachment");
192 label.setStyle(
"cursor:pointer");
193 label.addEventListener(Events.ON_CLICK,
new EventListener() {
195 public void onEvent(Event event)
throws Exception {
196 doDownload(attachment);
199 hbox.appendChild(label);
201 hbox.appendChild(ap);
202 vbox.appendChild(hbox);
208 vbox.appendChild(lext);
212 hbox =
new Hlayout();
213 hbox.appendChild(
new Image(
"/_zul/images/locked.png"));
214 hbox.appendChild(
new Label(String.format(
I_.
format(
"Locked by %s", contact.
getName()))));
215 vbox.appendChild(hbox);
217 Image img =
new Image(
"/_zul/images/edit-delete.png");
218 img.setStyle(
"cursor:pointer");
219 img.addEventListener(Events.ON_CLICK,
new EventListener() {
221 public void onEvent(Event event)
throws Exception {
230 appendChild(
new Space());
235 Vlayout vbox =
new Vlayout();
238 Hlayout hbox =
new Hlayout();
239 Label label =
new Label(commentIt.
getName());
240 label.setSclass(
"participant");
241 hbox.appendChild(label);
243 vbox.appendChild(hbox);
245 label =
new Label(commentIt.
getEmail());
246 label.setSclass(
"participant");
247 vbox.appendChild(label);
251 label.setSclass(
"modification");
252 vbox.appendChild(label);
254 vbox =
new Vlayout();
258 lext.setSclass(
"comment");
262 vbox.appendChild(lext);
265 Image img =
new Image(
"/_zul/images/edit-delete.png");
266 img.setStyle(
"cursor:pointer");
267 img.addEventListener(Events.ON_CLICK,
new EventListener() {
269 public void onEvent(Event event)
throws Exception {
278 appendChild(
new Space());
280 }
else if(value instanceof
VoteIt) {
283 Vlayout vbox =
new Vlayout();
286 Hlayout hbox =
new Hlayout();
288 label.setSclass(
"participant");
289 hbox.appendChild(label);
291 vbox.appendChild(hbox);
294 label.setSclass(
"modification");
295 vbox.appendChild(label);
297 vbox =
new Vlayout();
301 label.setSclass(
"comment");
302 label.setValue(voteIt.
getVote() +
" " +
I_.
get(
"Votes"));
303 vbox.appendChild(label);
306 Image img =
new Image(
"/_zul/images/edit-delete.png");
307 img.setStyle(
"cursor:pointer");
308 img.addEventListener(Events.ON_CLICK,
new EventListener() {
310 public void onEvent(Event event)
throws Exception {
319 appendChild(
new Space());
321 }
else if(value instanceof
StarIt) {
324 Vlayout vbox =
new Vlayout();
327 Hlayout hbox =
new Hlayout();
328 Label label =
new Label(starIt.
getName());
329 label.setSclass(
"participant");
330 hbox.appendChild(label);
332 vbox.appendChild(hbox);
335 label.setSclass(
"modification");
336 vbox.appendChild(label);
338 vbox =
new Vlayout();
342 label.setSclass(
"comment");
344 vbox.appendChild(label);
347 Image img =
new Image(
"/_zul/images/edit-delete.png");
348 img.setStyle(
"cursor:pointer");
349 img.addEventListener(Events.ON_CLICK,
new EventListener() {
351 public void onEvent(Event event)
throws Exception {
360 appendChild(
new Space());
365 private void doDownload(
Attachment attachment) {
367 attachment = transaction.saveObject(attachment);
AttachContent getAttachContent()
String getFileContentType()
Issue getCounterFor(Issue issue)
String getDescriptionFor(Issue issue)
Set< IssueComment > getComments()
void setValue(Object value)
IssueDetailRow(Issue issue)
boolean isInRole(String role)
static Application getApplication()
static String getImage(String image)
static Messages confirmDeletion()
static String format(String msg, Object... arguments)
static String get(String msg)
void deleteObject(Object obj)
LabelExtended setWordWrap(int wordWrap)
void setValue(String value)
static Labels text(String text)
static Framework getCurrent()
void invalidateSelected()