本文整理匯總了Java中javax.faces.component.UIComponent.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java UIComponent.getChildren方法的具體用法?Java UIComponent.getChildren怎麽用?Java UIComponent.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.component.UIComponent
的用法示例。
在下文中一共展示了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);
}
}
}
}
示例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;
}
示例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;
}
示例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++;
}
}
示例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);
}
}
示例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;
}
示例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));
}
示例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
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}