Package com.jalios.jcms.ajax
Class CtxMenuUtil
java.lang.Object
com.jalios.jcms.ajax.CtxMenuUtil
- All Implemented Interfaces:
CtxMenuConstants
Utility class providing convenient methods for producing contextual menus.
- Since:
- jcms-6.1.0
- Author:
- dissert
-
Field Summary
Fields inherited from interface com.jalios.jcms.ajax.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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddIcon(StringBuffer sb, String icon) Print to StringBuffer Image tag that can be an icon or a spritestatic voidaddInfo(StringBuffer sb, String userLang, String label, String value) Adds an info in an info sectionstatic voidaddInfo(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 voidaddInfoImage(StringBuffer sb, String path) Adds an info in an info sectionstatic voidaddInfoText(StringBuffer sb, String text) Adds an info in an info sectionstatic voidAdds a menu itemstatic voidaddItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect) Adds a menu itemstatic voidaddItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, String css) Adds a menu itemstatic voidaddItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, String css, Map<String, String> dataAttributes) Adds a menu itemstatic voidaddItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, String css, Map<String, String> dataAttributes, String wrapperCss) Adds a menu itemstatic voidAdds a menu item separator.static voidaddItemWithConfirm(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 voidaddItemWithJSConfirm(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String func, String confirmMsg) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.static voidaddItemWithOnclick(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String onclick, String redirect) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.static voidaddItemWithOnclick(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String onclick, String title, String redirect) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.static voidaddItemWithPrompt(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String func, String promptMsg, String defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.static voidaddItemWithPrompt(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String promptMsg, String redirectJSNoCaddy, String param, String defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.static voidcloseItem(StringBuffer sb, String userLang, String icon, String label) Close a menu item which has got an icon.static voidClose a menu item which has got an icon.static voidEnds an info sectionstatic voidEnds an sub-sectionstatic StringgetRedirectJSNoCaddy(javax.servlet.http.HttpServletRequest request) Gives the redirect for the given request, without parameter to update the caddy.static voidopenItem(StringBuffer sb, boolean isEnabled) Open a menu item which has got an icon.static voidopenItem(StringBuffer sb, boolean isEnabled, String css) Open a menu item which has got an icon.static voidstartInfoSection(StringBuffer sb, String userLang, String label, String icon) Starts an info sectionstatic voidstartSubSection(StringBuffer sb, String userLang, String label, String icon) Starts an sub-sectionstatic voidstartSubSection(StringBuffer sb, String userLang, String label, String icon, String ul) Starts an sub-section
-
Constructor Details
-
CtxMenuUtil
public CtxMenuUtil()
-
-
Method Details
-
getRedirectJSNoCaddy
Gives the redirect for the given request, without parameter to update the caddy.- Parameters:
request- the current J2EE request- Returns:
- the redirect value
-
addItemSeparator
Adds a menu item separator.- Parameters:
sb- the StringBuffer
-
addItem
public static void addItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url) Adds a menu item- Parameters:
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 item
-
addItem
public static void addItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect) Adds a menu item- Parameters:
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.
-
addItem
public static void addItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, String css) Adds a menu item- Parameters:
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 css
-
addItem
public static void addItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, String css, Map<String, String> dataAttributes) Adds a menu item- Parameters:
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 cssdataAttributes- the data attributes to add on link element
-
addItem
public static void addItem(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String redirect, String css, Map<String, String> dataAttributes, String wrapperCss) Adds a menu item- Parameters:
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 cssdataAttributes- the data attributes to add on the link elementwrapperCss- the css to add on the link wrapper- Since:
- jcms-9.0.3
-
addItemWithOnclick
@Deprecated(forRemoval=true) public static void addItemWithOnclick(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String onclick, String redirect) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.Convenient method that delegater toaddItemWithOnclick(StringBuffer, String, boolean, String, String, String, String, String, String)- Parameters:
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 callredirect- if not empty, add a redirect attribute in the url.
-
addItemWithOnclick
@Deprecated(forRemoval=true) public static void addItemWithOnclick(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String onclick, String title, String redirect) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.Adds a menu item with onclick value. The given url may be null and will be replaced by '#'- Parameters:
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 calltitle- the title to setredirect- parameter in the url
-
addItemWithConfirm
public 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.- Parameters:
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 request
-
addItemWithJSConfirm
@Deprecated(forRemoval=true) public static void addItemWithJSConfirm(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String func, String confirmMsg) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.Adds a menu item with a confirm message dialog box.- Parameters:
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 message
-
addItemWithPrompt
@Deprecated(forRemoval=true) public static void addItemWithPrompt(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String url, String promptMsg, String redirectJSNoCaddy, String param, String defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.Adds a menu item with an input dialog box. Then redirect prompt value to given url.- Parameters:
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 input
-
addItemWithPrompt
@Deprecated(forRemoval=true) public static void addItemWithPrompt(StringBuffer sb, String userLang, boolean isEnabled, String icon, String label, String func, String promptMsg, String defaultValue) Deprecated, for removal: This API element is subject to removal in a future version.since JCMS-3712, inline onclick event are not compliance with strict Content-Security-Policy.Adds a menu item with an input dialog box. Then call javascript with prompt value.- Parameters:
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 input
-
startSubSection
Starts an sub-section- Parameters:
sb- the StringBufferuserLang- the current user langlabel- the label of the sectionicon- the icon
-
startSubSection
public static void startSubSection(StringBuffer sb, String userLang, String label, String icon, String ul) Starts an sub-section- Parameters:
sb- the StringBufferuserLang- the current user langlabel- the label of the sectionicon- the iconul- the class on the ul subsection or null
-
endSubSection
Ends an sub-section- Parameters:
sb- the StringBuffer
-
startInfoSection
Starts an info section- Parameters:
sb- the StringBufferuserLang- the current user langlabel- the label of the sectionicon- the icon
-
endInfoSection
Ends an info section- Parameters:
sb- the StringBuffer
-
addInfo
Adds an info in an info section- Parameters:
sb- the StringBufferuserLang- the current user langlabel- the label of the infovalue- the value
-
addInfoText
Adds an info in an info section- Parameters:
sb- the StringBuffertext- the text to display
-
addInfo
public 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.- Parameters:
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 disabled
-
addInfoImage
Adds an info in an info section- Parameters:
sb- the StringBufferpath- the path of the image to display
-
openItem
Open a menu item which has got an icon.- Parameters:
sb- the StringBufferisEnabled- true if this item is enabled.
-
openItem
Open a menu item which has got an icon.- Parameters:
sb- the StringBufferisEnabled- true if this item is enabled.css- the css to add in class attribute (Will be added on the LI element)
-
closeItem
Close a menu item which has got an icon.- Parameters:
sb- the StringBufferuserLang- the current user langicon- the item iconlabel- the label of the item
-
closeItem
public static void closeItem(StringBuffer sb, String userLang, String icon, String label, String value) Close a menu item which has got an icon.- Parameters:
sb- the StringBufferuserLang- the current user langicon- the item iconlabel- the label of the itemvalue- display a String value after the localized label
-
addIcon
Print to StringBuffer Image tag that can be an icon or a sprite- Parameters:
sb- the StringBuffer in which to print the img tagicon- the icon to display
-