Package org.apache.myfaces.trinidad.context

Examples of org.apache.myfaces.trinidad.context.PartialPageContext


  {
    FacesContext fContext = __getFacesContext();

    RenderingContext afContext = RenderingContext.getCurrentInstance();

    PartialPageContext pContext = null;

    if (afContext != null)
      pContext = afContext.getPartialPageContext();

    // find the nearest ancestor that generates html markup:
    newTarget = _getNearestPPRTarget(newTarget);

    Object savedKey = null;
    // =-=AEW Force the rowkey of a collection back to null so that the clientId
    // will be correct.  Note that in JSF 1.2, this will be unnecessary
    if (newTarget instanceof UIXCollection)
    {
      savedKey = ((UIXCollection) newTarget).getRowKey();
      if (savedKey != null)
        ((UIXCollection) newTarget).setRowKey(null);
    }

    String clientId = newTarget.getClientId(fContext);

    // Restore the row key
    if (savedKey != null)
    {
      ((UIXCollection) newTarget).setRowKey(savedKey);
    }

    _LOG.finer("Adding partial target: {0}", newTarget);

    if (pContext != null)
    {
      pContext.addPartialTarget(clientId);
    }
    else
    {
      // If we haven't built the partial context yet, maintain a list of the
      // target IDs that have requested partial update.
View Full Code Here


   */
  public static boolean isPartialRenderingPass(
    RenderingContext arc
    )
  {
    PartialPageContext pprContext = arc.getPartialPageContext();
    return (pprContext != null);
  }
View Full Code Here

  {
    FacesContext fContext = __getFacesContext();

    RenderingContext afContext = RenderingContext.getCurrentInstance();

    PartialPageContext pContext = null;

    if (afContext != null)
      pContext = afContext.getPartialPageContext();

    // find the nearest ancestor that generates html markup:
    newTarget = _getNearestPPRTarget(newTarget);

    Object savedKey = null;
    // =-=AEW Force the rowkey of a collection back to null so that the clientId
    // will be correct.  Note that in JSF 1.2, this will be unnecessary
    if (newTarget instanceof UIXCollection)
    {
      savedKey = ((UIXCollection) newTarget).getRowKey();
      if (savedKey != null)
        ((UIXCollection) newTarget).setRowKey(null);
    }

    String clientId = newTarget.getClientId(fContext);

    // Restore the row key
    if (savedKey != null)
    {
      ((UIXCollection) newTarget).setRowKey(savedKey);
    }

    _LOG.finer("Adding partial target: {0}", newTarget);

    if (pContext != null)
    {
      pContext.addPartialTarget(clientId);
    }
    else
    {
      // If we haven't built the partial context yet, maintain a list of the
      // target IDs that have requested partial update.
View Full Code Here

  {
    String noJavaScriptSupport = "false";
    ResponseWriter writer = context.getResponseWriter();

    String formName = rc.getFormData().getName();
    PartialPageContext pprContext = rc.getPartialPageContext();

    // Write out the hidden form field that identifies which
    // form is the one being submitted
    writer.startElement("input", null);
    writer.writeAttribute("type", "hidden", null);
View Full Code Here

   */
  public static boolean isPartialRenderingPass(
    RenderingContext arc
    )
  {
    PartialPageContext pprContext = arc.getPartialPageContext();
    return (pprContext != null);
  }
View Full Code Here

  {
    // Don't bother if PPR isn't even supported
    if (!CoreRendererUtils.supportsPartialRendering(this))
      return;

    PartialPageContext partialPageContext =
      PartialPageUtils.createPartialPageContext(fContext,
                                                context);

    _pprContext = partialPageContext;
  }
View Full Code Here

    //VAC isPIE variable added for bug 4526850
    boolean isPIE = Agent.PLATFORM_PPC.equalsIgnoreCase(
                        arc.getAgent().getPlatformName());

    String formName = arc.getFormData().getName();
    PartialPageContext pprContext = arc.getPartialPageContext();
    // Downcast to pprContext to have access to push and pop
    // TODO: Create the span with a bogus component where
    // getClientId() returns the postscriptId;  this avoids
    // the need for push and pop calls - you just need to
    // call addPartialTarget().  Or, come up with a better
View Full Code Here

    if (PartialPageUtils.isPartialRenderingPass(arc))
    {
      // Mark that PPR is in fact active
      PartialPageUtils.markPPRActive(context);
      PartialPageContext pprContext = arc.getPartialPageContext();

      XhtmlRenderer.enableScriptDeferring(arc, true);

      ResponseWriter saved = context.getResponseWriter();
      ScriptBufferingResponseWriter scriptBufferingWriter =
View Full Code Here

  private void _renderPartialScripts(
    FacesContext                  context,
    RenderingContext           arc,
    ScriptBufferingResponseWriter scriptBufferingWriter) throws IOException
  {
    PartialPageContext pprContext = arc.getPartialPageContext();
    if (_shouldRenderPartialScripts(pprContext))
    {
      Iterator<String> targets = pprContext.getRenderedPartialTargets();
      String scripts = scriptBufferingWriter.getBufferedScripts();

      ResponseWriter writer = context.getResponseWriter();
      // For XMLDOM, write out all the PPR scripts and the
      // PPR targets as XML elements
      if (supportsXMLDOM(arc))
      {
        writer.startElement("pprscripts", null);
        if (scripts != null)
        {
          writer.write("<![CDATA[");
          writer.writeText(scripts, null);
            writer.write("]]>");
        }
        writer.endElement("pprscripts");

        writer.startElement("pprtargets",null);
        while (targets.hasNext())
        {
          String target = targets.next();
          if (pprContext.isPartialTargetRendered(target))
          {
            writer.startElement("pprtarget", null);
            writer.writeAttribute("targetid",target,null);
            writer.endElement("pprtarget");
          }
        }

        writer.endElement("pprtargets");
      }
      // Otherwise, write out the targets in a Javascript array,
      // and add a Javascript load handler to load everything up
      else
      {
        // Render the rest of the scripts if necessary
        writer.startElement("script", null);
        writer.writeAttribute("id", _PARTIAL_SCRIPTS_ID, null);
        renderScriptTypeAttribute(context, arc);

        // We comment out all of the script contents to avoid
        // executing the scripts in the iframe.  Our
        // _partialChange() onload handler will explicitly execute
        // the scripts in the parent window's context.
        writer.writeText("/*", null);

        // Render scripts
        if (scripts != null)
          writer.writeText(scripts, null);

        // Close the comment
        writer.writeText("*/", null);

        writer.endElement("script");

        Iterator<Object> libraries =
          scriptBufferingWriter.getBufferedLibraries();

        writer.startElement("script", null);
        XhtmlRenderer.renderScriptTypeAttribute(context, arc);

        writer.writeText("var ", null);
        writer.writeText(_PARTIAL_PAGE_LIBRARIES_VAR, null);
        writer.writeText("=[", null);

        boolean firstRenderedLibrary = true;
        if (libraries != null)
        {
          while (libraries.hasNext())
          {
            if (firstRenderedLibrary)
              firstRenderedLibrary = false;

            String libraryURI = libraries.next().toString();
            writer.writeText("'", null);
            writer.writeText(libraryURI, null);
            writer.writeText("',", null);
          }
        }

        // And include ScriptEval too.
        writer.writeText("'", null);
        writer.writeText(context.getExternalContext().getRequestContextPath(),
                         null);
        writer.writeText(LibraryScriptlet.getBaseLibURL(), null);
        String versionedLibraryName =
          LibraryScriptlet.getLibraryNameWithVersion(context,
                                                     _SCRIPT_EVAL_LIBRARY_NAME);
        writer.writeText(versionedLibraryName, null);
        writer.writeText(".js'", null);

        writer.writeText("];", null);

        writer.writeText("var ", null);
        writer.writeText(_PARTIAL_PAGE_TARGETS_VAR, null);
        writer.writeText("=[", null);

        // Loop through the partial targets and write out ids for any
        // rendered targets.
        boolean firstRenderedTarget = true;

        while (targets.hasNext())
        {
          String target = targets.next();
          if (pprContext.isPartialTargetRendered(target))
          {
            if (firstRenderedTarget)
              firstRenderedTarget = false;
            else
              writer.writeText(",", null);
View Full Code Here

  {
    FacesContext fContext = __getFacesContext();

    RenderingContext afContext = RenderingContext.getCurrentInstance();

    PartialPageContext pContext = null;

    if (afContext != null)
      pContext = afContext.getPartialPageContext();

    // find the nearest ancestor that generates html markup:
    newTarget = _getNearestPPRTarget(newTarget);

    Object savedKey = null;
    // =-=AEW Force the rowkey of a collection back to null so that the clientId
    // will be correct.  Note that in JSF 1.2, this will be unnecessary
    if (newTarget instanceof UIXCollection)
    {
      savedKey = ((UIXCollection) newTarget).getRowKey();
      if (savedKey != null)
        ((UIXCollection) newTarget).setRowKey(null);
    }

    String clientId = newTarget.getClientId(fContext);

    // Restore the row key
    if (savedKey != null)
    {
      ((UIXCollection) newTarget).setRowKey(savedKey);
    }

    _LOG.finer("Adding partial target: {0}", newTarget);

    if (pContext != null)
    {
      pContext.addPartialTarget(clientId);
    }
    else
    {
      // If we haven't built the partial context yet, maintain a list of the
      // target IDs that have requested partial update.
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.context.PartialPageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.