18 package org.turro.zkoss.menu;
21 import org.turro.command.Command;
22 import org.turro.elephant.zkoss.Modal;
23 import org.turro.i18n.I_;
24 import org.turro.util.CompareUtil;
25 import org.turro.zul.frame.Framework;
26 import org.zkoss.zul.Menupopup;
33 public abstract class ElephantMenu implements Comparable<ElephantMenu> {
42 int result = CompareUtil.compare(getClass().getName(), o.getClass().getName());
46 public static void showEntity(Object
id, String attribute, String label, String source) {
47 showEntity(
id, attribute, label, source,
null);
50 public static void showEntity(Object
id, String attribute, String label, String source, Map<String, Object> dynProps) {
52 if((
id instanceof Long && ((Long)
id) < 1) ||
id ==
null) {
53 frame.getDesktop().removeAttribute(attribute);
57 if(label.startsWith(
"@")) {
58 frame.
addContent(label.substring(1), source, dynProps);
60 frame.
addContent(
I_.
get(label) +
" #" + (
id ==
null ?
"0" :
id.toString()), source, dynProps);
69 public static void showZulFile(String label, String source, Map<String, Object> dynProps) {
71 if(label.startsWith(
"@")) {
72 frame.
addContent(label.substring(1), source, dynProps);
82 public static void showModalZulFile(String label, String source, Map args, Command command) {
84 if(label.startsWith(
"@")) {
85 frame.
showModal(label.substring(1), source, args, command);
97 if(label.startsWith(
"@")) {
98 frame.
showPopup(label.substring(1), source, args);
104 public static void showEntityModal(Object
id, String attribute, String source, Command command) {
106 if((
id instanceof Long && ((Long)
id) < 1) ||
id ==
null) {
107 frame.getDesktop().removeAttribute(attribute);
static int doModal(String file)
static String get(String msg)
void addContent(String label, String src)
void showPopup(String label, String src, Map arg)
static Framework getCurrent()
void invalidateSelected()
void showModal(String label, String src, Map arg, Command command)
static void setAttribute(Object object, String key, Object value)