public final class ComponentUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FORCE_NO_CACHE_ON_MSIE |
static String |
WHITE_SPACE_CHARACTER |
Modifier and Type | Method and Description |
---|---|
static void |
addErrorMessage(FacesContext context,
UIComponent component,
String message) |
static void |
addErrorMessage(FacesContext context,
UIComponent component,
String message,
Object[] params) |
static void |
copyLinkValues(UIComponent parent,
UIComponent child) |
static void |
copyValues(UIComponent parent,
UIComponent child,
String[] valueNames)
Copies attributes and value expressions with given name from parent
component to child component.
|
static String |
download(FacesContext faces,
Blob blob,
String filename) |
static String |
downloadFile(FacesContext faces,
String filename,
File file) |
static void |
encodeComponent(FacesContext context,
UIComponent component)
Calls a component encodeBegin/encodeChildren/encodeEnd methods.
|
static Object |
getAttributeOrExpressionValue(FacesContext context,
UIComponent component,
String attributeName,
Object defaultValue) |
static Object |
getAttributeValue(UIComponent component,
String attributeName,
Object defaultValue) |
static UIComponent |
getBase(UIComponent anchor)
Gets the base naming container from anchor.
|
static <T> T |
getComponent(UIComponent base,
String componentId,
Class<T> expectedComponentClass)
Returns the component specified by the
componentId parameter
from the base component. |
static UIComponent |
hookSubComponent(FacesContext context,
UIComponent parent,
UIComponent child,
String defaultChildId)
Add a sub component to a UI component, marking is as rendered.
|
static void |
initiateSubComponent(UIComponent parent,
String facetName,
UIComponent child)
Helper method meant to be called in the component constructor.
|
static void |
moveAllItems(UISelectItems sourceItems,
UISelectItems targetItems,
UIEditableList hiddenTargetList,
boolean setTargetIds)
Move items from components to others.
|
static void |
moveItems(UISelectMany sourceSelect,
UISelectItems sourceItems,
UISelectItems targetItems,
UIEditableList hiddenTargetList,
boolean setTargetIds)
Move items from components to others.
|
static void |
shiftItemsDown(UISelectMany targetSelect,
UISelectItems targetItems,
UIEditableList hiddenTargetList) |
static void |
shiftItemsFirst(UISelectMany targetSelect,
UISelectItems targetItems,
UIEditableList hiddenTargetList) |
static void |
shiftItemsLast(UISelectMany targetSelect,
UISelectItems targetItems,
UIEditableList hiddenTargetList) |
static void |
shiftItemsUp(UISelectMany targetSelect,
UISelectItems targetItems,
UIEditableList hiddenTargetList)
Move items up inside the target select
|
static String |
translate(FacesContext context,
String messageId) |
static String |
translate(FacesContext context,
String messageId,
Object... params) |
public static final String WHITE_SPACE_CHARACTER
public static final String FORCE_NO_CACHE_ON_MSIE
public static void encodeComponent(FacesContext context, UIComponent component) throws IOException
IOException
public static void initiateSubComponent(UIComponent parent, String facetName, UIComponent child)
When adding sub components dynamically, the tree fetching could be a problem so all possible sub components must be added.
By default initiated component are marked as not rendered.
parent
- child
- facetName
- facet name to put the child in.public static UIComponent hookSubComponent(FacesContext context, UIComponent parent, UIComponent child, String defaultChildId)
context
- parent
- child
- defaultChildId
- public static void copyValues(UIComponent parent, UIComponent child, String[] valueNames)
public static void copyLinkValues(UIComponent parent, UIComponent child)
public static Object getAttributeValue(UIComponent component, String attributeName, Object defaultValue)
public static Object getAttributeOrExpressionValue(FacesContext context, UIComponent component, String attributeName, Object defaultValue)
public static String download(FacesContext faces, Blob blob, String filename)
public static String downloadFile(FacesContext faces, String filename, File file)
public static String translate(FacesContext context, String messageId)
public static String translate(FacesContext context, String messageId, Object... params)
public static void addErrorMessage(FacesContext context, UIComponent component, String message)
public static void addErrorMessage(FacesContext context, UIComponent component, String message, Object[] params)
public static UIComponent getBase(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(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(UISelectMany targetSelect, UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void shiftItemsDown(UISelectMany targetSelect, UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void shiftItemsFirst(UISelectMany targetSelect, UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void shiftItemsLast(UISelectMany targetSelect, UISelectItems targetItems, UIEditableList hiddenTargetList)
public static void moveItems(UISelectMany sourceSelect, UISelectItems sourceItems, UISelectItems targetItems, UIEditableList hiddenTargetList, boolean setTargetIds)
public static void moveAllItems(UISelectItems sourceItems, UISelectItems targetItems, UIEditableList hiddenTargetList, boolean setTargetIds)
Copyright © 2013 Nuxeo SA. All Rights Reserved.