Java UIComponent.getChildren方法代码示例

本文整理汇总了Java中javax.faces.component.UIComponent.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java UIComponent.getChildren方法的具体用法?Java UIComponent.getChildren怎么用?Java UIComponent.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.component.UIComponent的用法示例。


Java UIComponent.getChildren方法代码示例

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

示例1: resetUIInputChildren

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * Reset the values of all UIInput children. This might be necessary after a
 * validation error to successfully process an AJAX request. See [Bug 5449]
 * and http://wiki.apache.org/myfaces/ClearInputComponents
 * 
 * @param uiComponent
 *            the root component to be processed.
 */
public static void resetUIInputChildren(UIComponent uiComponent) {
    if (uiComponent != null) {
        List<UIComponent> children = uiComponent.getChildren();
        for (UIComponent child : children) {
            if (child instanceof UIInput) {
                UIInput uiInput = (UIInput) child;
                uiInput.setSubmittedValue(null);
                uiInput.setValue(null);
                uiInput.setLocalValueSet(false);
            } else {
                resetUIInputChildren(child);
            }
        }
    }
} 
开发者ID:servicecatalog,项目名称:oscm,代码行数:24,代码来源:JSFUtils.java

示例2: _findChildById

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static UIComponent _findChildById(UIComponent uic, String id)
{
  int numChildren = uic.getChildCount();
  if (numChildren == 0)
    return null;
  List<UIComponent> children = uic.getChildren();
  UIComponent child = null;
  for (int i=0; i<numChildren; i++)
  {
    child = children.get(i);
    if (id.equals(child.getId()))
      return child;
  }
  return null;
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:ChangeBean.java

示例3: getChildForId

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * Given a parent component and the identifier value for the child, looks up among
 * the children for a child with the specified identifier and returns.
 * Returns null if there were to be no such child
 * @param parent the parent UIComponent
 * @param childId the identifier value of child to be searched in the parent's 
 *        children.
 * @param identifier the identifier type 
 */
@SuppressWarnings("unchecked")
public static UIComponent getChildForId(
  UIComponent parent, 
  String childId,
  String identifier)
{
  if (parent == null)
    return null;

  int numChildren = parent.getChildCount();
  if (numChildren == 0)
    return null;

  List<UIComponent> children = parent.getChildren();
  
  for (int i=0; i<numChildren; i++)
  {
    UIComponent child = children.get(i);
    Object attrVal = child.getAttributes().get(identifier);
    
    if ( childId.equals(attrVal) )
      return child;
  }
  return null;
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:35,代码来源:ChangeUtils.java

示例4: _renderChildren

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void _renderChildren(
  FacesContext context,
  UIComponent  component,
  NodeData     parentNode
  ) throws IOException
{
  int i = 0;
  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    if (child.isRendered())
    {
      // Tell the parent node - if there is one - which child we're rendering
      if (parentNode != null)
      {
        parentNode.currentChild = i;
      }

      encodeChild(context, child);
    }

    i++;
  }
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:25,代码来源:ColumnGroupRenderer.java

示例5: restoreChildStampState

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * Restore the stamp state of just the children of the given component
 * in the given table.
 */
@SuppressWarnings("unchecked")
public static void restoreChildStampState(
  FacesContext context,
  UIComponent stamp,
  UIXCollection table,
  Object stampState)
{
  if (stampState == null || !(stampState instanceof Map))
    return;

  List<UIComponent> kids = stamp.getChildren();
  Map<String, Object> state = (Map<String, Object>)stampState;

  for (UIComponent kid : kids)
  {
    Object childState = state.get(kid.getId());
    if (childState == null)
      continue;

    table.restoreStampState(context, kid, childState);
  }
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:27,代码来源:StampState.java

示例6: getRenderedChildCount

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * Returns the total number of children with rendered=="true".
 */
@SuppressWarnings("unchecked")
static public int getRenderedChildCount(
  UIComponent component)
{
  int count = component.getChildCount();
  if (count == 0)
    return 0;

  int total = 0;
  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    if (child.isRendered())
    {
      total++;
    }
  }

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

示例7: changeComponent

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void changeComponent(UIComponent uiComponent)
{
  if (uiComponent.getChildCount() == 0)
    return;
    
  List<UIComponent> children = uiComponent.getChildren();
  children.remove(ChangeUtils.getChildForId(uiComponent, _childId, _identifier));
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:14,代码来源:RemoveChildComponentChange.java

示例8: _findAndEncodeChild

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 *  Find and encodes recursivly the child specified.
 *
 *  If the specified child can't be found, doesn't do anything.
 *
 *  @param context the facesContext object
 *  @param parent which contains the child to be encoded
 *  @param disclosedChildId id of the child which occurs in parent
 *         and has to be encoded recursively.
 *
 *  @throws IOException when any IO error while writing markup
 */
@SuppressWarnings("unchecked")
private static void _findAndEncodeChild(FacesContext context,
                                        UIComponent parent,
                                        String disclosedChildId)
  throws IOException
{
  UIComponent disclosedChild = _findChild(context,
                                          parent,
                                          disclosedChildId);

  if (disclosedChild == null)
  {
    return;
  }

  // Paint container span for showDetail child
  ResponseWriter out = context.getResponseWriter();
  out.startElement("span", disclosedChild);

  // Render the children of disclosedChild since the child is disclosed.
  if (disclosedChild.isRendered())
  {
    if (disclosedChild.getChildCount() > 0)
    {
      for(UIComponent child : (List<UIComponent>)disclosedChild.getChildren())
      {
        RenderUtils.encodeRecursive(context, child);
      }
    }
  }

  out.endElement("span");
  // end container span for showDetail child
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:47,代码来源:ShowOneListRendererBase.java

示例9: encodeAllChildren

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void encodeAllChildren(
  FacesContext context,
  UIComponent  component
  ) throws IOException
{
  int childCount = component.getChildCount();
  if (childCount == 0)
    return;

  for (UIComponent child : (List<UIComponent>)component.getChildren())
  {
    encodeChild(context, child);
  }
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:CoreRenderer.java

示例10: createComponent

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * Re-create a component from a structure object
 */
@SuppressWarnings("unchecked")
public UIComponent createComponent()
  throws ClassNotFoundException, InstantiationException,
         IllegalAccessException
{
  Class<?> clazz = ClassLoaderUtils.loadClass(_class);
  UIComponent component = (UIComponent) clazz.newInstance();
  if (_id != null)
    component.setId(_id);
  // Create any facets
  if (_facets != null)
  {
    Map<String, UIComponent> facets = component.getFacets();
    for (int i = 0 ; i < _facets.size(); i += 2)
    {
      UIComponent facet = ((Structure) _facets.get(i + 1)).
                               createComponent();
      facets.put((String)_facets.get(i), facet);
    }
  }

  // Create any children
  if (_children != null)
  {
    List<UIComponent> children = component.getChildren();
    for (int i = 0 ; i < _children.size(); i++)
    {
      UIComponent child = _children.get(i).createComponent();
      children.add(child);
    }
  }

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

示例11: _encodeChildren

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * Render all the children of the PanelGroup
 */
@SuppressWarnings("unchecked")
private void _encodeChildren(
  FacesContext context,
  UIComponent  component,
  boolean      isVertical,
  boolean      isHorizontal
  ) throws IOException
{
  ResponseWriter rw = context.getResponseWriter();

  UIComponent separator = getFacet(component,
                                   CorePanelGroupLayout.SEPARATOR_FACET);

  boolean needSeparator = false;
  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    if (!child.isRendered())
      continue;

    if (needSeparator)
    {
      if (isVertical)
        rw.startElement("div", null);
      encodeSeparator(context, separator, isHorizontal);
      if (isVertical)
        rw.endElement("div");
    }

    encodeChild(context, child, isHorizontal);
    needSeparator = true;
  }
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:36,代码来源:PanelGroupLayoutRenderer.java

示例12: cacheColumnHeaderFooterFacets

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
static void cacheColumnHeaderFooterFacets(UIComponent parent, Map<UIComponent, Boolean> cache)
{
  List<UIComponent> children = parent.getChildren();
  for (UIComponent child : children)
  {
    if (child instanceof UIXColumn)
    {
      cacheHeaderFooterFacets(child, cache);
      cacheColumnHeaderFooterFacets(child, cache);
    }
  }
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:13,代码来源:TableUtils.java

示例13: renderKids

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void renderKids(
  FacesContext          context,
  RenderingContext      rc,
  TableRenderingContext trc,
  UIComponent           column
  ) throws IOException
{
  boolean renderedOne = false;
  for(UIComponent child : (List<UIComponent>)column.getChildren())
  {
    if (child.isRendered())
    {
      // Put each component on a separate line, separated by a div
      if (renderedOne)
      {
        ResponseWriter rw = context.getResponseWriter();
        rw.startElement("div", null);
        rw.endElement("div");
      }
      else
      {
        renderedOne = true;
      }

      encodeChild(context, child);
    }
  }
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:30,代码来源:ColumnRenderer.java

示例14: getSelectItems

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 *
 * @param component  UIComponent
 * @param converter For UISelectItem and UIXSelectItem children of the
 *                  component, use the converter to convert itemValue Strings
 *                  when creating the javax.faces.model.SelectItem Object if
 *                  the child's value is not an instanceof SelectItem.
 * @param filteredItems to exclude SelectItemGroup components
 * @return a List of javax.faces.model.SelectItem Objects that we get or
 *         create from the component's children.
 *         OR
 *         java.util.Collections.emptyList if component has no children or
 *         the component isn't a javax.faces.component.ValueHolder. else
 */
@SuppressWarnings("unchecked")
static public List<SelectItem> getSelectItems(
  UIComponent  component,
  Converter    converter,
  boolean filteredItems)
{

  int childCount = component.getChildCount();
  if (childCount == 0)
    return Collections.emptyList();

  // Make sure we haven't accidentally stumbled outside of
  // the UIXSelectXXX world.
  if (!(component instanceof ValueHolder))
    return Collections.emptyList();

  FacesContext context = FacesContext.getCurrentInstance();
  List<SelectItem> items = null;
  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    // f:selectItem
    if (child instanceof UISelectItem)
    {
      if (items == null)
        items = new ArrayList<SelectItem>(childCount);
      _addSelectItem(context, 
                     component, 
                     (UISelectItem) child, 
                     items, 
                     converter);
    }
    // f:selectItems
    else if (child instanceof UISelectItems)
    {
      if (items == null)
        items = new ArrayList<SelectItem>(childCount);
      addSelectItems((UISelectItems) child, items, filteredItems );
    }
    // tr:selectItem
    else if (child instanceof UIXSelectItem)
    {
      if (items == null)
        items = new ArrayList<SelectItem>(childCount);
      _addUIXSelectItem(context,
                        component,
                        (UIXSelectItem) child, 
                        items, 
                        converter);
      

      
    }
  }

  if (items == null)
    return Collections.emptyList();

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

示例15: getSelectItemCount

import javax.faces.component.UIComponent; //导入方法依赖的package包/类
/**
 * 
 * @param component  UIComponent
 * @return item count
 */
@SuppressWarnings("unchecked")
static public int getSelectItemCount(
  UIComponent  component)
{ 
  int itemCount = 0;
  int childCount = component.getChildCount();
  if (childCount == 0)
    return itemCount;

  // Make sure we haven't accidentally stumbled outside of
  // the UIXSelectXXX world.
  if (!(component instanceof ValueHolder))
    return itemCount;

  for(UIComponent child : (List<UIComponent>)component.getChildren())
  {
    if (child instanceof UISelectItem ||
        child instanceof UIXSelectItem)
    {
      itemCount++;
    }
    // f:selectItems
    else if (child instanceof UISelectItems)
    {        
      Object value = ((UISelectItems)child).getValue();
      if (value instanceof SelectItem)
      {
        itemCount++;
      }
      else if (value instanceof Object[])
      {
        Object[] array = (Object[]) value;
        itemCount = itemCount + array.length;
      }
      else if (value instanceof Collection)
      {
        itemCount = itemCount + ((Collection) value).size();  
      }
      else if (value instanceof Map)
      {        
        itemCount = itemCount + ((Map) value).size();  
      }                        
    }
  }
  
  return itemCount;
} 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:53,代码来源:SelectItemSupport.java

本文标签属性:

示例:示例英语

代码:代码转换器

java:java自行车

UIComponent:UIComponent

上一篇:田馥甄为什么单飞?(田馥甄的组合队友都已经结婚了,她为什么一直都没有男朋友?)
下一篇:Java InputMismatchException.printStackTrace方法代码示例

为您推荐