Java 类javax.faces.context.PartialViewContext 实例源码

项目:ctsms    文件:ResetInputAjaxActionListener.java   
/**
 * Handle the reset input action as follows, only and only if the current request is an ajax request and the
 * {@link PartialViewContext#getRenderIds()} does not return an empty collection nor is the same as
 * {@link PartialViewContext#getExecuteIds()}: find all {@link EditableValueHolder} components based on
 * {@link PartialViewContext#getRenderIds()} and if the component is not covered by
 * {@link PartialViewContext#getExecuteIds()}, then invoke {@link EditableValueHolder#resetValue()} on the
 * component.
 * @throws IllegalArgumentException When one of the client IDs resolved to a <code>null</code> component. This
 * would however indicate a bug in the concrete {@link PartialViewContext} implementation which is been used.
 */
@Override
public void processAction(ActionEvent event) throws AbortProcessingException {
    FacesContext context = FacesContext.getCurrentInstance();
    PartialViewContext partialViewContext = context.getPartialViewContext();

    if (partialViewContext.isAjaxRequest()) {
        Collection<String> renderIds = getRenderIds(partialViewContext);

        if (!renderIds.isEmpty() && !partialViewContext.getExecuteIds().containsAll(renderIds)) {
            context.getViewRoot().visitTree(createVisitContext(context, renderIds, VISIT_HINTS), VISIT_CALLBACK);
        }
    }

    if (wrapped != null && event != null) {
        wrapped.processAction(event);
    }
}
项目:liferay-newsletter    文件:NewsletterEditController.java   
public void resetPickList() {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    UIViewRoot viewRoot = facesContext.getViewRoot();
    PartialViewContext partialViewContext = facesContext.getPartialViewContext();
    Collection<String> renderIds = partialViewContext.getRenderIds();

    for (String renderId : renderIds) {
        try {
            UIComponent component = viewRoot.findComponent(renderId);
            if (component instanceof PickList) {
                PickList pickList = (PickList) component;
                pickList.resetValue();
            }
        } catch (Exception e) {
            logger.error(e);
        }

        //logger.info("{0} {1}", new Object[]{renderId, component});
    }
}
项目:myfaces-trinidad    文件:PseudoFacesContext.java   
@Override
public PartialViewContext getPartialViewContext()
{
  if (_partialViewContext == null)
  {
    PartialViewContextFactory f = (PartialViewContextFactory)
                    FactoryFinder.getFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY);
    _partialViewContext = f.getPartialViewContext(this);
  }

  return _partialViewContext;
}
项目:ctsms    文件:ResetInputAjaxActionListener.java   
/**
 * Helper method with RichFaces4 hack to return the proper render IDs from the given partial view context.
 * @param partialViewContext The partial view context to return the render IDs for.
 * @return The render IDs.
 */
private static Collection<String> getRenderIds(PartialViewContext partialViewContext) {
    Collection<String> renderIds = partialViewContext.getRenderIds();

    // WARNING: START OF HACK! ------------------------------------------------------------------------------------
    // HACK for RichFaces4 because its ExtendedPartialViewContextImpl class doesn't return its componentRenderIds
    // property on getRenderIds() call when the action is executed using a RichFaces-specific command button/link.
    // See also https://issues.jboss.org/browse/RF-11112
    //if (renderIds.isEmpty() && Hacks.isRichFacesInstalled()) {
    //  renderIds = Hacks.getRichFacesRenderIds();
    //}
    // END OF HACK ------------------------------------------------------------------------------------------------

    return renderIds;
}
项目:myfaces-trinidad    文件:MockFacesContext12.java   
public PartialViewContext getPartialViewContext()
{
  return _mockPartialContext;
}
项目:exmatrikulator    文件:CommonDataController.java   
private boolean isAjaxRequest() {
    PartialViewContext partialViewContext =
            FacesContext.getCurrentInstance().getPartialViewContext();
    return null != partialViewContext && partialViewContext.isAjaxRequest();
}
项目:tornadofaces    文件:TFViewContextFactory.java   
public PartialViewContext getPartialViewContext(FacesContext context) {
    return new TFPartialViewContext(wrapped.getPartialViewContext(context));
}
项目:tornadofaces    文件:TFPartialViewContext.java   
public TFPartialViewContext(PartialViewContext wrapped) {
    this.wrapped = wrapped;
    this.writer = new TFPartialResponseWriter(wrapped.getPartialResponseWriter());
}
项目:tornadofaces    文件:TFPartialViewContext.java   
public PartialViewContext getWrapped() {
    return wrapped;
}
项目:clap    文件:BaseController.java   
protected boolean isAjaxRequest() {
    PartialViewContext partialViewContext = FacesContext.getCurrentInstance().getPartialViewContext();
    return partialViewContext != null && partialViewContext.isAjaxRequest();
}
项目:jbromo    文件:AlternativeFacesContext.java   
@Override
public PartialViewContext getPartialViewContext() {
    return FacesContextUtil.getFacesContext().getPartialViewContext();
}
项目:liferay-newsletter    文件:JsfUtil.java   
public static void addPartialViewRender(String id) {
    PartialViewContext pcontext = FacesContext.getCurrentInstance().getPartialViewContext();
    if (pcontext != null) {
        pcontext.getRenderIds().add(id);
    }
}
项目:myfaces-trinidad    文件:PartialViewContextFactoryImpl.java   
/**
 * Creates a PartialViewContext instance that is optimized for Trinidad PPR.
 * @param context 
 * @return a PartialViewContext instance
 */
public PartialViewContext getPartialViewContext(FacesContext context)
{
  return new PartialViewContextImpl(context);
}