private void _render()

in trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MediaRenderer.java [1045:1229]


  private void _render(
    FacesContext     context,
    RenderingContext rc,
    UIComponent      component,
    FacesBean        bean,
    String           contentType,
    String           id,
    String           wireImageToControls,
    String           source,
    String           standbyText,
    String           width,
    String           height,
    String           autostartValue,
    String           playCountParamName,
    Object           playCountParamValue,
    PlayerData       playerData,
    ControlData      controlData,
    boolean          useEmbedTag,
    boolean          useObjectTag,
    boolean          isImage,
    boolean          isNotMainID
    ) throws IOException
  {
    String elementName = (isImage)
                             ? "img"
                             : (useEmbedTag)
                                 ? "embed"
                                 : "object";

    // name of attribute to use to write out source URL
    String sourceAttrName = "src";

    ResponseWriter writer = context.getResponseWriter();

    // start the element
    writer.startElement(elementName, component);
    renderAllAttributes(context, rc, component, bean);

    writer.writeAttribute("width", width, null);
    writer.writeAttribute("height", height, null);

    if (!isImage)
    {

      //
      // <embed> uses direct attributes
      //
      if (useEmbedTag)
      {

        // embed doesn't support id, use name instead
        writer.writeAttribute("name", id, null );

        // =-= bts, we might only want to do this if the client has specified
        //     that they want this particular player
        writer.writeAttribute("type", playerData.playerMimeType, null);

        // location to download new plug-in from
        writer.writeAttribute("pluginspage", playerData.pluginsPage, null);

        // autostart
        writer.writeAttribute(playerData.autostartParamName, autostartValue, null);

        // looping
        writer.writeAttribute(playCountParamName, playCountParamValue, null);

        // wire image window to controls
        writer.writeAttribute(playerData.wireImageToControlsParamName,
                              wireImageToControls,
                              null);

        // add in control attributes
        if (controlData != null)
        {
          String[] paramNameValues = controlData.paramNameValues;

          if (paramNameValues != null)
          {
            for (int i = 0; i < paramNameValues.length; i += 2)
            {
              writer.writeAttribute(paramNameValues[i], paramNameValues[i+1], null);
            }
          }
        }
      }
      else
      {
        if (!isNotMainID )
          writer.writeAttribute("id", id, null);

        // Object tag doesn't take a source attribute
        sourceAttrName = null;

        // override the content type with a player-specified type
        // =-= bts What does this do?
        if (playerData.overrideContentType != null)
        {
          contentType = playerData.overrideContentType;
        }

        // =-= bts maybe we should have a default message
        writer.writeAttribute("standby", standbyText, null);

        // mime-type of content
        writer.writeAttribute("type", contentType, null);

        // Class ID
        writer.writeAttribute("classid", playerData.classID, null);

        // Download location
        writer.writeAttribute("codebase", playerData.codeBase, null);
      }
    }

    // write out the source if any
    if (sourceAttrName != null)
    {
      renderEncodedResourceURI(context, sourceAttrName, source);
    }

    //
    // write out Object tag content
    //
    if (useObjectTag)
    {
      //
      // render the parameters to the player
      //

      // source of content
      _renderParamAttribute(context,
                            playerData.sourceParamName,
                            source,
                            true);

      // autostart
      _renderParamAttribute(context,
                            playerData.autostartParamName,
                            autostartValue,
                            false);

      // looping
      _renderParamAttribute(context,
                            playCountParamName,
                            playCountParamValue,
                            false);

      // wire image window to controls
      if ( playerData.wireImageToControlsParamName != null )
      {
        _renderParamAttribute(context,
                              playerData.wireImageToControlsParamName,
                              wireImageToControls,
                              false);
      }

      // add in control attributes
      if (controlData != null )
      {
        String[] paramNameValues = controlData.paramNameValues;

        if (paramNameValues != null)
        {
          for (int i = 0; i < paramNameValues.length; i += 2)
          {
            _renderParamAttribute(context,
                                  paramNameValues[i],
                                  paramNameValues[i + 1],
                                  false);
          }
        }
      }

      //
      // render the link as alternative content
      //
      // =-=bts I feel that our backup rendering should be an icon that
      //        we retrieve using a pretected method
      //
      _renderLink(context, rc, component, bean, null, source, null, contentType);
    }

    // close the element
    writer.endElement(elementName);
  }