|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.ajax.CtxMenuUtil
public class CtxMenuUtil
Utility class providing convenient methods for producing contextual menus.
Field Summary |
---|
Fields inherited from interface com.jalios.jcms.ajax.CtxMenuConstants |
---|
DISABLED, FLAG_CADDY, FLAG_DELETE, FLAG_EDIT, FLAG_EXPORT, FLAG_SEPARATOR, INFO_ICON, MENU_DISABLED, MENU_ENABLED, MENU_SKIPPED, NO_ICON |
Constructor Summary | |
---|---|
CtxMenuUtil()
|
Method Summary | |
---|---|
static void |
addIcon(StringBuffer sb,
String icon)
Print to StringBuffer Image tag that can be an icon or a sprite |
static void |
addInfo(StringBuffer sb,
String userLang,
String label,
String value)
Adds an info in an info section |
static void |
addInfo(StringBuffer sb,
String userLang,
String label,
String value,
String url,
String titleConfirm,
String icon,
boolean isDisabled)
Adds an info with a icon and a text. |
static void |
addInfoImage(StringBuffer sb,
String path)
Adds an info in an info section |
static void |
addInfoText(StringBuffer sb,
String text)
Adds an info in an info section |
static void |
addItem(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url)
Adds a menu item |
static void |
addItem(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url,
String redirect)
Adds a menu item |
static void |
addItem(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url,
String redirect,
String css)
Adds a menu item |
static void |
addItemSeparator(StringBuffer sb)
Adds a menu item separator. |
static void |
addItemWithConfirm(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url,
String confirmMsg,
String redirect,
String contextPath)
Adds a menu item with a confirm message dialog box. |
static void |
addItemWithJSConfirm(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String func,
String confirmMsg)
Adds a menu item with a confirm message dialog box. |
static void |
addItemWithOnclick(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url,
String onclick,
String redirect)
Convenient method that delegater to addItemWithOnclick(StringBuffer, String, boolean, String, String, String, String, String, String) |
static void |
addItemWithOnclick(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url,
String onclick,
String title,
String redirect)
Adds a menu item with onclick value. |
static void |
addItemWithPrompt(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String func,
String promptMsg,
String defaultValue)
Adds a menu item with an input dialog box. |
static void |
addItemWithPrompt(StringBuffer sb,
String userLang,
boolean isEnabled,
String icon,
String label,
String url,
String promptMsg,
String redirectJSNoCaddy,
String param,
String defaultValue)
Adds a menu item with an input dialog box. |
static void |
closeItem(StringBuffer sb,
String userLang,
String icon,
String label)
Close a menu item which has got an icon. |
static void |
closeItem(StringBuffer sb,
String userLang,
String icon,
String label,
String value)
Close a menu item which has got an icon. |
static void |
endInfoSection(StringBuffer sb)
Ends an info section |
static void |
endSubSection(StringBuffer sb)
Ends an sub-section |
static String |
getRedirectJSNoCaddy(javax.servlet.http.HttpServletRequest request)
Gives the redirect for the given request, without parameter to update the caddy. |
static void |
openItem(StringBuffer sb,
boolean isEnabled)
Open a menu item which has got an icon. |
static void |
startInfoSection(StringBuffer sb,
String userLang,
String label,
String icon)
Starts an info section |
static void |
startSubSection(StringBuffer sb,
String userLang,
String label,
String icon)
Starts an sub-section |
static void |
startSubSection(StringBuffer sb,
String userLang,
String label,
String icon,
String ul)
Starts an sub-section |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CtxMenuUtil()
Method Detail |
---|
public static String getRedirectJSNoCaddy(javax.servlet.http.HttpServletRequest request)
request
- the current J2EE request
public static void addItemSeparator(StringBuffer sb)
sb
- the StringBufferpublic static void addItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String onclick, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String onclick, String title, 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 quoteredirect
- parameter in the urlpublic static void addItemWithConfirm(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String confirmMsg, String redirect, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String func, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String promptMsg, String redirectJSNoCaddy, String param, 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(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String func, String promptMsg, 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(StringBuffer sb, String userLang, String label, String icon)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the sectionicon
- the iconpublic static void startSubSection(StringBuffer sb, String userLang, String label, String icon, 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(StringBuffer sb)
sb
- the StringBufferpublic static void startInfoSection(StringBuffer sb, String userLang, String label, String icon)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the sectionicon
- the iconpublic static void endInfoSection(StringBuffer sb)
sb
- the StringBufferpublic static void addInfo(StringBuffer sb, String userLang, String label, String value)
sb
- the StringBufferuserLang
- the current user langlabel
- the label of the infovalue
- the valuepublic static void addInfoText(StringBuffer sb, String text)
sb
- the StringBuffertext
- the text to displaypublic static void addInfo(StringBuffer sb, String userLang, String label, String value, String url, String titleConfirm, 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(StringBuffer sb, String path)
sb
- the StringBufferpath
- the path of the image to displaypublic static void openItem(StringBuffer sb, boolean isEnabled)
sb
- the StringBufferisEnabled
- true if this item is enabled.public static void closeItem(StringBuffer sb, String userLang, String icon, String label)
sb
- the StringBufferuserLang
- the current user langicon
- the item iconlabel
- the label of the itempublic static void closeItem(StringBuffer sb, String userLang, String icon, String label, 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(StringBuffer sb, 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |