本文整理汇总了Java中javax.faces.component.NamingContainer.SEPARATOR_CHAR属性的典型用法代码示例。如果您正苦于以下问题:Java NamingContainer.SEPARATOR_CHAR属性的具体用法?Java NamingContainer.SEPARATOR_CHAR怎么用?Java NamingContainer.SEPARATOR_CHAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.faces.component.NamingContainer
的用法示例。
在下文中一共展示了NamingContainer.SEPARATOR_CHAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderId
@Override
protected void renderId(
FacesContext context,
UIComponent component
) throws IOException
{
TableRenderingContext tContext =
TableRenderingContext.getCurrentInstance();
String param = (tContext.getTableId() +
NamingContainer.SEPARATOR_CHAR +
SELECTED_KEY);
ResponseWriter writer = context.getResponseWriter();
writer.writeAttribute("name", param, null);
// =-=AEW Inefficient. We only need the "id" when there's
// a shortDescription (which is when we'll get a label)
if (getShortDesc(component, getFacesBean(component)) != null)
writer.writeAttribute("id", getClientId(context, component), null);
}
示例2: renderId
@Override
protected void renderId(
FacesContext context,
UIComponent component
) throws IOException
{
TableRenderingContext tContext =
TableRenderingContext.getCurrentInstance();
String param = (tContext.getTableId() +
NamingContainer.SEPARATOR_CHAR +
XhtmlConstants.SELECTED_KEY);
ResponseWriter writer = context.getResponseWriter();
writer.writeAttribute("name", param, null);
// =-=AEW Inefficient. We only need the "id" when there's
// a shortDescription (which is when we'll get a label)
if (getShortDesc(component, getFacesBean(component)) != null)
writer.writeAttribute("id", getClientId(context, component), null);
}
示例3: startItem
@Override
protected void startItem(FacesContext context, ResponseWriter w, AbstractDataView c, ViewDefinition viewDef, boolean emitId) throws IOException {
w.startElement("li",c); // $NON-NLS-1$
if(emitId) {
String id = viewDef.dataView.getClientId(context)+NamingContainer.SEPARATOR_CHAR+UIDataView.ROW_ID;
w.writeAttribute("id", id, null); // $NON-NLS-1$
}
String style = (String)getProperty(PROP_LISTITEMSTYLE);
if(StringUtil.isNotEmpty(style)) {
w.writeAttribute("style", style, null); // $NON-NLS-1$
}
String styleClass = (String)getProperty(PROP_LISTITEMCLASS);
if(StringUtil.isNotEmpty(styleClass)) {
w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
}
newLine(w);
}
示例4: startItem
protected void startItem(FacesContext context, ResponseWriter w, AbstractDataView c, ViewDefinition viewDef, boolean emitId) throws IOException {
w.startElement("li",c); // $NON-NLS-1$
if(emitId) {
String id = viewDef.dataView.getClientId(context)+NamingContainer.SEPARATOR_CHAR+UIDataView.ROW_ID;
w.writeAttribute("id", id, null); // $NON-NLS-1$
}
String style = (String)getProperty(PROP_LISTITEMSTYLE);
// In case we do not render as a table, we should also fix the margin
if(!viewDef.viewforumRenderAsTable) {
// In case of a table, the margin are auto computed and not null
// In case of div, they're just null so we should fix them
style = ExtLibUtil.concatStyles(style, "margin: 7px 7px 7px 0;"); // $NON-NLS-1$
}
if(StringUtil.isNotEmpty(style)) {
w.writeAttribute("style", style, null); // $NON-NLS-1$
}
String styleClass = (String)getProperty(PROP_LISTITEMCLASS);
if(StringUtil.isNotEmpty(styleClass)) {
w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
}
newLine(w);
}
示例5: decode
/**
* @todo do not mess with selection here. queue an event.
*/
@SuppressWarnings("unchecked")
@Override
public void decode(
FacesContext context,
UIComponent component)
{
Map<String, String> parameters =
context.getExternalContext().getRequestParameterMap();
String source = parameters.get(UIConstants.SOURCE_PARAM);
if (!component.getClientId(context).equals(source))
return;
TreeUtils.decodeExpandEvents(parameters, component, Collections.emptyList());
String currencyStrParam =
source + NamingContainer.SEPARATOR_CHAR + SELECTED_PARAM;
String currencyStr = parameters.get(currencyStrParam);
if ((currencyStr != null) && (!"".equals(currencyStr)))
{
UIXTree tree = (UIXTree) component;
Object oldPath = tree.getRowKey();
tree.setClientRowKey(currencyStr);
tree.getSelectedRowKeys().clear();
tree.getSelectedRowKeys().add();
tree.setRowKey(oldPath);
}
}
示例6: containsPprTargets
/**
* Check if a NamingContainer has any partial targets
*/
public static boolean containsPprTargets(
RenderingContext rc,
UIComponent component,
String clientId)
{
// This function can only be called with NamingContainers, so
// throw an exception if anyone tries otherwise
if (!(component instanceof NamingContainer))
throw new IllegalArgumentException();
// If PPR is off (ppc == null), or we're already rendering
// (isInsidePartialTarget()), then we have to render, so return true
PartialPageContext ppc = rc.getPartialPageContext();
if ((ppc == null) || ppc.isInsidePartialTarget())
return true;
// And if we're a partial target ourselves, return true
if (ppc.isPartialTarget(clientId))
return true;
// See if anything starts with our prefix
String clientIdPrefix = clientId + NamingContainer.SEPARATOR_CHAR;
Iterator<String> targets = ppc.getPartialTargets();
while (targets.hasNext())
{
String target = targets.next();
if (target == null)
continue;
// Found one!
if (target.startsWith(clientIdPrefix))
return true;
}
// Couldn't find any: bail
return false;
}
示例7: _renderIconID
private void _renderIconID(
FacesContext fc,
TableRenderingContext tContext
) throws IOException
{
// we need to render a unique ID for the expand/collapse link, so that
// PPR can restore the focus correctly after a PPR request:
String tableName = tContext.getTable().getContainerClientId(fc);
String id = tableName + NamingContainer.SEPARATOR_CHAR + _ICON_ID;
fc.getResponseWriter().writeAttribute("id", id, null);
}
示例8: __findNodeByScopedId
/**
* Search the supplied Node and its descendants for an Element Node with the
* scopedTargetId.
* @param baseNode The base Node of the subtree relative to which the target
* Node is to be found.
* @param scopedTargetId The scoped id of the target node which is to be found.
* This id should be relative from the base Node of the search, with
* NamingContainer.SEPARATOR_CHAR being the separator for fragments. If the
* targetId starts with a NamingContainer.SEPARATOR_CHAR, it is considered
* as an absolute id, and the owner Document will be the base Node of search.
* Examples of scopedTargetId values: 'foo:bar:baz'/':foo:bar:baz'/'foo'.
* @param searchDepth The integer which indicates till how many levels deeper
* from the baseNode, the search has to be performed.
* @return The target Node with the given scopedTargetId if found within the
* permitted searchDepth, else null
*/
static Node __findNodeByScopedId(
Node baseNode,
String scopedTargetId,
int searchDepth)
{
if (baseNode == null ||
scopedTargetId == null ||
scopedTargetId.length() == 0)
return null;
// Check if we have received an absolute id.
if (NamingContainer.SEPARATOR_CHAR == scopedTargetId.charAt(0))
{
// If so directly deal with the owner Document.
if (baseNode.getNodeType() != Node.DOCUMENT_NODE)
baseNode = baseNode.getOwnerDocument();
// Remove leading ':'
scopedTargetId = scopedTargetId.substring(1);
}
// 'foo:bar:baz' -> ['foo'],['bar'},['baz']
String[] idFrags =
scopedTargetId.split(String.valueOf(NamingContainer.SEPARATOR_CHAR));
return _traceNodeByIdPath(baseNode, idFrags, 0, searchDepth);
}
示例9: __getSelectionParameterName
/**
* Get the name of the parameter for the selection; package-private
* for testing.
*/
static String __getSelectionParameterName(
FacesContext context,
UIComponent table)
{
return (table.getClientId(context) +
NamingContainer.SEPARATOR_CHAR +
XhtmlConstants.SELECTED_KEY);
}
示例10: _validateId
/**
* <p>Verify that the specified component id is safe to add to the tree.
* </p>
*
* @param id The proposed component id to check for validity
*
* @exception IllegalArgumentException if <code>id</code>
* is <code>null</code> or contains invalid characters
*/
private void _validateId(String id)
{
if (id == null)
return;
int n = id.length();
if (0 == n ||
NamingContainer.SEPARATOR_CHAR == id.charAt(0))
_throwBadId(id);
for (int i = 0; i < n; i++)
{
char c = id.charAt(i);
if (i == 0)
{
if (!Character.isLetter(c) && (c != '_'))
_throwBadId(id);
}
else
{
if (!(Character.isLetter(c) ||
Character.isDigit(c) ||
(c == '-') || (c == '_')))
{
_throwBadId(id);
}
}
}
}
示例11: renderControlBarLinks
@Override
protected void renderControlBarLinks(
FacesContext context,
RenderingContext rc,
TableRenderingContext tContext,
UIComponent component,
boolean useDivider
) throws IOException
{
boolean hasExpandAll = isExpandAllEnabled(component);
super.renderControlBarLinks(context, rc, tContext, component,
hasExpandAll || useDivider);
if (hasExpandAll && supportsScripting(rc)) //not in printable mode
{
// must render these IDs so that PPR can restore the focus correctly:
String preId = component.getClientId(context) + NamingContainer.SEPARATOR_CHAR;
TreeTableRenderingContext hContext = (TreeTableRenderingContext) tContext;
String onclick =
TreeUtils.callJSExpandAll(hContext.getUIXTreeTable(),
tContext.getJSVarName(),
true /*isExpand*/);
renderControlBarLink(context, rc, onclick, _EXPAND_ALL_TEXT_KEY,
rc.getIcon(SkinSelectors.AF_TREE_TABLE_EXPAND_ALL_ICON_NAME),
preId+"eAll", true);
onclick =
TreeUtils.callJSExpandAll(hContext.getUIXTreeTable(),
tContext.getJSVarName(),
false /*isExpand*/);
renderControlBarLink(context, rc, onclick, _COLLAPSE_ALL_TEXT_KEY,
rc.getIcon(SkinSelectors.AF_TREE_TABLE_COLLAPSE_ALL_ICON_NAME),
preId+"cAll", useDivider);
}
}
示例12: _addSubtreeClientId
private void _addSubtreeClientId(String clientId)
{
// Loop over the client id and find the substring corresponding to
// each ancestor NamingContainer client id. For each ancestor
// NamingContainer, add an entry into the map for the full client
// id.
char separator = NamingContainer.SEPARATOR_CHAR;
int length = clientId.length();
for (int i = 0; i < length; i++)
{
if (clientId.charAt(i) == separator)
{
// We found an ancestor NamingContainer client id - add
// an entry to the map.
String namingContainerClientId = clientId.substring(0, i);
// Check to see whether we've already ids under this
// NamingContainer client id. If not, create the
// Collection for this NamingContainer client id and
// stash it away in our map
Collection<String> c = _subtreeClientIds.get(namingContainerClientId);
if (c == null)
{
// TODO: smarter initial size?
c = new ArrayList<String>();
_subtreeClientIds.put(namingContainerClientId, c);
}
// Stash away the client id
c.add(clientId);
}
}
}
示例13: _getColonCount
private static int _getColonCount(String relativeId)
{
int idLength = relativeId.length();
int colonCount = 0;
while (colonCount < idLength)
{
if (relativeId.charAt(colonCount) != NamingContainer.SEPARATOR_CHAR)
break;
colonCount++;
}
return colonCount;
}
示例14: getId
/**
*
* @param id String
* @param baseId String
* @return String
*/
private static String getId(String id, String baseId)
{
String separator = "" + NamingContainer.SEPARATOR_CHAR;
String[] idSplit = id.split(separator);
String[] baseIdSplit = baseId.split(separator);
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < baseIdSplit.length - idSplit.length; i++)
{
buffer.append(baseIdSplit[i]);
buffer.append(separator);
}
buffer.append(id);
return buffer.toString();
}
示例15: renderPathElement
/**
* Render a path element as a clickable link
*
* @param context FacesContext
* @param control UIComponent to get attributes from
* @param nodeRef NodeRef of the path element
* @param label Display label to output with this link
*
* @return HTML for a descendant link
*/
private String renderPathElement(FacesContext context, UIComponent control, NodeRef nodeRef, String label)
{
StringBuilder buf = new StringBuilder(256);
buf.append("<a href='#' onclick=\"");
// build an HTML param that contains the client Id of this control, followed by the node Id
String param = control.getClientId(context) + NamingContainer.SEPARATOR_CHAR + nodeRef.getId();
buf.append(Utils.generateFormSubmit(context, control, getHiddenFieldName(context, control), param));
buf.append('"');
Map attrs = control.getAttributes();
if (attrs.get("style") != null)
{
buf.append(" style=\"")
.append(attrs.get("style"))
.append('"');
}
if (attrs.get("styleClass") != null)
{
buf.append(" class=")
.append(attrs.get("styleClass"));
}
buf.append('>');
buf.append(Utils.encode(label));
buf.append("</a>");
return buf.toString();
}