public final class ComponentUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FORCE_NO_CACHE_ON_MSIE |
static String |
NUXEO_RESOURCE_RELOCATED |
static String |
WHITE_SPACE_CHARACTER |
Modifier and Type | Method and Description |
---|---|
static void |
addErrorMessage(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String message) |
static void |
addErrorMessage(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String message,
Object[] params) |
static void |
copyLinkValues(javax.faces.component.UIComponent parent,
javax.faces.component.UIComponent child) |
static void |
copyValues(javax.faces.component.UIComponent parent,
javax.faces.component.UIComponent child,
String[] valueNames)
Copies attributes and value expressions with given name from parent component to child component.
|
static void |
download(DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason)
Downloads a blob and sends it to the requesting user, in the JSF current context.
|
static void |
download(DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason,
Map<String,Serializable> extendedInfos)
Downloads a blob and sends it to the requesting user, in the JSF current context.
|
static String |
download(javax.faces.context.FacesContext faces,
Blob blob,
String filename)
Deprecated.
since 7.3, use
#downloadFile(Blob, String) instead |
static String |
downloadFile(javax.faces.context.FacesContext faces,
String filename,
File file)
Deprecated.
since 7.3, use
#downloadFile(File, String) instead |
static String |
downloadFile(File file,
String filename,
String reason) |
static void |
encodeComponent(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Calls a component encodeBegin/encodeChildren/encodeEnd methods.
|
protected static Object[] |
evaluateParams(javax.faces.context.FacesContext context,
Object[] params)
Evaluates parameters to pass to translation methods if they are value expressions.
|
protected static boolean |
forceNoCacheOnMSIE() |
static Object |
getAttributeOrExpressionValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String attributeName,
Object defaultValue) |
static <T> T |
getAttributeValue(javax.faces.component.UIComponent component,
String name,
Class<T> klass,
T defaultValue,
boolean required) |
static Object |
getAttributeValue(javax.faces.component.UIComponent component,
String attributeName,
Object defaultValue) |
static javax.faces.component.UIComponent |
getBase(javax.faces.component.UIComponent anchor)
Gets the base naming container from anchor.
|
static <T> T |
getComponent(javax.faces.component.UIComponent base,
String componentId,
Class<T> expectedComponentClass)
Returns the component specified by the
componentId parameter from the base component. |
static javax.faces.component.UIComponent |
hookSubComponent(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent parent,
javax.faces.component.UIComponent child,
String defaultChildId)
Add a sub component to a UI component.
|
static void |
initiateSubComponent(javax.faces.component.UIComponent parent,
String facetName,
javax.faces.component.UIComponent child)
Helper method meant to be called in the component constructor.
|
static boolean |
isRelocated(javax.faces.component.UIComponent component)
Returns true if given component is marked as relocated.
|
protected static boolean |
isRendered(javax.faces.component.UIComponent component) |
static void |
moveAllItems(javax.faces.component.UISelectItems sourceItems,
javax.faces.component.UISelectItems targetItems,
UIEditableList hiddenTargetList,
boolean setTargetIds)
Move items from components to others.
|
static void |
moveItems(javax.faces.component.UISelectMany sourceSelect,
javax.faces.component.UISelectItems sourceItems,
javax.faces.component.UISelectItems targetItems,
UIEditableList hiddenTargetList,
boolean setTargetIds)
Move items from components to others.
|
static void |
relocate(javax.faces.component.UIComponent component,
String target,
String compositeKey)
Relocates given component, adding it to the view root resources for given target.
|
static void |
setRelocated(javax.faces.component.UIComponent component)
Marks given component as relocated, so that subsequent calls to
isRelocated(UIComponent) returns true. |
static void |
shiftItemsDown(javax.faces.component.UISelectMany targetSelect,
javax.faces.component.UISelectItems targetItems,
UIEditableList hiddenTargetList) |
static void |
shiftItemsFirst(javax.faces.component.UISelectMany targetSelect,
javax.faces.component.UISelectItems targetItems,
UIEditableList hiddenTargetList) |
static void |
shiftItemsLast(javax.faces.component.UISelectMany targetSelect,
javax.faces.component.UISelectItems targetItems,
UIEditableList hiddenTargetList) |
static void |
shiftItemsUp(javax.faces.component.UISelectMany targetSelect,
javax.faces.component.UISelectItems targetItems,
UIEditableList hiddenTargetList)
Move items up inside the target select
|
static String |
translate(javax.faces.context.FacesContext context,
String messageId) |
static String |
translate(javax.faces.context.FacesContext context,
String messageId,
Object... params) |
static String |
verifyTarget(String toVerify,
String defaultTarget) |
public static final String WHITE_SPACE_CHARACTER
public static final String FORCE_NO_CACHE_ON_MSIE
public static final String NUXEO_RESOURCE_RELOCATED
public static void encodeComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
IOException
public static void initiateSubComponent(javax.faces.component.UIComponent parent, String facetName, javax.faces.component.UIComponent child)
When adding sub components dynamically, the tree fetching could be a problem so all possible sub components must be added.
Since 6.0, does not mark component as not rendered anymore, calls
hookSubComponent(FacesContext, UIComponent, UIComponent, String)
directly.
parent
- child
- facetName
- facet name to put the child in.public static javax.faces.component.UIComponent hookSubComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, javax.faces.component.UIComponent child, String defaultChildId)
Since 6.0, does not the set the component as rendered anymore.
context
- parent
- child
- defaultChildId
- public static void copyValues(javax.faces.component.UIComponent parent, javax.faces.component.UIComponent child, String[] valueNames)
public static void copyLinkValues(javax.faces.component.UIComponent parent, javax.faces.component.UIComponent child)
public static Object getAttributeValue(javax.faces.component.UIComponent component, String attributeName, Object defaultValue)
public static <T> T getAttributeValue(javax.faces.component.UIComponent component, String name, Class<T> klass, T defaultValue, boolean required)
public static Object getAttributeOrExpressionValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attributeName, Object defaultValue)
public static void download(DocumentModel doc, String xpath, Blob blob, String filename, String reason)
doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonpublic static void download(DocumentModel doc, String xpath, Blob blob, String filename, String reason, Map<String,Serializable> extendedInfos)
doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonextendedInfos
- an optional map of extended informations to logpublic static String downloadFile(File file, String filename, String reason) throws IOException
IOException
@Deprecated public static String download(javax.faces.context.FacesContext faces, Blob blob, String filename)
#downloadFile(Blob, String)
instead@Deprecated public static String downloadFile(javax.faces.context.FacesContext faces, String filename, File file) throws IOException
#downloadFile(File, String)
insteadIOException
protected static boolean forceNoCacheOnMSIE()
public static String translate(javax.faces.context.FacesContext context, String messageId)
public static String translate(javax.faces.context.FacesContext context, String messageId, Object... params)
public static void addErrorMessage(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String message)
public static void addErrorMessage(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String message, Object[] params)
protected static Object[] evaluateParams(javax.faces.context.FacesContext context, Object[] params)
public static javax.faces.component.UIComponent getBase(javax.faces.component.UIComponent anchor)
Gets out of suggestion box as it's a naming container and we can't get components out of it with a relative path => take above first found container.
public static <T> T getComponent(javax.faces.component.UIComponent base, String componentId, Class<T> expectedComponentClass)
componentId
parameter from the base
component.
Does not throw any exception if the component is not found, returns null
instead.
public static void shiftItemsUp(javax.faces.component.UISelectMany targetSelect, javax.faces.component.UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void shiftItemsDown(javax.faces.component.UISelectMany targetSelect, javax.faces.component.UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void shiftItemsFirst(javax.faces.component.UISelectMany targetSelect, javax.faces.component.UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void shiftItemsLast(javax.faces.component.UISelectMany targetSelect, javax.faces.component.UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void moveItems(javax.faces.component.UISelectMany sourceSelect, javax.faces.component.UISelectItems sourceItems, javax.faces.component.UISelectItems targetItems, UIEditableList hiddenTargetList, boolean setTargetIds)
public static void moveAllItems(javax.faces.component.UISelectItems sourceItems, javax.faces.component.UISelectItems targetItems, UIEditableList hiddenTargetList, boolean setTargetIds)
public static String verifyTarget(String toVerify, String defaultTarget)
public static void setRelocated(javax.faces.component.UIComponent component)
isRelocated(UIComponent)
returns true.public static boolean isRelocated(javax.faces.component.UIComponent component)
setRelocated(UIComponent)
,
relocate(UIComponent, String, String)
public static void relocate(javax.faces.component.UIComponent component, String target, String compositeKey)
If given composite key is not null, current composite component client id is saved using this key on the component attributes, for later reuse.
Component is also marked as relocated so that subsequent calls to isRelocated(UIComponent)
returns true.
protected static boolean isRendered(javax.faces.component.UIComponent component)
Copyright © 2019 Nuxeo. All rights reserved.