69 super.setValue(value);
73 if(value instanceof IssueComment) {
74 final IssueComment ic = (IssueComment) value;
76 Vlayout vbox =
new Vlayout();
79 Label label =
new Label(ic.getParticipantName());
80 label.setSclass(
"participant");
81 vbox.appendChild(label);
83 label =
new Label(DateFormats.format(ic.getModification(),
false));
84 label.setSclass(
"modification");
85 vbox.appendChild(label);
90 LabelExtended lext =
new LabelExtended();
91 lext.setSclass(
"comment");
94 lext.setValue(ic.getComment());
95 vbox.appendChild(lext);
97 Hbox hbox =
new Hbox();
98 hbox.setSclass(
"values");
99 boolean hasValues =
false;
101 if(ic.getExpenses() != 0) {
102 label =
new Label(I_.get(
"Expenses"));
103 label.setSclass(
"caption");
104 hbox.appendChild(label);
105 label =
new Label(ic.getExpenses() +
"");
106 label.setSclass(
"value");
107 hbox.appendChild(label);
111 if(ic.getHours() != 0) {
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);
121 if(ic.getPrice() != 0) {
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);
135 if(Application.getApplication().isInRole(
"issue:delete")) {
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 {
141 Messages.confirmDeletion().show(() -> {
142 Issue issue = ic.getIssue();
144 new DossierPU().saveObject(issue);
145 Framework.getCurrent().invalidateSelected();
151 }
else if(value instanceof IssuePredecessor) {
152 final IssuePredecessor predecessor = (IssuePredecessor) value;
154 Vlayout vbox =
new Vlayout();
157 Label label =
new Label(DateFormats.format(predecessor.getCreation(),
false));
158 label.setSclass(
"modification");
159 vbox.appendChild(label);
161 vbox =
new Vlayout();
164 Hlayout hbox =
new Hlayout();
165 hbox.appendChild(Labels.text(
"#" + predecessor.getCounterFor(issue).getId()).get());
166 hbox.appendChild(Labels.text(predecessor.getCounterFor(issue).getDescription()).get());
167 hbox.appendChild(Labels.text(predecessor.getDescriptionFor(issue)).get());
168 vbox.appendChild(hbox);
169 }
else if(value instanceof Attachment) {
170 final Attachment attachment = (Attachment) value;
172 Vlayout vbox =
new Vlayout();
175 IContact contact = Contacts.getEmpty();
176 contact.loadByLogin(attachment.getOwner());
178 Label label =
new Label(contact !=
null ? contact.getName() : attachment.getOwner());
179 label.setSclass(
"participant");
180 vbox.appendChild(label);
182 label =
new Label(DateFormats.format(attachment.getModification(),
false));
183 label.setSclass(
"modification");
184 vbox.appendChild(label);
186 vbox =
new Vlayout();
189 Hlayout hbox =
new Hlayout();
190 label =
new Label(attachment.getFileName());
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);
200 PreviewButton ap =
new PreviewButton(attachment);
201 hbox.appendChild(ap);
202 vbox.appendChild(hbox);
204 LabelExtended lext =
new LabelExtended();
205 lext.setWordWrap(80);
207 lext.setValue(attachment.getComment());
208 vbox.appendChild(lext);
210 if(attachment.isLocked()) {
211 contact.loadById(attachment.getLocker());
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);
216 }
else if(Application.getApplication().isInRole(
"attach:delete")) {
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 {
222 Messages.confirmDeletion().show(() -> {
223 new AttachPU().deleteObject(attachment);
224 Framework.getCurrent().invalidateSelected();
230 appendChild(
new Space());
232 }
else if(value instanceof CommentIt) {
233 final CommentIt commentIt = (CommentIt) value;
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);
242 hbox.appendChild(
new Image(Images.getImage(
"published")));
243 vbox.appendChild(hbox);
244 if(commentIt.getCreator() ==
null && !Strings.isBlank(commentIt.getEmail())) {
245 label =
new Label(commentIt.getEmail());
246 label.setSclass(
"participant");
247 vbox.appendChild(label);
250 label =
new Label(DateFormats.format(commentIt.getDateCreation(),
false));
251 label.setSclass(
"modification");
252 vbox.appendChild(label);
254 vbox =
new Vlayout();
257 LabelExtended lext =
new LabelExtended();
258 lext.setSclass(
"comment");
259 lext.setWordWrap(80);
261 lext.setValue(commentIt.getBody());
262 vbox.appendChild(lext);
264 if(Application.getApplication().isInRole(
"issue:delete")) {
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 {
270 Messages.confirmDeletion().show(() -> {
271 new ContactsPU().deleteObject(commentIt);
272 Framework.getCurrent().invalidateSelected();
278 appendChild(
new Space());
280 }
else if(value instanceof VoteIt) {
281 final VoteIt voteIt = (VoteIt) value;
283 Vlayout vbox =
new Vlayout();
286 Hlayout hbox =
new Hlayout();
287 Label label =
new Label(voteIt.getCreator().getName());
288 label.setSclass(
"participant");
289 hbox.appendChild(label);
290 hbox.appendChild(
new Image(Images.getImage(
"published")));
291 vbox.appendChild(hbox);
293 label =
new Label(DateFormats.format(voteIt.getDateCreation(),
false));
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);
305 if(Application.getApplication().isInRole(
"issue:delete")) {
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 {
311 Messages.confirmDeletion().show(() -> {
312 new ContactsPU().deleteObject(voteIt);
313 Framework.getCurrent().invalidateSelected();
319 appendChild(
new Space());
321 }
else if(value instanceof StarIt) {
322 final StarIt starIt = (StarIt) value;
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);
331 hbox.appendChild(
new Image(Images.getImage(
"published")));
332 vbox.appendChild(hbox);
334 label =
new Label(DateFormats.format(starIt.getDateCreation(),
false));
335 label.setSclass(
"modification");
336 vbox.appendChild(label);
338 vbox =
new Vlayout();
342 label.setSclass(
"comment");
343 label.setValue(starIt.getStars() +
" " + I_.get(
"Stars"));
344 vbox.appendChild(label);
346 if(Application.getApplication().isInRole(
"issue:delete")) {
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 {
352 Messages.confirmDeletion().show(() -> {
353 new ContactsPU().deleteObject(starIt);
354 Framework.getCurrent().invalidateSelected();
360 appendChild(
new Space());
Set< IssueComment > getComments()