Java Code Examples for javax.faces.component.UIComponent.encodeAll()

The following are Jave code examples for showing how to use encodeAll() of the javax.faces.component.UIComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: myfaces-trinidad   File: PanelPartialRootRenderer.java   Source Code and License Vote up 6 votes
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;
}
 
Example 2
Project: myfaces-trinidad   File: UIXGroupTemplate.java   Source Code and License Vote up 6 votes
/**
 * Renders the children in their raw form.
 * There is no Renderer for this component because it has no
 * visual representation or any sort of layout for its children.
 * @param context the FacesContext
 * @throws IOException if there is an error encoding the children
 */
@Override
public void encodeChildren(FacesContext context) throws IOException
{
  if (context == null)
    throw new NullPointerException();

  if (!isRendered())
    return;

  if (getChildCount() > 0)
  {
    for(UIComponent child : (List<UIComponent>)getChildren())
    {
      child.encodeAll(context);
    }
  }
}
 
Example 3
Project: myfaces-trinidad   File: PartialViewContextImpl.java   Source Code and License Vote up 5 votes
private static void _renderChildren(FacesContext context, UIComponent root) throws IOException
{
  Iterator<UIComponent> iterator = root.getFacetsAndChildren();
  while (iterator.hasNext())
  {
    UIComponent child = iterator.next();
    if (child.isRendered())
      child.encodeAll(context);
  }
}
 
Example 4
Project: myfaces-trinidad   File: CoreRenderer.java   Source Code and License Vote up 5 votes
/**
 * Hook for rendering the component resources for the <code>target</code>.
 * @param context Current <code>FacesContext</code> object for this request.
 * @param target The target for the resources (e.g. head/body/form)
 *
 * @throws IOException
 */
protected final void encodeComponentResources(
  FacesContext context,
  String       target
  ) throws IOException
{
  if(target != null)
  {
    UIViewRoot viewRoot = context.getViewRoot();
    for(UIComponent componentResource : viewRoot.getComponentResources(context, target))
    {
      componentResource.encodeAll(context);
    }
  }
}
 
Example 5
Project: myfaces-trinidad   File: CoreRenderer.java   Source Code and License Vote up 5 votes
/**
 * Hook for encoding a child;  this assumes that isRendered()
 * has already been called. (RenderUtils.encodeRecursive()
 * can be used if you don't need that check.)
 * =-=AEW Ugh.
 */
@SuppressWarnings("unchecked")
protected void encodeChild(
  FacesContext context,
  UIComponent  child
  ) throws IOException
{
  child.encodeAll(context);
}
 
Example 6
Project: myfaces-trinidad   File: UIXComponentBase.java   Source Code and License Vote up 5 votes
/**
 * render a component. this is called by renderers whose
 * getRendersChildren() return true.
 * @deprecated {@link UIComponent#encodeAll(FacesContext)} should be used instead of this method
 */
@Deprecated
void __encodeRecursive(FacesContext context, UIComponent component)
  throws IOException
{
  component.encodeAll(context);
}
 
Example 7
Project: myfaces-trinidad   File: UIXSwitcherTemplate.java   Source Code and License Vote up 5 votes
/**
 * Only render the currently active facet.
 */
@Override
public void encodeChildren(FacesContext context)
  throws IOException
{
  UIComponent facet = _getFacet();
  if (facet != null)
  {
    facet.encodeAll(context);
  }
}
 
Example 8
Project: myfaces-trinidad   File: UIXIteratorTemplate.java   Source Code and License Vote up 4 votes
/**
 * Repeatedly render the children as many times as needed.
 */
@Override
public void encodeChildren(final FacesContext context)
  throws IOException
{
  if (!isRendered())
    return;
  
  // if this is the table there will be a rendererType:
  if (getRendererType() != null)
  {
    Renderer renderer = getRenderer(context);
    if (renderer != null)
    {
      renderer.encodeChildren(context, this);
    }
  }
  else // this is not the table. it must be the iterator
  {
    Runner runner = new IndexedRunner(context)
    {
      @Override
      protected void process(
        UIComponent                kid,
        ComponentProcessingContext cpContext
        ) throws IOException
      {
        kid.encodeAll(context);
      }
    };
    runner.run();
    Exception exp = runner.getException();
    if (exp != null)
    {
      if (exp instanceof RuntimeException)
        throw (RuntimeException) exp;

      if (exp instanceof IOException)
        throw (IOException) exp;
      throw new IllegalStateException(exp);
    }
  }
}