public class CtxMenuUtil extends java.lang.Object implements CtxMenuConstants
DISABLED, FLAG_CADDY, FLAG_DELETE, FLAG_EDIT, FLAG_EXPORT, FLAG_INSPECT, FLAG_SEPARATOR, INFO_ICON, MENU_DISABLED, MENU_ENABLED, MENU_SKIPPED, NO_ICON
Constructor and Description |
---|
CtxMenuUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addIcon(java.lang.StringBuffer sb,
java.lang.String icon)
Print to StringBuffer Image tag that can be an icon or a sprite
|
static void |
addInfo(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String label,
java.lang.String value)
Adds an info in an info section
|
static void |
addInfo(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String label,
java.lang.String value,
java.lang.String url,
java.lang.String titleConfirm,
java.lang.String icon,
boolean isDisabled)
Adds an info with a icon and a text.
|
static void |
addInfoImage(java.lang.StringBuffer sb,
java.lang.String path)
Adds an info in an info section
|
static void |
addInfoText(java.lang.StringBuffer sb,
java.lang.String text)
Adds an info in an info section
|
static void |
addItem(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url)
Adds a menu item
|
static void |
addItem(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url,
java.lang.String redirect)
Adds a menu item
|
static void |
addItem(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url,
java.lang.String redirect,
java.lang.String css)
Adds a menu item
|
static void |
addItemSeparator(java.lang.StringBuffer sb)
Adds a menu item separator.
|
static void |
addItemWithConfirm(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url,
java.lang.String confirmMsg,
java.lang.String redirect,
java.lang.String contextPath)
Adds a menu item with a confirm message dialog box.
|
static void |
addItemWithJSConfirm(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String func,
java.lang.String confirmMsg)
Adds a menu item with a confirm message dialog box.
|
static void |
addItemWithOnclick(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url,
java.lang.String onclick,
java.lang.String redirect)
Convenient method that delegater to
addItemWithOnclick(StringBuffer, String, boolean, String, String, String, String, String, String) |
static void |
addItemWithOnclick(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url,
java.lang.String onclick,
java.lang.String title,
java.lang.String redirect)
Adds a menu item with onclick value.
|
static void |
addItemWithPrompt(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String func,
java.lang.String promptMsg,
java.lang.String defaultValue)
Adds a menu item with an input dialog box.
|
static void |
addItemWithPrompt(java.lang.StringBuffer sb,
java.lang.String userLang,
boolean isEnabled,
java.lang.String icon,
java.lang.String label,
java.lang.String url,
java.lang.String promptMsg,
java.lang.String redirectJSNoCaddy,
java.lang.String param,
java.lang.String defaultValue)
Adds a menu item with an input dialog box.
|
static void |
closeItem(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String icon,
java.lang.String label)
Close a menu item which has got an icon.
|
static void |
closeItem(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String icon,
java.lang.String label,
java.lang.String value)
Close a menu item which has got an icon.
|
static void |
endInfoSection(java.lang.StringBuffer sb)
Ends an info section
|
static void |
endSubSection(java.lang.StringBuffer sb)
Ends an sub-section
|
static java.lang.String |
getRedirectJSNoCaddy(javax.servlet.http.HttpServletRequest request)
Gives the redirect for the given request, without parameter to update the caddy.
|
static void |
openItem(java.lang.StringBuffer sb,
boolean isEnabled)
Open a menu item which has got an icon.
|
static void |
startInfoSection(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String label,
java.lang.String icon)
Starts an info section
|
static void |
startSubSection(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String label,
java.lang.String icon)
Starts an sub-section
|
static void |
startSubSection(java.lang.StringBuffer sb,
java.lang.String userLang,
java.lang.String label,
java.lang.String icon,
java.lang.String ul)
Starts an sub-section
|
public static java.lang.String getRedirectJSNoCaddy(javax.servlet.http.HttpServletRequest request)
request
- the current J2EE requestpublic static void addItemSeparator(java.lang.StringBuffer sb)
sb
- the StringBufferpublic static void addItem(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelurl
- the URL to access if the user selects this itempublic static void addItem(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url, java.lang.String redirect)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelurl
- the URL to access if the user selects this itemredirect
- if not empty, add a redirect attribute in the url.public static void addItem(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url, java.lang.String redirect, java.lang.String css)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelurl
- the URL to access if the user selects this itemredirect
- if not empty, add a redirect attribute in the url.css
- the link csspublic static void addItemWithOnclick(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url, java.lang.String onclick, java.lang.String redirect)
addItemWithOnclick(StringBuffer, String, boolean, String, String, String, String, String, String)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelurl
- the URL to access if the user selects this itemonclick
- the javascript function to call (Note: current implementation use double quote onclick="")redirect
- if not empty, add a redirect attribute in the url.public static void addItemWithOnclick(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url, java.lang.String onclick, java.lang.String title, java.lang.String redirect)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelurl
- the URL to access if the user selects this itemonclick
- the javascript function to call (Note: current implementation use double quote onclick="")title
- the title to set (should not contains double quote)redirect
- parameter in the urlpublic static void addItemWithConfirm(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url, java.lang.String confirmMsg, java.lang.String redirect, java.lang.String contextPath)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelurl
- the URL to access if the user confirms the dialog boxconfirmMsg
- the confirm messageredirect
- to force the value of the redirectcontextPath
- the context path of the current J2EE requestpublic static void addItemWithJSConfirm(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String func, java.lang.String confirmMsg)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the icon of this itemlabel
- the property of the labelfunc
- the JavaScript Func to call if the user confirms the dialog box
If you need to use string literal in your function, use the simple quote ('), e.g :
String func = "function() {Popup.popupWindow('"+url+"', 'Something');}";
confirmMsg
- the confirm messagepublic static void addItemWithPrompt(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String url, java.lang.String promptMsg, java.lang.String redirectJSNoCaddy, java.lang.String param, java.lang.String defaultValue)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the iconlabel
- the property of the labelurl
- the URL to access if the user confirm the dialog boxpromptMsg
- the prompt messageredirectJSNoCaddy
- the redirect of the current J2EE request with action param for the caddyparam
- the name of the parameter for the input textdefaultValue
- the default value of the inputpublic static void addItemWithPrompt(java.lang.StringBuffer sb, java.lang.String userLang, boolean isEnabled, java.lang.String icon, java.lang.String label, java.lang.String func, java.lang.String promptMsg, java.lang.String defaultValue)
sb
- the StringBufferuserLang
- the current user langisEnabled
- true if this item is enabledicon
- the iconlabel
- the property of the labelfunc
- the JavaScript function to call with prompt valuepromptMsg
- the prompt messagedefaultValue
- the default value of the inputpublic static void startSubSection(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String label, java.lang.String icon)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the sectionicon
- the iconpublic static void startSubSection(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String label, java.lang.String icon, java.lang.String ul)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the sectionicon
- the iconul
- the class on the ul subsection or nullpublic static void endSubSection(java.lang.StringBuffer sb)
sb
- the StringBufferpublic static void startInfoSection(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String label, java.lang.String icon)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the sectionicon
- the iconpublic static void endInfoSection(java.lang.StringBuffer sb)
sb
- the StringBufferpublic static void addInfo(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String label, java.lang.String value)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the infovalue
- the valuepublic static void addInfoText(java.lang.StringBuffer sb, java.lang.String text)
sb
- the StringBuffertext
- the text to displaypublic static void addInfo(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String label, java.lang.String value, java.lang.String url, java.lang.String titleConfirm, java.lang.String icon, boolean isDisabled)
sb
- the StringBufferuserLang
- the current user langlabel
- the I18N property to displayvalue
- if the info is with a computed value to display (may be null : won't be displayed)url
- the possible linktitleConfirm
- an message for a confirm if there is an action linkicon
- the path to the icon to displayisDisabled
- if the line is disabledpublic static void addInfoImage(java.lang.StringBuffer sb, java.lang.String path)
sb
- the StringBufferpath
- the path of the image to displaypublic static void openItem(java.lang.StringBuffer sb, boolean isEnabled)
sb
- the StringBufferisEnabled
- true if this item is enabled.public static void closeItem(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String icon, java.lang.String label)
sb
- the StringBufferuserLang
- the current user langicon
- the item iconlabel
- the label of the itempublic static void closeItem(java.lang.StringBuffer sb, java.lang.String userLang, java.lang.String icon, java.lang.String label, java.lang.String value)
sb
- the StringBufferuserLang
- the current user langicon
- the item iconlabel
- the label of the itemvalue
- display a String value after the localized labelpublic static void addIcon(java.lang.StringBuffer sb, java.lang.String icon)
sb
- the StringBuffer in which to print the img tagicon
- the icon to display, can be either
an icon sprite class name matching ss_* (in which case it is used as a sprite class)
or else a full or relative path (in which case it is use in src attribute)Copyright © 2001-2010 Jalios SA. All Rights Reserved.