public final class Utils
extends org.springframework.extensions.webscripts.ui.common.StringUtils
| Modifier and Type | Class and Description |
|---|---|
static class |
Utils.URLMode
Enum representing the client URL type to generate
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ON_FIRST_SPACE
RegEx to split a String on the first space.
|
static String |
USER_AGENT_FIREFOX |
static String |
USER_AGENT_MSIE |
| Modifier and Type | Method and Description |
|---|---|
static void |
addErrorMessage(String msg)
Adds a global error message
|
static void |
addErrorMessage(String msg,
Throwable err)
Adds a global error message and logs exception details
|
static void |
addStatusMessage(javax.faces.application.FacesMessage.Severity severity,
String msg)
Adds a global status message that will be displayed by a Status Message UI component
|
static String |
buildImageTag(javax.faces.context.FacesContext context,
String image,
int width,
int height,
String alt)
Build a context path safe image tag for the supplied image path.
|
static String |
buildImageTag(javax.faces.context.FacesContext context,
String image,
int width,
int height,
String alt,
String onclick)
Build a context path safe image tag for the supplied image path.
|
static String |
buildImageTag(javax.faces.context.FacesContext context,
String image,
int width,
int height,
String alt,
String onclick,
String verticalAlign)
Build a context path safe image tag for the supplied image path.
|
static String |
buildImageTag(javax.faces.context.FacesContext context,
String image,
int width,
int height,
String alt,
String onclick,
String verticalAlign,
String style)
Build a context path safe image tag for the supplied image path.
|
static String |
buildImageTag(javax.faces.context.FacesContext context,
String image,
String alt)
Build a context path safe image tag for the supplied image path.
|
static String |
buildImageTag(javax.faces.context.FacesContext context,
String image,
String alt,
String verticalAlign)
Build a context path safe image tag for the supplied image path.
|
static void |
encodeRecursive(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Helper to recursively render a component and it's child components
|
static String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Generate the JavaScript to submit the parent Form.
|
static String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String fieldId,
String fieldValue)
Generate the JavaScript to submit set the specified hidden Form field to the
supplied value and submit the parent Form.
|
static String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String fieldId,
String fieldValue,
boolean valueIsParam,
Map<String,String> params)
Generate the JavaScript to submit set the specified hidden Form field to the
supplied value and submit the parent Form.
|
static String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String fieldId,
String fieldValue,
Map<String,String> params)
Generate the JavaScript to submit set the specified hidden Form field to the
supplied value and submit the parent Form.
|
static List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,String>> |
generatePersonFilter(String term)
Generate the QName filter for a standard Person lookup.
|
static void |
generatePersonSearch(StringBuilder query,
String term)
Deprecated.
Use
generatePersonFilter(String) and PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest) instead |
static List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> |
generatePersonSort()
Generate the QName sort for a standard Person lookup.
|
static String |
generateURL(javax.faces.context.FacesContext context,
Node node,
String name,
Utils.URLMode usage)
Generates a URL for the given usage for the given node.
|
static String |
generateURL(javax.faces.context.FacesContext context,
Node node,
Utils.URLMode usage)
Generates a URL for the given usage for the given node.
|
static String |
getActionHiddenFieldName(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Get the hidden field name for any action component.
|
static DateFormat |
getDateFormat(javax.faces.context.FacesContext fc) |
static DateFormat |
getDateTimeFormat(javax.faces.context.FacesContext fc) |
static String |
getDescription(javax.faces.context.FacesContext context,
org.springframework.extensions.config.ConfigElement configElement)
Given a ConfigElement instance retrieve the description, this could be
dervied from a message bundle key or a literal string
|
static String |
getDisplayLabel(javax.faces.context.FacesContext context,
org.springframework.extensions.config.ConfigElement configElement)
Given a ConfigElement instance retrieve the display label, this could be
dervied from a message bundle key or a literal string
|
static IDataContainer |
getParentDataContainer(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Return the parent UIComponent implementing the IDataContainer interface for
the specified UIComponent.
|
static javax.faces.component.UIForm |
getParentForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Return the parent UIForm component for the specified UIComponent
|
static javax.faces.component.UIComponent |
getParentNamingContainer(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Return the parent UIComponent implementing the NamingContainer interface for
the specified UIComponent.
|
static int |
getPersonMaxResults()
How many results should a person search return up to? This is needed
because the JSF components do paging differently.
|
static DateFormat |
getTimeFormat(javax.faces.context.FacesContext fc) |
static String |
getUserAgent(javax.faces.context.FacesContext context) |
static boolean |
isComponentDisabledOrReadOnly(javax.faces.component.UIComponent component)
Determines whether the given component is disabled or readonly
|
static void |
outputAttribute(javax.faces.context.ResponseWriter out,
Object attr,
String mapping)
Helper to output an attribute to the output stream
|
static Date |
parseXMLDateFormat(String isoDate)
Parse XML format date YYYY-MM-DDTHH:MM:SS
|
static void |
processActionMethod(javax.faces.context.FacesContext context,
javax.faces.el.MethodBinding method,
javax.faces.event.ActionEvent event)
Invoke the method encapsulated by the supplied MethodBinding
|
cropEncode, cropEncode, encode, encodeJavascript, join, join, remove, replace, replaceLineBreaks, setAttributeBlackList, setAttributeGreyList, setAttributeValueBlackList, setOverrideDocType, setTagWhiteList, stripUnsafeHTMLDocument, stripUnsafeHTMLTags, stripUnsafeHTMLTags, stripUnsafeHTMLTagspublic static final String USER_AGENT_FIREFOX
public static final String USER_AGENT_MSIE
public static final String ON_FIRST_SPACE
public static void outputAttribute(javax.faces.context.ResponseWriter out,
Object attr,
String mapping)
throws IOException
out - ResponseWriterattr - attribute value object (cannot be null)mapping - mapping to output as e.g. style="..."IOExceptionpublic static String getActionHiddenFieldName(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public static void encodeRecursive(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws IOException
context - FacesContextcomponent - UIComponentIOExceptionpublic static String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String fieldId, String fieldValue)
context - FacesContextcomponent - UIComponent to generate JavaScript forfieldId - Hidden field id to set value forfieldValue - Hidden field value to set hidden field too on submitpublic static String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String fieldId, String fieldValue, Map<String,String> params)
context - FacesContextcomponent - UIComponent to generate JavaScript forfieldId - Hidden field id to set value forfieldValue - Hidden field value to set hidden field too on submitparams - Optional map of param name/values to outputpublic static String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String fieldId, String fieldValue, boolean valueIsParam, Map<String,String> params)
context - FacesContextcomponent - UIComponent to generate JavaScript forfieldId - Hidden field id to set value forfieldValue - Hidden field value to set hidden field too on submitvalueIsParam - Determines whether the fieldValue parameter should be treated
as a parameter in the generated JavaScript, false will treat
the value i.e. surround it with single quotesparams - Optional map of param name/values to outputpublic static String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context - FacesContextcomponent - UIComponent to generate JavaScript forpublic static String generateURL(javax.faces.context.FacesContext context, Node node, String name, Utils.URLMode usage)
context - Faces contextnode - The node to generate the URL forname - Name to use for the download file part of the link if anyusage - What the URL is going to be used forUtils.URLModepublic static String generateURL(javax.faces.context.FacesContext context, Node node, Utils.URLMode usage)
context - Faces contextnode - The node to generate the URL forusage - What the URL is going to be used forUtils.URLModepublic static String buildImageTag(javax.faces.context.FacesContext context, String image, int width, int height, String alt, String onclick)
context - FacesContextimage - The local image path from the web folder with leading slash '/'width - Width in pixelsheight - Height in pixelsalt - Optional alt/title textonclick - JavaScript onclick event handler codeimg tagpublic static String buildImageTag(javax.faces.context.FacesContext context, String image, int width, int height, String alt, String onclick, String verticalAlign)
context - FacesContextimage - The local image path from the web folder with leading slash '/'width - Width in pixelsheight - Height in pixelsalt - Optional alt/title textonclick - JavaScript onclick event handler codeverticalAlign - Optional HTML alignment valueimg tagpublic static String buildImageTag(javax.faces.context.FacesContext context, String image, int width, int height, String alt, String onclick, String verticalAlign, String style)
context - FacesContextimage - The local image path from the web folder with leading slash '/'width - Width in pixelsheight - Height in pixelsalt - Optional alt/title textonclick - JavaScript onclick event handler codeverticalAlign - Optional HTML alignment valuestyle - Optional inline CSS stylingimg tagpublic static String buildImageTag(javax.faces.context.FacesContext context, String image, int width, int height, String alt)
context - FacesContextimage - The local image path from the web folder with leading slash '/'width - Width in pixelsheight - Height in pixelsalt - Optional alt/title textimg tagpublic static String buildImageTag(javax.faces.context.FacesContext context, String image, String alt)
context - FacesContextimage - The local image path from the web folder with leading slash '/'alt - Optional alt/title textimg tagpublic static String buildImageTag(javax.faces.context.FacesContext context, String image, String alt, String verticalAlign)
context - FacesContextimage - The local image path from the web folder with leading slash '/'alt - Optional alt/title textverticalAlign - Optional HTML alignment valueimg tagpublic static javax.faces.component.UIForm getParentForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
context - FaceContextcomponent - The UIComponent to find parent Form forpublic static javax.faces.component.UIComponent getParentNamingContainer(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
context - FaceContextcomponent - The UIComponent to find parent Form forpublic static IDataContainer getParentDataContainer(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context - FaceContextcomponent - The UIComponent to find parent IDataContainer forpublic static boolean isComponentDisabledOrReadOnly(javax.faces.component.UIComponent component)
component - The component to testpublic static void processActionMethod(javax.faces.context.FacesContext context,
javax.faces.el.MethodBinding method,
javax.faces.event.ActionEvent event)
context - FacesContextmethod - MethodBinding to invokeevent - ActionEvent to pass to the method of signature:
public void myMethodName(ActionEvent event)public static void addErrorMessage(String msg)
msg - The error messagepublic static void addErrorMessage(String msg, Throwable err)
msg - The error messageerr - The exception to logpublic static void addStatusMessage(javax.faces.application.FacesMessage.Severity severity,
String msg)
severity - Severity of the messagemsg - Text of the messagepublic static DateFormat getTimeFormat(javax.faces.context.FacesContext fc)
public static DateFormat getDateFormat(javax.faces.context.FacesContext fc)
public static DateFormat getDateTimeFormat(javax.faces.context.FacesContext fc)
public static Date parseXMLDateFormat(String isoDate)
isoDate - Stringpublic static String getDisplayLabel(javax.faces.context.FacesContext context, org.springframework.extensions.config.ConfigElement configElement)
context - FacesContextconfigElement - The ConfigElement to testpublic static String getDescription(javax.faces.context.FacesContext context, org.springframework.extensions.config.ConfigElement configElement)
context - FacesContextconfigElement - The ConfigElement to testpublic static String getUserAgent(javax.faces.context.FacesContext context)
public static List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> generatePersonSort()
PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest)public static List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,String>> generatePersonFilter(String term)
PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest)term - Search termpublic static int getPersonMaxResults()
public static void generatePersonSearch(StringBuilder query, String term)
generatePersonFilter(String) and PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest) insteadquery - Buffer for the queryterm - Search termCopyright © 2005–2018 Alfresco Software. All rights reserved.