当前位置: 首页>>代码示例>>Java>>正文


Java NamingContainer类代码示例

本文整理汇总了Java中javax.faces.component.NamingContainer的典型用法代码示例。如果您正苦于以下问题:Java NamingContainer类的具体用法?Java NamingContainer怎么用?Java NamingContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NamingContainer类属于javax.faces.component包,在下文中一共展示了NamingContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolve

import javax.faces.component.NamingContainer; //导入依赖的package包/类
public List<UIComponent> resolve(UIComponent component, List<UIComponent> parentComponents, String currentId,
		String originalExpression, String[] parameters) {

	List<UIComponent> result = new ArrayList<UIComponent>();
	for (UIComponent parent : parentComponents) {
		UIComponent searchRoot = parent;
		while ((!(searchRoot instanceof UIViewRoot)) && (!(searchRoot instanceof NamingContainer))) {
			searchRoot = searchRoot.getParent();
		}
			
		List<UIComponent> c = findIdsRecursively(searchRoot, parameters[0]);
		if (null != c) {
			result.addAll(c);
		}
	}
	if (result.size() > 0) {
		return result;
	}

	throw new FacesException("Invalid search expression - couldn't find id " + currentId + ". Complete search expression: " + originalExpression);
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:22,代码来源:FindIdRecursiveExpressionResolver.java

示例2: _renderUnsuccessfulField

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * @todo Eliminate the need for this "unsuccessful" field
 */
private void _renderUnsuccessfulField(
  FacesContext          context,
  TableRenderingContext tContext
  ) throws IOException
{
  String unsuccessfulId = (tContext.getTableId() +
                           NamingContainer.SEPARATOR_CHAR +
                           UNSELECTED_KEY);
  String value = ((UIXCollection) tContext.getCollectionComponent()).
              getClientRowKey();

  OutputUtils.renderHiddenField(context,
                                unsuccessfulId,
                                value);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:TableSelectManyRenderer.java

示例3: renderId

import javax.faces.component.NamingContainer; //导入依赖的package包/类
@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);

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:21,代码来源:TableSelectManyRenderer.java

示例4: renderId

import javax.faces.component.NamingContainer; //导入依赖的package包/类
@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);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:TableSelectOneRenderer.java

示例5: addPartialTarget

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * Adds a new partial target to render.
 * <p>
 * This method may be called during the partial rendering pass to
 * add to the set of partial targets, but only if the pass has
 * not yet been completed.  Clients should first check to see
 * whether the partial rendering pass has finished by calling
 * isPartialPassComplete() before calling this method.
 *
 * @param clientId The clientId of the partial target to render
 */
