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(FacesMessage.Severity severity,
String msg)
Adds a global status message that will be displayed by a Status Message UI component
|
static String |
buildImageTag(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(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(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(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(FacesContext context,
String image,
String alt)
Build a context path safe image tag for the supplied image path.
|
static String |
buildImageTag(FacesContext context,
String image,
String alt,
String verticalAlign)
Build a context path safe image tag for the supplied image path.
|
static void |
encodeRecursive(FacesContext context,
UIComponent component)
Helper to recursively render a component and it's child components
|
static String |
generateFormSubmit(FacesContext context,
UIComponent component)
Generate the JavaScript to submit the parent Form.
|
static String |
generateFormSubmit(FacesContext context,
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(FacesContext context,
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(FacesContext context,
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.
|
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(FacesContext context,
Node node,
String name,
Utils.URLMode usage)
Generates a URL for the given usage for the given node.
|
static String |
generateURL(FacesContext context,
Node node,
Utils.URLMode usage)
Generates a URL for the given usage for the given node.
|
static String |
getActionHiddenFieldName(FacesContext context,
UIComponent component)
Get the hidden field name for any action component.
|
static DateFormat |
getDateFormat(FacesContext fc) |
static DateFormat |
getDateTimeFormat(FacesContext fc) |
static String |
getDescription(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(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(FacesContext context,
UIComponent component)
Return the parent UIComponent implementing the IDataContainer interface for
the specified UIComponent.
|
static UIForm |
getParentForm(FacesContext context,
UIComponent component)
Return the parent UIForm component for the specified UIComponent
|
static UIComponent |
getParentNamingContainer(FacesContext context,
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(FacesContext fc) |
static String |
getUserAgent(FacesContext context) |
static boolean |
isComponentDisabledOrReadOnly(UIComponent component)
Determines whether the given component is disabled or readonly
|
static void |
outputAttribute(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(FacesContext context,
MethodBinding method,
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, stripUnsafeHTMLTags
public static final String USER_AGENT_FIREFOX
public static final String USER_AGENT_MSIE
public static final String ON_FIRST_SPACE
public static void outputAttribute(ResponseWriter out, Object attr, String mapping) throws IOException
out
- ResponseWriterattr
- attribute value object (cannot be null)mapping
- mapping to output as e.g. style="..."IOException
public static String getActionHiddenFieldName(FacesContext context, UIComponent component)
public static void encodeRecursive(FacesContext context, UIComponent component) throws IOException
context
- FacesContextcomponent
- UIComponentIOException
public static String generateFormSubmit(FacesContext context, 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(FacesContext context, 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(FacesContext context, 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(FacesContext context, UIComponent component)
context
- FacesContextcomponent
- UIComponent to generate JavaScript forpublic static String generateURL(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.URLMode
public static String generateURL(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.URLMode
public static String buildImageTag(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(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(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(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(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(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 UIForm getParentForm(FacesContext context, UIComponent component)
context
- FaceContextcomponent
- The UIComponent to find parent Form forpublic static UIComponent getParentNamingContainer(FacesContext context, UIComponent component)
context
- FaceContextcomponent
- The UIComponent to find parent Form forpublic static IDataContainer getParentDataContainer(FacesContext context, UIComponent component)
context
- FaceContextcomponent
- The UIComponent to find parent IDataContainer forpublic static boolean isComponentDisabledOrReadOnly(UIComponent component)
component
- The component to testpublic static void processActionMethod(FacesContext context, MethodBinding method, 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(FacesMessage.Severity severity, String msg)
severity
- Severity of the messagemsg
- Text of the messagepublic static DateFormat getTimeFormat(FacesContext fc)
public static DateFormat getDateFormat(FacesContext fc)
public static DateFormat getDateTimeFormat(FacesContext fc)
public static Date parseXMLDateFormat(String isoDate)
isoDate
- Stringpublic static String getDisplayLabel(FacesContext context, org.springframework.extensions.config.ConfigElement configElement)
context
- FacesContextconfigElement
- The ConfigElement to testpublic static String getDescription(FacesContext context, org.springframework.extensions.config.ConfigElement configElement)
context
- FacesContextconfigElement
- The ConfigElement to testpublic static String getUserAgent(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–2017 Alfresco Software. All rights reserved.