本文整理汇总了Java中javax.faces.component.visit.VisitContext类的典型用法代码示例。如果您正苦于以下问题:Java VisitContext类的具体用法?Java VisitContext怎么用?Java VisitContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisitContext类属于javax.faces.component.visit包,在下文中一共展示了VisitContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import javax.faces.component.visit.VisitContext; //导入依赖的package包/类
public VisitResult visit(
VisitContext context,
UIComponent target)
{
try
{
// we have the subtree we want, render it
target.encodeAll(context.getFacesContext());
}
catch (IOException ioe)
{
// launder the IOException as a FacesException, we'll unwrap this later
throw new FacesException(ioe);
}
PartialPageContext pprContext = RenderingContext.getCurrentInstance().getPartialPageContext();
// if we finished rendering all of the destired targets, return that we are
// done. Otherwise, reject this subtree so that we don't traverse into it, since
// we have already rendered all of the targets in it
if (pprContext.areAllTargetsProcessed())
return VisitResult.COMPLETE;
else
return VisitResult.REJECT;
}
示例2: _processExecute
import javax.faces.component.visit.VisitContext; //导入依赖的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);
}
示例3: visit
import javax.faces.component.visit.VisitContext; //导入依赖的package包/类
public VisitResult visit(VisitContext context, UIComponent target)
{
if (_phaseId == PhaseId.APPLY_REQUEST_VALUES)
{
target.processDecodes(_context);
}
else if (_phaseId == PhaseId.PROCESS_VALIDATIONS)
{
target.processValidators(_context);
}
else if (_phaseId == PhaseId.UPDATE_MODEL_VALUES)
{
target.processUpdates(_context);
}
// No need to visit children, since they will be executed/rendred by their parents
return VisitResult.REJECT;
}
示例4: partialEncodeVisit
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
}
示例5: visitChildrenForEncoding
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例6: visitChildren
import javax.faces.component.visit.VisitContext; //导入依赖的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);
}
示例7: visitAllChildren
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例8: visitUnstampedFacets
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例9: _visitStampedColumnFacets
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例10: _visitChildrenIterating
import javax.faces.component.visit.VisitContext; //导入依赖的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: _visitChildrenIterating
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例12: visitData
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例13: visitData
import javax.faces.component.visit.VisitContext; //导入依赖的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;
}
示例14: visit
import javax.faces.component.visit.VisitContext; //导入依赖的package包/类
@Override
public VisitResult visit(VisitContext context, UIComponent target) {
FacesContext facesContext = context.getFacesContext();
Collection<String> executeIds = facesContext.getPartialViewContext().getExecuteIds();
if (executeIds.contains(target.getClientId(facesContext))) {
return VisitResult.REJECT;
}
if (target instanceof EditableValueHolder) {
((EditableValueHolder) target).resetValue();
}
else if (context.getIdsToVisit() != VisitContext.ALL_IDS) {
// Render ID didn't specifically point an EditableValueHolder. Visit all children as well.
if (!SKIP_COMPONENTS.contains(target.getClass())) {
try {
target.visitTree(createVisitContext(facesContext, null, context.getHints()), VISIT_CALLBACK);
} catch (Exception e) {
// e.printStackTrace();
}
}
}
return VisitResult.ACCEPT;
}
示例15: visit
import javax.faces.component.visit.VisitContext; //导入依赖的package包/类
@Override
public VisitResult visit(final VisitContext context, final UIComponent target) {
// if (!target.isRendered()) {
// return VisitResult.REJECT;
// }
if (target instanceof UIInput) {
this.inputs.add((UIInput) target);
}
if (target instanceof UIForm) {
this.forms.add((UIForm) target);
}
if (target instanceof UICommand) {
this.commands.add((UICommand) target);
}
if (target instanceof UIOutput) {
this.outputs.add((UIOutput) target);
}
if (target instanceof UISubmenu) {
this.subMenus.add((UISubmenu) target);
}
if (target instanceof Column) {
this.columns.add((Column) target);
}
if (target instanceof DataTable) {
this.tables.add((DataTable) target);
}
if (target instanceof UISelectItems) {
this.selectItems.add((UISelectItems) target);
}
if (target instanceof PanelGrid) {
this.panelGrids.add((PanelGrid) target);
}
return VisitResult.ACCEPT;
}