@Override
public void addPartialTarget(String clientId)
{
  _targets.put(clientId, Boolean.FALSE);
  
  int lastFragmentIndex = clientId.lastIndexOf(NamingContainer.SEPARATOR_CHAR);
  
  String id = (lastFragmentIndex != -1)
                ? clientId.substring(lastFragmentIndex + 1)
                : clientId;
  
  _targetIds.add(id);

  // Update the subtree ids collection
  _addSubtreeClientId(clientId);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:28,代码来源:PartialPageContextImpl.java

示例6: getSubtreeIdsToVisit

import javax.faces.component.NamingContainer; //导入依赖的package包/类
public Collection<String> getSubtreeIdsToVisit(UIComponent component)
{
  // Make sure component is a NamingContainer
  if (!(component instanceof NamingContainer))
  {
    throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
  }

  String clientId = component.getClientId(getFacesContext());
  Collection<String> ids = _subtreeClientIds.get(clientId);

  if (ids == null)
    return Collections.emptyList();
  else
    return Collections.unmodifiableCollection(ids);     
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:PartialPageContextImpl.java

示例7: _createScopedId

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * Transform the <code>scopedIdList</code> of "important" component IDs to 
 * generate the <code>scopedID</code> for the referenced <code>UIComponent</code>.
 * 
 * Uses the <code>scopedIdLength</code>
 */
private static String _createScopedId(int scopedIdLength, List<String> scopedIdList, String componentId)
{
  StringBuilder builder = new StringBuilder(scopedIdLength);

  for (int i = scopedIdList.size() - 1; i >= 0 ; i--)
  {
    builder.append(scopedIdList.get(i));
    builder.append(NamingContainer.SEPARATOR_CHAR);
  }

  builder.append(componentId);
  
  // store the (final) scopedId
  return builder.toString();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:ComponentReference.java

示例8: _buildScopedId

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * Builds the scoped id. Adds the naming container's id and the separator char
 * in a recursive fashion.
 * @param targetComponent The component for which the scoped id needs to be
 * built.
 * @param baseComponent The component relative to which the scoped id for the
 * targetComponent needs to be built.
 * @param builder The StringBuilder which is to store the scoped id.
 * @param isLogical true if the logical scoped id should be returned, false otherwise
 * @return The String value of the scoped id
 */
private static void _buildScopedId(
  UIComponent  targetComponent,
  UIComponent  baseComponent,
  StringBuilder builder,
  boolean isLogical)
{
  UIComponent namingContainer = 
    _getParentNamingContainer(targetComponent, baseComponent, isLogical);

  if (namingContainer != null)
  {
    _buildScopedId(namingContainer, baseComponent, builder, isLogical);
    builder.append(NamingContainer.SEPARATOR_CHAR);
  }
    
  builder.append(targetComponent.getId());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:29,代码来源:ComponentUtils.java

示例9: _findInsideOf

import javax.faces.component.NamingContainer; //导入依赖的package包/类
static private UIComponent _findInsideOf(
  UIComponent from,
  String id)
{
  Iterator<UIComponent> kids = from.getFacetsAndChildren();
  while (kids.hasNext())
  {
    UIComponent kid = kids.next();
    if (id.equals(kid.getId()))
      return kid;

    if (!(kid instanceof NamingContainer))
    {
      UIComponent returned = _findInsideOf(kid, id);
      if (returned != null)
        return returned;
    }
  }

  return null;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:22,代码来源:UIXComponentBase.java

示例10: applyComponentChangesForSubtree

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @param context The FacesContext instance for the current request.
 */
 @Override
public void applyComponentChangesForSubtree(
  FacesContext    context,
  NamingContainer root
  )
{
  String rootId = null;
  
  if (root != null)
  {
    if (!(root instanceof UIComponent))
    {
      throw new IllegalArgumentException(_LOG.getMessage(
        "INVALID_TYPE", root));
    }
    
    rootId = ComponentUtils.getScopedIdForComponent((UIComponent)root, context.getViewRoot());
  }

  _applyComponentChanges(context, rootId);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:26,代码来源:SessionChangeManager.java

示例11: _getScopedIdPrefix

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * Trims the supplied scoped id of the supplied component until its immediate naming container
 *  and returns.
 */
private String _getScopedIdPrefix(UIComponent component, String scopedId)
{
  if (component instanceof NamingContainer)
    return scopedId;
  else
  {
    // remove the component's id from the end
    int separatorIndex = scopedId.lastIndexOf(NamingContainer.SEPARATOR_CHAR);
    
    if (separatorIndex >= 0)
      return scopedId.substring(0, separatorIndex);
    else
    {
      // component was at top level
      return null;
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:MoveChildComponentChange.java

示例12: getContainerClientId

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * Gets the client-id of this component, without any NamingContainers.
 * This id changes depending on the currency Object.
 * Because this implementation uses currency strings, the local client ID is
 * not stable for very long. Its lifetime is the same as that of a
 * currency string.
 * @see #getCurrencyString
 * @return the local clientId
 */
@Override
public final String getContainerClientId(FacesContext context)
{
  String id = getClientId(context);
  String key = getCurrencyString();
  if (key != null)
  {
    StringBuilder bld = __getSharedStringBuilder();
    bld.append(id).append(NamingContainer.SEPARATOR_CHAR).append(key);
    id = bld.toString();
  }

  return id;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:24,代码来源:UIXDecorateCollectionTemplate.java

示例13: decode

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
 */
public void decode(FacesContext context, UIComponent component)
{
   Map requestMap = context.getExternalContext().getRequestParameterMap();
   String fieldId = getHiddenFieldName(context, component);
   String value = (String)requestMap.get(fieldId);
   
   // we encoded the value to start with our Id
   if (value != null && value.startsWith(component.getClientId(context) + NamingContainer.SEPARATOR_CHAR))
   {
      // found a new selected value for this component
      // queue an event to represent the change
      String selectedNodeId = value.substring(component.getClientId(context).length() + 1);
      NodeRef ref = new NodeRef(Repository.getStoreRef(), selectedNodeId);
      
      UINodePath.PathElementEvent event = new UINodePath.PathElementEvent(component, ref); 
      component.queueEvent(event);
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:NodePathLinkRenderer.java

示例14: decode

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
 */
public void decode(FacesContext context, UIComponent component)
{
   Map requestMap = context.getExternalContext().getRequestParameterMap();
   String fieldId = getHiddenFieldName(context, component);
   String value = (String)requestMap.get(fieldId);
   
   // we encoded the value to start with our Id
   if (value != null && value.startsWith(component.getClientId(context) + NamingContainer.SEPARATOR_CHAR))
   {
      value = value.substring(component.getClientId(context).length() + 1);
      
      // found a new selected value for this component
      // queue an event to represent the change
      int separatorIndex = value.indexOf(NamingContainer.SEPARATOR_CHAR);
      String selectedNodeId = value.substring(0, separatorIndex);
      boolean isParent = Boolean.parseBoolean(value.substring(separatorIndex + 1));
      NodeRef ref = new NodeRef(Repository.getStoreRef(), selectedNodeId);
      
      UINodeDescendants.NodeSelectedEvent event = new UINodeDescendants.NodeSelectedEvent(component, ref, isParent); 
      component.queueEvent(event);
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:26,代码来源:NodeDescendantsLinkRenderer.java

示例15: decode

import javax.faces.component.NamingContainer; //导入依赖的package包/类
/**
 * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
 */
public void decode(FacesContext context)
{
   Map requestMap = context.getExternalContext().getRequestParameterMap();
   String fieldId = getHiddenFieldName();
   String value = (String)requestMap.get(fieldId);
   
   if (value != null && value.length() != 0)
   {
      // decode the values - we are expecting an action identifier and an index
      int sepIndex = value.indexOf(NamingContainer.SEPARATOR_CHAR);
      int action = Integer.parseInt(value.substring(0, sepIndex));
      int index = Integer.parseInt(value.substring(sepIndex + 1));
      
      // raise an event to process the action later in the lifecycle
      ClipboardEvent event = new ClipboardEvent(this, action, index);
      this.queueEvent(event);
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:UIClipboardShelfItem.java


注:本文中的javax.faces.component.NamingContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。