当前位置: 首页>>代码示例>>Java>>正文


Java VisitResult.ACCEPT属性代码示例

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


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

示例1: partialEncodeVisit

/**
 * <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;
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:39,代码来源:CoreRenderer.java

示例2: visit

@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;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:25,代码来源:ResetInputAjaxActionListener.java

示例3: visit

@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;
}
 
开发者ID:kiswanij,项目名称:jk-faces,代码行数:36,代码来源:UIFacesVisitor.java

示例4: safeVisitTree

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;
}
 
开发者ID:OpenNTF,项目名称:xsp.extlib,代码行数:21,代码来源:XspQuery.java

示例5: safeVisitTree

@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;
}
 
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:22,代码来源:XspQuery.java

示例6: partialEncodeVisit

/**
 * <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;
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:53,代码来源:UIXComponent.java

示例7: invokeVisitCallback

@Override
public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback)
{
  if (component instanceof UIXColumn)
  {
    if (component.getChildCount() > 0)
    {
      // visit only the indexed children of the columns
      for (UIComponent child : component.getChildren())
      {
        if (UIXComponent.visitTree(this, child, callback))
          return VisitResult.COMPLETE;
      }
    }

    return VisitResult.REJECT;
  }
  else
  {
    // Components do not expect to be visited twice, in fact with UIXComponent, it is illegal.
    // This is due to the fact that UIXComponent has setup and tearDown methods for visiting.
    // In order to avoid having the setup method called for the current visit context and
    // the wrapped context we invoke the visit on the component and then separately on the
    // children of the component
    VisitContext wrappedContext = getWrapped();
    VisitResult visitResult = wrappedContext.invokeVisitCallback(component, callback);

    if (visitResult == VisitResult.ACCEPT)
    {
      // Let the visitation continue with the wrapped context
      return (UIXComponent.visitChildren(wrappedContext, component, callback)) ?
        VisitResult.COMPLETE : VisitResult.REJECT;
    }
    else
    {
        return visitResult;
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:39,代码来源:UIXCollection.java

示例8: visitTree

@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;
  }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:27,代码来源:UISwitchFacet.java

示例9: visit

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;
}
 
开发者ID:OpenNTF,项目名称:xsp.extlib,代码行数:27,代码来源:XspQuery.java

示例10: visit

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;
}
 
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:27,代码来源:XspQuery.java

示例11: invokeVisitCallback

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;
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:43,代码来源:PartialPageContextImpl.java

示例12: visitTree

public boolean visitTree(VisitContext context, VisitCallback callback) {
	// Perform UIComponent's version of visitTree, then UIData's visitTree. If we don't,
	// the RowExpansion will not be found, so it won't be rendered. This should be better
	// understood and optimized.

	if (!isVisitable(context))
		return false;

	// Push ourselves to EL before visiting
	FacesContext facesContext = context.getFacesContext();
	pushComponentToEL(facesContext, null);

	try {
		// Visit ourselves.  Note that we delegate to the
		// VisitContext to actually perform the visit.
		VisitResult result = context.invokeVisitCallback(this, callback);

		// If the visit is complete, short-circuit out and end the visit
		if (result == VisitResult.COMPLETE)
			return true;

		// Visit children if necessary
		if (result == VisitResult.ACCEPT) {
			Iterator<UIComponent> kids = this.getFacetsAndChildren();

			while(kids.hasNext()) {
				boolean done = kids.next().visitTree(context, callback);

				// If any kid visit returns true, we are done.
				if (done)
					return true;
			}
		}
	}
	finally {
		// Pop ourselves off the EL stack
		popComponentFromEL(facesContext);
	}

	return super.visitTree(context, callback);
}
 
开发者ID:edvin,项目名称:tornadofaces,代码行数:41,代码来源:Table.java

示例13: visitTree

@Override
public boolean visitTree(VisitContext context, VisitCallback callback) {

	if (this.getVar() == null) {
		return super.visitTree(context, callback);
	}

	// First check to see whether we are visitable. If not
	// short-circuit out of this subtree, though allow the
	// visit to proceed through to other subtrees.
	if (!isVisitable(context)) {
		return false;
	}

	FacesContext facesContext = context.getFacesContext();
	boolean visitRows = requiresRowIteration(context);

	int oldRowIndex = -1;
	if (visitRows) {
		oldRowIndex = getDataModel().getRowIndex();
		setIndex(facesContext, -1);
	}

	this.setDataModel(null);

	// Push ourselves to EL
	pushComponentToEL(facesContext, null);

	try {

		// Visit ourselves. Note that we delegate to the
		// VisitContext to actually perform the visit.
		VisitResult result = context.invokeVisitCallback(this, callback);

		// If the visit is complete, short-circuit out and end the visit
		if (result == VisitResult.COMPLETE) {
			return true;
		}

		// Visit children, short-circuiting as necessary
		if ((result == VisitResult.ACCEPT) && doVisitChildren(context)) {

			// And finally, visit rows
			if (!visitRows) {
				// visit rows without model access
				for (UIComponent kid : getChildren()) {
					if (kid.visitTree(context, callback)) {
						return true;
					}
				}
			} else {
				if (visitChildren(context, callback)) {
					return true;
				}
			}
		}
	} finally {
		// Clean up - pop EL and restore old row index
		popComponentFromEL(facesContext);
		if (visitRows) {
			setIndex(facesContext, oldRowIndex);
		}
	}

	// Return false to allow the visit to continue
	return false;
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:67,代码来源:TabRepeat.java


注:本文中的javax.faces.component.visit.VisitResult.ACCEPT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。