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


Java VisitContext.getFacesContext方法代码示例

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


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

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

示例2: isSkipIterationVisit

import javax.faces.component.visit.VisitContext; //导入方法依赖的package包/类
/**
 * @param visitContext
 * @return <code>true</code> if this is a non-iterating visit.
 */
public static boolean isSkipIterationVisit(VisitContext visitContext)
{
  FacesContext context = visitContext.getFacesContext();
  Map<Object, Object> attrs = context.getAttributes();
  Object skipIteration = attrs.get("javax.faces.visit.SKIP_ITERATION");

  return Boolean.TRUE.equals(skipIteration);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:13,代码来源:ComponentUtils.java

示例3: partialEncodeVisit

import javax.faces.component.visit.VisitContext; //导入方法依赖的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;
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:54,代码来源:UIXComponent.java

示例4: visitDataChildren

import javax.faces.component.visit.VisitContext; //导入方法依赖的package包/类
protected boolean visitDataChildren(VisitContext visitContext, VisitCallback callback, boolean visitRows) throws IOException {
    if (visitRows) {
        final FacesContext facesContext = visitContext.getFacesContext();

        final ChildrenTreeDataVisitor dataVisitor = new ChildrenTreeDataVisitor(callback, visitContext, this);
        this.walk(facesContext, dataVisitor);
        return dataVisitor.getVisitResult();
    } else {
        return visitComponents(getFacetsAndChildren(), visitContext, callback);
    }
}
 
开发者ID:ButterFaces,项目名称:ButterFaces,代码行数:12,代码来源:UIDataAdaptor.java

示例5: requiresRowIteration

import javax.faces.component.visit.VisitContext; //导入方法依赖的package包/类
private boolean requiresRowIteration(VisitContext ctx) {
	boolean shouldIterate = !ctx.getHints().contains(VisitHint.SKIP_ITERATION);
	if (!shouldIterate) {
		FacesContext faces = ctx.getFacesContext();
		String sourceId = faces.getExternalContext().getRequestParameterMap().get("javax.faces.source");
		boolean containsSource = sourceId != null
				? sourceId.startsWith(super.getClientId(faces) + getSeparatorChar(faces))
				: false;
		return containsSource;
	} else {
		return shouldIterate;
	}
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:14,代码来源:TabRepeat.java

示例6: visitChildren

import javax.faces.component.visit.VisitContext; //导入方法依赖的package包/类
private boolean visitChildren(VisitContext context, VisitCallback callback) {
	Integer begin = this.getBegin();
	Integer end = this.getEnd();
	Integer step = this.getStep();

	int rowCount = getDataModel().getRowCount();
	int i = ((begin != null) ? begin : 0);
	int e = ((end != null) ? end : rowCount);
	int s = ((step != null) ? step : 1);
	validateIterationControlValues(rowCount, i, e);
	FacesContext faces = context.getFacesContext();
	this.setIndex(faces, i);
	this.updateIterationStatus(faces, new IterationStatus(true, (i + s > e || rowCount == 1), i, begin, end, step));
	while (i < e && this.isIndexAvailable()) {

		this.setIndex(faces, i);
		this.updateIterationStatus(faces, new IterationStatus(false, i + s >= e, i, begin, end, step));
		for (UIComponent kid : getChildren()) {
			if (kid.visitTree(context, callback)) {
				return true;
			}
		}
		i += s;
	}

	return false;
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:28,代码来源:TabRepeat.java

示例7: visitTree

import javax.faces.component.visit.VisitContext; //导入方法依赖的package包/类
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,代码行数:42,代码来源:Table.java

示例8: visitTree

import javax.faces.component.visit.VisitContext; //导入方法依赖的package包/类
@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,代码行数:68,代码来源:TabRepeat.java


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