本文整理汇总了Java中javax.faces.component.visit.VisitCallback类的典型用法代码示例。如果您正苦于以下问题:Java VisitCallback类的具体用法?Java VisitCallback怎么用?Java VisitCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisitCallback类属于javax.faces.component.visit包,在下文中一共展示了VisitCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _processExecute
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
private void _processExecute(UIViewRoot component, PhaseId phaseId)
{
// We are only handling visit-based (partial) execution here.
// Full execution (isExecuteAll() == true) is handled by the UIViewRoot
// Note that this is different from the render phase
Collection<String> executeIds = getExecuteIds();
if (executeIds == null || executeIds.isEmpty())
{
_LOG.warning("No execute Ids were supplied for the Ajax request");
return;
}
VisitContext visitContext = VisitContext.createVisitContext(_context, executeIds,
EnumSet.of(VisitHint.SKIP_UNRENDERED, VisitHint.EXECUTE_LIFECYCLE));
VisitCallback visitCallback = new ProcessPhaseCallback(_context, phaseId);
component.visitTree(visitContext, visitCallback);
}
示例2: partialEncodeVisit
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* <p>
* Called when visiting the CoreRenderer's component during optimized partial page encoding so
* that the CoreRenderer can modify what is actually encoded. For example tab controls often
* render the tabs for the ShowDetailItems in the tab bar before delegating to the
* disclosed ShowDetailItem to render the tab content. As a result, the tab control
* needs to encode its tab bar if any of its ShowDetailItems are partial targets so that
* the tab labels, for example, are up-to-date.
* </p>
* <p>
* The default implementation calls the VisitCallback and returns its result if this UIXComponent
* is a partial target of the current encoding.
* </p>
* @param visitContext VisitContext to pass to the VisitCallback
* @param partialContext PartialPageContext for the current partial encoding
* @param component The component for the CoreRenderer to visit
* @param callback VisitCallback to call if this component is a partial target
* @return The VisitResult controlling continued iteration of the visit.
*/
public VisitResult partialEncodeVisit(
VisitContext visitContext,
PartialPageContext partialContext,
UIComponent component,
VisitCallback callback)
{
if (partialContext.isPossiblePartialTarget(component.getId()) &&
partialContext.isPartialTarget(component.getClientId(visitContext.getFacesContext())))
{
// visit the component instance
return callback.visit(visitContext, component);
}
else
{
// Not visiting this component, but allow visit to
// continue into this subtree in case we've got
// visit targets there.
return VisitResult.ACCEPT;
}
}
示例3: visitChildrenForEncoding
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* Hook to allow the renderer to customize the visitation of the children components
* of a component during the visitation of a component during rendering.
*
* @param component the component which owns the children to visit
* @param visitContext the visitation context
* @param callback the visit callback
* @return <code>true</code> if the visit is complete.
* @see UIXComponent#visitChildren(VisitContext, VisitCallback)
*/
public boolean visitChildrenForEncoding(
UIXComponent component,
VisitContext visitContext,
VisitCallback callback)
{
// visit the children of the component
Iterator<UIComponent> kids = getRenderedFacetsAndChildren(
visitContext.getFacesContext(), component);
while (kids.hasNext())
{
// If any kid visit returns true, we are done.
if (kids.next().visitTree(visitContext, callback))
{
return true;
}
}
return false;
}
示例4: visitChildren
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* Hook for subclasses to override the manner in which the component's children are visited. The default
* implementation visits all of the children and facets of the Component.
* <code>setupChildrenVisitingContext</code> will have been called before this method is
* invoked and <code>tearDownChildrenVisitingContext</code> will be called after.
* respectively. If the purpose of this visit was to encode the component and the
* component uses a CoreRenderer, the CoreRenderer's
* <code>setupChildrenEncodingContext</code> and <code>tearDownChildrenEncodingContext</code>
* will be called before and after this method is invoked, respectively.
* @param visitContext the <code>VisitContext</code> for this visit
* @param callback the <code>VisitCallback</code> instance
* @return <code>true</code> if the visit is complete.
* @see #setupChildrenVisitingContext
* @see #tearDownChildrenVisitingContext
* @see org.apache.myfaces.trinidad.render.CoreRenderer#setupChildrenEncodingContext
* @see org.apache.myfaces.trinidad.render.CoreRenderer#tearDownChildrenEncodingContext
*/
protected boolean visitChildren(
VisitContext visitContext,
VisitCallback callback)
{
// See if this is during encoding, if so, allow the renderer to control the visitation of
// the children so that any special encoding context may be applied around the visitation
// of each child.
if (_isEncodingVisit(visitContext))
{
Renderer renderer = getRenderer(visitContext.getFacesContext());
if (renderer instanceof CoreRenderer)
{
CoreRenderer coreRenderer = (CoreRenderer)renderer;
return coreRenderer.visitChildrenForEncoding(this, visitContext, callback);
}
}
// visit all of the children of the component
return visitAllChildren(visitContext, callback);
}
示例5: visitAllChildren
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* Default implementation of visiting children that visits all children without iterating
* @param visitContext the <code>VisitContext</code> for this visit
* @param callback the <code>VisitCallback</code> instance
* @return <code>true</code> if the visit is complete.
*/
protected final boolean visitAllChildren(
VisitContext visitContext,
VisitCallback callback)
{
// visit the children of the component
Iterator<UIComponent> kids =
visitContext.getHints().contains(VisitHint.SKIP_UNRENDERED) ?
getRenderedFacetsAndChildren(visitContext.getFacesContext()) :
getFacetsAndChildren();
while (kids.hasNext())
{
// If any kid visit returns true, we are done.
if (kids.next().visitTree(visitContext, callback))
{
return true;
}
}
return false;
}
示例6: visitUnstampedFacets
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* Hook method for subclasses to override to change the behavior
* of how unstamped facets of the UIXCollection are visited. The
* Default implementation visits all of the facets of the
* UIXCollection.
*/
protected boolean visitUnstampedFacets(
VisitContext visitContext,
VisitCallback callback)
{
// Visit the facets with no row
if (getFacetCount() > 0)
{
for (UIComponent facet : getFacets().values())
{
if (UIXComponent.visitTree(visitContext, facet, callback))
{
return true;
}
}
}
return false;
}
示例7: _visitStampedColumnFacets
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* Implementation used to visit each stamped row
*/
private boolean _visitStampedColumnFacets(
VisitContext visitContext,
VisitCallback callback)
{
// visit the facets of the stamped columns
List<UIComponent> stamps = getStamps();
if (!stamps.isEmpty())
{
VisitContext columnVisitingContext = new ColumnFacetsOnlyVisitContext(visitContext);
for (UIComponent stamp : stamps)
{
if (UIXComponent.visitTree(columnVisitingContext, stamp, callback))
{
return true;
}
}
}
return false;
}
示例8: invokeVisitCallback
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
@Override
public VisitResult invokeVisitCallback(
UIComponent component,
VisitCallback visitCallback)
{
if (component instanceof UIXShowDetail)
{
UIXShowDetail showDetail = (UIXShowDetail)component;
if (_isShowDetailForCurrentComponent(showDetail))
{
if (_foundItemToRender || !isChildSelected(showDetail))
{
// We already visited the one to be shown
return VisitResult.REJECT;
}
else
{
_foundItemToRender = true;
}
}
}
return super.invokeVisitCallback(component, visitCallback);
}
示例9: _visitChildrenIterating
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
private boolean _visitChildrenIterating(
VisitContext visitContext,
VisitCallback callback)
{
boolean done = visitData(visitContext, callback);
if (!done)
{
// process the children
int childCount = getChildCount();
if (childCount > 0)
{
for (UIComponent child : getChildren())
{
done = UIXComponent.visitTree(visitContext, child, callback);
if (done)
break;
}
}
}
return done;
}
示例10: _visitChildrenIterating
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
private boolean _visitChildrenIterating(
VisitContext visitContext,
VisitCallback callback)
{
boolean done = visitData(visitContext, callback);
if (!done)
{
// process the children
int childCount = getChildCount();
if (childCount > 0)
{
for (UIComponent child : getChildren())
{
done = UIXComponent.visitTree(visitContext, child, callback);
if (done)
break;
}
}
}
return done;
}
示例11: visitData
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
@Override
protected boolean visitData(
VisitContext visitContext,
VisitCallback callback)
{
Object oldKey = getRowKey();
Object focusPath = getFocusRowKey();
setRowKey(focusPath);
boolean done;
try
{
done = visitLevel(visitContext, callback, getStamps());
}
finally
{
setRowKey(oldKey);
}
return done;
}
示例12: visitData
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
@Override
protected boolean visitData(
VisitContext visitContext,
VisitCallback callback)
{
Object oldKey = getRowKey();
boolean done;
try
{
HierarchyUtils.__setStartDepthPath(this, getLevel());
done = visitLevel(visitContext, callback, getStamps());
}
finally
{
setRowKey(oldKey);
}
return done;
}
示例13: safeVisitTree
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
public static boolean safeVisitTree(VisitContext context,
VisitCallback callback, UIComponent component) {
if (!(isVisitable(context, component))) {
return false;
}
VisitResult res = context.invokeVisitCallback(component, callback);
if (res == VisitResult.COMPLETE) {
return true;
}
if ((res == VisitResult.ACCEPT)
&& (((component.getChildCount() > 0) || (component
.getFacetCount() > 0)))) {
for (Iterator it = component.getFacetsAndChildren(); it.hasNext();) {
UIComponent c = (UIComponent) it.next();
if (safeVisitTree(context, callback, c)) {
return true;
}
}
}
return false;
}
示例14: safeVisitTree
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static boolean safeVisitTree(final VisitContext context,
final VisitCallback callback, final UIComponent component) {
if (!(isVisitable(context, component))) {
return false;
}
VisitResult res = context.invokeVisitCallback(component, callback);
if (res == VisitResult.COMPLETE) {
return true;
}
if ((res == VisitResult.ACCEPT)
&& (((component.getChildCount() > 0) || (component
.getFacetCount() > 0)))) {
for (Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
UIComponent c = it.next();
if (safeVisitTree(context, callback, c)) {
return true;
}
}
}
return false;
}
示例15: visitSingleComponent
import javax.faces.component.visit.VisitCallback; //导入依赖的package包/类
/**
* Visit a single component in the component tree starting from the view root.
* <p>Method assumes the {@link RequestContext} is available and a view root must be set on the faces context.</p>
*
* @param facesContext the faces context
* @param clientId the client ID of the component to visit
* @param visitCallback the callback to be invoked if the component is found
* @return true if a component was visited
*/
public static boolean visitSingleComponent(
FacesContext facesContext,
String clientId,
VisitCallback visitCallback)
{
VisitContext visitContext = VisitContext.createVisitContext(facesContext,
Collections.singleton(clientId), null);
return UIXComponent.visitTree(visitContext, facesContext.getViewRoot(), visitCallback);
}