19 package org.turro.elephant.util;
21 import org.turro.string.Phrases;
22 import org.turro.i18n.I_;
23 import org.zkoss.zk.ui.event.Event;
24 import org.zkoss.zul.Messagebox;
33 Messagebox.show(phrases.newLine(
"\n").toString(), title,
34 Messagebox.OK, type, 0,
null);
37 public void show(Runnable onOk) {
38 Messagebox.show(phrases.newLine(
"\n").toString(), title,
39 Messagebox.OK | Messagebox.CANCEL, type, (Event event) -> {
40 switch ((Integer) event.getData()) {
41 case Messagebox.OK -> onOk.run();
48 private final Phrases phrases = Phrases.start();
56 phrases.
add(word, withSpace);
61 phrases.
add(word, enclose);
65 public Messages add(String value, String enclose,
boolean withSpace) {
66 phrases.
add(value, enclose, withSpace);
71 phrases.
format(word, args);
88 return question().
add(
I_.
get(
"Confirm element deletion")).
line();
92 return question().
add(
I_.
get(
"Confirm element cut")).
line();
100 return question().
add(
I_.
get(
"Confirm element move")).
line();
104 return question().
add(
I_.
get(
"Confirm acceptation")).
line();
108 return info(
I_.
get(
"Information"));
112 return new Messages(Messagebox.INFORMATION, title);
116 return question(
I_.
get(
"Question"));
120 return new Messages(Messagebox.QUESTION, title);
124 return error(
I_.
get(
"Error"));
128 return new Messages(Messagebox.ERROR, title);
131 private final String type, title;
133 private Messages(String type, String title) {
Messages add(String word, boolean withSpace)
static Messages error(String title)
static Messages confirmCutting()
Messages add(String word, String enclose)
static Messages question(String title)
Messages add(String value, String enclose, boolean withSpace)
Messages format(String word, Object... args)
static Messages info(String title)
static Messages question()
static Messages confirmDeletion()
static Messages confirmProcess()
static Messages confirmMove()
static Messages confirmAcceptation()
Messages add(String word)
static String get(String msg)