18 package org.turro.scheduler.zul;
20 import java.text.DateFormat;
21 import java.util.Date;
22 import org.turro.elephant.context.Application;
23 import org.turro.elephant.util.Messages;
24 import org.turro.i18n.I_;
25 import org.turro.scheduler.motor.Motor;
26 import org.turro.scheduler.motor.ScheduledTask;
27 import org.turro.zkoss.dialog.Windows;
28 import org.turro.zkoss.label.LabelExtended;
29 import org.turro.zul.frame.Framework;
30 import org.zkoss.zk.ui.event.Event;
31 import org.zkoss.zk.ui.event.EventListener;
32 import org.zkoss.zk.ui.event.Events;
33 import org.zkoss.zul.Image;
34 import org.zkoss.zul.Label;
35 import org.zkoss.zul.Row;
44 private final DateFormat df = DateFormat.getDateInstance();
48 super.setValue(value);
52 Label label =
new Label();
53 label.setValue(scheduledTask.
getName());
55 label.setStyle(
"cursor:pointer");
56 label.addEventListener(Events.ON_CLICK,
new EventListener() {
58 public void onEvent(Event event)
throws Exception {
71 appendChild(
new Label(Boolean.toString(scheduledTask.
isActive())));
73 appendChild(
new Label(formatDate(scheduledTask.
getStartDate())));
75 appendChild(
new Label(formatDate(scheduledTask.
getEndDate())));
78 Image img =
new Image(
"/_zul/images/edit-delete.png");
79 img.setStyle(
"cursor:pointer");
80 img.addEventListener(Events.ON_CLICK,
new EventListener() {
82 public void onEvent(Event event)
throws Exception {
94 private void doEdit() throws InterruptedException {
97 .addComponent(
new TaskEdit(scheduledTask))
99 .
onClose((windows) -> reloadCells())
103 private String formatDate(Date value) {
104 return (value ==
null ?
"" : df.format(value));
107 private void reloadCells() {
108 getChildren().clear();
boolean isInRole(String role)
static Application getApplication()
static Messages confirmDeletion()
static String get(String msg)
static Motor getInstance()
void setValue(Object value)
static Windows title(String title)
Windows onClose(Consumer< Windows > onClose)
LabelExtended setShowTooltip(boolean showTooltip)
void setValue(String value)
LabelExtended setMaxChars(int maxChars)
static Framework getCurrent()