本文整理汇总了Java中javax.faces.component.visit.VisitResult类的典型用法代码示例。如果您正苦于以下问题:Java VisitResult类的具体用法?Java VisitResult怎么用?Java VisitResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisitResult类属于javax.faces.component.visit包,在下文中一共展示了VisitResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import javax.faces.component.visit.VisitResult; //导入依赖的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: visit
import javax.faces.component.visit.VisitResult; //导入依赖的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;
}
示例3: partialEncodeVisit
import javax.faces.component.visit.VisitResult; //导入依赖的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;
}
}
示例4: invokeVisitCallback
import javax.faces.component.visit.VisitResult; //导入依赖的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);
}
示例5: visit
import javax.faces.component.visit.VisitResult; //导入依赖的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;
}
示例6: visit
import javax.faces.component.visit.VisitResult; //导入依赖的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;
}
示例7: safeVisitTree
import javax.faces.component.visit.VisitResult; //导入依赖的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;
}
示例8: safeVisitTree
import javax.faces.component.visit.VisitResult; //导入依赖的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;
}
示例9: partialEncodeVisit
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
/**
* <p>
* Called when visiting the component during optimized partial page encoding so that the
* component 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 delegates to the CoreRenderer if this component has one, otherwise
* it 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 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,
VisitCallback callback)
{
FacesContext context = visitContext.getFacesContext();
Renderer renderer = getRenderer(context);
if (renderer instanceof CoreRenderer)
{
// delegate to the CoreRenderer
return ((CoreRenderer)renderer).partialEncodeVisit(visitContext,
partialContext,
this,
callback);
}
else
{
// check that this is a component instance that should be encoded
if (partialContext.isPossiblePartialTarget(getId()) &&
partialContext.isPartialTarget(getClientId(context)))
{
// visit the component instance
return callback.visit(visitContext, this);
}
else
{
// Not visiting this component, but allow visit to
// continue into this subtree in case we've got
// visit targets there.
return VisitResult.ACCEPT;
}
}
}
示例10: invokeVisitCallback
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
@Override
public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback)
{
if (component instanceof UIXColumn)
{
if (component.getFacetCount() > 0)
{
// visit the facet children without filtering for just UIXColumn children
for (UIComponent facetChild : component.getFacets().values())
{
if (UIXComponent.visitTree(getWrapped(), facetChild, callback))
return VisitResult.COMPLETE;
}
// visit the indexed children, recursively looking for more columns
for (UIComponent child : component.getChildren())
{
if (UIXComponent.visitTree(this, child, callback))
return VisitResult.COMPLETE;
}
}
}
// at this point, we either have already manually processed the UIXColumn's children, or
// the component wasn't a UIXColumn and shouldn't be processed
return VisitResult.REJECT;
}
示例11: visitTree
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
@Override
public boolean visitTree(VisitContext context, VisitCallback callback) {
if (!isVisitable(context)) {
return false;
}
// Check for the current component
VisitResult res = context.invokeVisitCallback(this, callback);
if (res == VisitResult.COMPLETE) return true;
if (res == VisitResult.ACCEPT) {
// we should visit the children if we have ids (all or selected) to visit
boolean visitChildren = !context.getSubtreeIdsToVisit(this).isEmpty();
if (visitChildren) {
// visit the component facets
UIComponent facet = selectFacet();
if(facet!=null) {
try {
if(facet.visitTree(context, callback)) {
return true;
}
} finally {
unselectFacet();
}
}
}
}
return false;
}
示例12: visit
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
public VisitResult visit(VisitContext context, UIComponent component) {
refreshCache(context, component);
boolean valid = true;
for (QueryFilter filter : getFilters()) {
if (!filter.matches(component, FacesContext
.getCurrentInstance())) {
valid = false;
break;
}
}
if (valid) {
List<VisitCallback> forEach = getCallbacks();
for (VisitCallback each : forEach) {
each.visit(context, component);
}
add(component);
/*
* List<VisitCallback> forEach = getCallbacks(); for
* (VisitCallback each : forEach) { VisitResult thisResult =
* each.visit(context, component); switch
* (thisResult.compareTo(VisitResult.ACCEPT)) { case 1: //
* REJECT return thisResult; case 2: // COMPLETE add(component);
* return thisResult; } add(component); }
*/
}
return VisitResult.ACCEPT;
}
示例13: visit
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
public VisitResult visit(final VisitContext context, final UIComponent component) {
refreshCache(context, component);
boolean valid = true;
for (QueryFilter filter : getFilters()) {
if (!filter.matches(component, FacesContext
.getCurrentInstance())) {
valid = false;
break;
}
}
if (valid) {
List<VisitCallback> forEach = getCallbacks();
for (VisitCallback each : forEach) {
each.visit(context, component);
}
add(component);
/*
* List<VisitCallback> forEach = getCallbacks(); for
* (VisitCallback each : forEach) { VisitResult thisResult =
* each.visit(context, component); switch
* (thisResult.compareTo(VisitResult.ACCEPT)) { case 1: //
* REJECT return thisResult; case 2: // COMPLETE add(component);
* return thisResult; } add(component); }
*/
}
return VisitResult.ACCEPT;
}
示例14: invokeVisitCallback
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
public VisitResult invokeVisitCallback(UIComponent component,
VisitCallback callback)
{
// First sure that we should visit this component - ie.
// that this component is represented in our id set.
VisitResult result;
if (component instanceof UIXComponent)
{
// delegate to the UIXComponent to let it control partial encoding behavior
result = ((UIXComponent)component).partialEncodeVisit(this,
PartialPageContextImpl.this,
callback);
}
else
{
// check that this component should be encoded
if (_targetIds.contains(component.getId()) &&
_targets.containsKey(component.getClientId(_context)))
{
// If we made it this far, the component matches one of
// client ids, so perform the visit.
result = callback.visit(this, component);
}
else
{
// Not visiting this component, but allow visit to
// continue into this subtree in case we've got
// visit targets there.
result = VisitResult.ACCEPT;
}
}
// If we've encoded everything.
// Return VisitResult.COMPLETE to terminate the visit.
if (areAllTargetsProcessed())
return VisitResult.COMPLETE;
else
{
// Otherwise, just return the callback's result
return result;
}
}
示例15: invokeVisitCallback
import javax.faces.component.visit.VisitResult; //导入依赖的package包/类
@Override
public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback) {
return callback.visit(this, component);
}