|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.extensions.webscripts.ui.common.StringUtils
org.alfresco.web.ui.common.Utils
public final class Utils
Class containing misc helper methods used by the JSF components.
Nested Class Summary | |
---|---|
static class |
Utils.URLMode
Enum representing the client URL type to generate |
Field Summary | |
---|---|
static java.lang.String |
USER_AGENT_FIREFOX
|
static java.lang.String |
USER_AGENT_MSIE
|
Fields inherited from class org.springframework.extensions.webscripts.ui.common.StringUtils |
---|
safeTags, unsafeAttrs |
Method Summary | |
---|---|
static void |
addErrorMessage(java.lang.String msg)
Adds a global error message |
static void |
addErrorMessage(java.lang.String msg,
java.lang.Throwable err)
Adds a global error message and logs exception details |
static void |
addStatusMessage(javax.faces.application.FacesMessage.Severity severity,
java.lang.String msg)
Adds a global status message that will be displayed by a Status Message UI component |
static java.lang.String |
buildImageTag(javax.faces.context.FacesContext context,
java.lang.String image,
int width,
int height,
java.lang.String alt)
Build a context path safe image tag for the supplied image path. |
static java.lang.String |
buildImageTag(javax.faces.context.FacesContext context,
java.lang.String image,
int width,
int height,
java.lang.String alt,
java.lang.String onclick)
Build a context path safe image tag for the supplied image path. |
static java.lang.String |
buildImageTag(javax.faces.context.FacesContext context,
java.lang.String image,
int width,
int height,
java.lang.String alt,
java.lang.String onclick,
java.lang.String verticalAlign)
Build a context path safe image tag for the supplied image path. |
static java.lang.String |
buildImageTag(javax.faces.context.FacesContext context,
java.lang.String image,
int width,
int height,
java.lang.String alt,
java.lang.String onclick,
java.lang.String verticalAlign,
java.lang.String style)
Build a context path safe image tag for the supplied image path. |
static java.lang.String |
buildImageTag(javax.faces.context.FacesContext context,
java.lang.String image,
java.lang.String alt)
Build a context path safe image tag for the supplied image path. |
static java.lang.String |
buildImageTag(javax.faces.context.FacesContext context,
java.lang.String image,
java.lang.String alt,
java.lang.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 java.lang.String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Generate the JavaScript to submit the parent Form. |
static java.lang.String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String fieldId,
java.lang.String fieldValue)
Generate the JavaScript to submit set the specified hidden Form field to the supplied value and submit the parent Form. |
static java.lang.String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String fieldId,
java.lang.String fieldValue,
boolean valueIsParam,
java.util.Map params)
Generate the JavaScript to submit set the specified hidden Form field to the supplied value and submit the parent Form. |
static java.lang.String |
generateFormSubmit(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String fieldId,
java.lang.String fieldValue,
java.util.Map params)
Generate the JavaScript to submit set the specified hidden Form field to the supplied value and submit the parent Form. |
static java.util.List |
generatePersonFilter(java.lang.String term)
Generate the QName filter for a standard Person lookup. |
static void |
generatePersonSearch(java.lang.StringBuilder query,
java.lang.String term)
Deprecated. Use Utils.generatePersonFilter(String) and PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest) instead |
static java.util.List |
generatePersonSort()
Generate the QName sort for a standard Person lookup. |
static java.lang.String |
generateURL(javax.faces.context.FacesContext context,
Node node,
java.lang.String name,
Utils.URLMode usage)
Generates a URL for the given usage for the given node. |
static java.lang.String |
generateURL(javax.faces.context.FacesContext context,
Node node,
Utils.URLMode usage)
Generates a URL for the given usage for the given node. |
static java.lang.String |
getActionHiddenFieldName(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Get the hidden field name for any action component. |
static java.text.DateFormat |
getDateFormat(javax.faces.context.FacesContext fc)
|
static java.text.DateFormat |
getDateTimeFormat(javax.faces.context.FacesContext fc)
|
static java.lang.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 java.lang.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 java.text.DateFormat |
getTimeFormat(javax.faces.context.FacesContext fc)
|
static java.lang.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,
java.lang.Object attr,
java.lang.String mapping)
Helper to output an attribute to the output stream |
static java.util.Date |
parseXMLDateFormat(java.lang.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 |
Methods inherited from class org.springframework.extensions.webscripts.ui.common.StringUtils |
---|
cropEncode, cropEncode, encode, encodeJavascript, join, join, remove, replace, replaceLineBreaks, stripUnsafeHTMLTags, stripUnsafeHTMLTags |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String USER_AGENT_FIREFOX
public static final java.lang.String USER_AGENT_MSIE
Method Detail |
---|
public static void outputAttribute(javax.faces.context.ResponseWriter out, java.lang.Object attr, java.lang.String mapping) throws java.io.IOException
out
- ResponseWriterattr
- attribute value object (cannot be null)mapping
- mapping to output as e.g. style="..."
java.io.IOException
public static java.lang.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 java.io.IOException
context
- FacesContextcomponent
- UIComponent
java.io.IOException
public static java.lang.String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String fieldId, java.lang.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 submit
public static java.lang.String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String fieldId, java.lang.String fieldValue, java.util.Map 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 output
public static java.lang.String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String fieldId, java.lang.String fieldValue, boolean valueIsParam, java.util.Map 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 output
public static java.lang.String generateFormSubmit(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- FacesContextcomponent
- UIComponent to generate JavaScript for
public static java.lang.String generateURL(javax.faces.context.FacesContext context, Node node, java.lang.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 for
Utils.URLMode
public static java.lang.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 for
Utils.URLMode
public static java.lang.String buildImageTag(javax.faces.context.FacesContext context, java.lang.String image, int width, int height, java.lang.String alt, java.lang.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 code
img
tagpublic static java.lang.String buildImageTag(javax.faces.context.FacesContext context, java.lang.String image, int width, int height, java.lang.String alt, java.lang.String onclick, java.lang.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 value
img
tagpublic static java.lang.String buildImageTag(javax.faces.context.FacesContext context, java.lang.String image, int width, int height, java.lang.String alt, java.lang.String onclick, java.lang.String verticalAlign, java.lang.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 styling
img
tagpublic static java.lang.String buildImageTag(javax.faces.context.FacesContext context, java.lang.String image, int width, int height, java.lang.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 text
img
tagpublic static java.lang.String buildImageTag(javax.faces.context.FacesContext context, java.lang.String image, java.lang.String alt)
context
- FacesContextimage
- The local image path from the web folder with leading slash '/'alt
- Optional alt/title text
img
tagpublic static java.lang.String buildImageTag(javax.faces.context.FacesContext context, java.lang.String image, java.lang.String alt, java.lang.String verticalAlign)
context
- FacesContextimage
- The local image path from the web folder with leading slash '/'alt
- Optional alt/title textverticalAlign
- Optional HTML alignment value
img
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 for
public static javax.faces.component.UIComponent getParentNamingContainer(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- FaceContextcomponent
- The UIComponent to find parent Form for
public static IDataContainer getParentDataContainer(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- FaceContextcomponent
- The UIComponent to find parent IDataContainer for
public static boolean isComponentDisabledOrReadOnly(javax.faces.component.UIComponent component)
component
- The component to test
public 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(java.lang.String msg)
msg
- The error messagepublic static void addErrorMessage(java.lang.String msg, java.lang.Throwable err)
msg
- The error messageerr
- The exception to logpublic static void addStatusMessage(javax.faces.application.FacesMessage.Severity severity, java.lang.String msg)
severity
- Severity of the messagemsg
- Text of the messagepublic static java.text.DateFormat getTimeFormat(javax.faces.context.FacesContext fc)
public static java.text.DateFormat getDateFormat(javax.faces.context.FacesContext fc)
public static java.text.DateFormat getDateTimeFormat(javax.faces.context.FacesContext fc)
public static java.util.Date parseXMLDateFormat(java.lang.String isoDate)
isoDate
-
public static java.lang.String getDisplayLabel(javax.faces.context.FacesContext context, org.springframework.extensions.config.ConfigElement configElement)
context
- FacesContextconfigElement
- The ConfigElement to test
public static java.lang.String getDescription(javax.faces.context.FacesContext context, org.springframework.extensions.config.ConfigElement configElement)
context
- FacesContextconfigElement
- The ConfigElement to test
public static java.lang.String getUserAgent(javax.faces.context.FacesContext context)
public static java.util.List generatePersonSort()
PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest)
public static java.util.List generatePersonFilter(java.lang.String term)
PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest)
term
- Search termpublic static int getPersonMaxResults()
public static void generatePersonSearch(java.lang.StringBuilder query, java.lang.String term)
Utils.generatePersonFilter(String)
and PersonService.getPeople(List, boolean, List, org.alfresco.query.PagingRequest)
instead
query
- Buffer for the queryterm
- Search term
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |