Package org.apache.myfaces.trinidad.context

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



  @SuppressWarnings("unchecked")
  static void service(FacesContext context) throws IOException
  {
    RenderingContext arc = RenderingContext.getCurrentInstance();

    // Don't use HtmlHead or CoreDocument;  these add a stylesheet link,
    // which we don't need or want
    HtmlHtml root = new HtmlHtml();
    context.getViewRoot().getChildren().add(root);

    Map<String, String> requestParameters =
      context.getExternalContext().getRequestParameterMap();
   
    // Save the return ID - and do so before generating the
    // link to the frames!
    String returnId = requestParameters.get(_RETURN_ID_PARAM);
    if (returnId != null)
      CoreRenderKit.saveDialogPostbackValues(returnId);

    CoreOutputText headStart = new CoreOutputText();
    root.getChildren().add(headStart);
    headStart.setEscape(false);
    headStart.setValue("<head>");

    CoreImportScript cis = new CoreImportScript();
    cis.setNames(new String[]{"Core"});
    root.getChildren().add(cis);

    // The block-reload script only happens to work on IE, but may someday
    // work on Mozilla as well.
    HtmlScript script = new HtmlScript();
    script.setText(_BLOCK_RELOAD_TEXT + _FIX_DIALOG_TITLE);
    root.getChildren().add(script);

    CoreOutputText headEnd = new CoreOutputText();
    root.getChildren().add(headEnd);
    headStart.setEscape(false);
    headStart.setValue("</head>");

    HtmlFrame contentFrame = new HtmlFrame();
    String contentStr = arc.getTranslatedString(_FRAME_CONTENT);
    if (contentStr == null)
      contentStr = _DEFAULT_CONTENT_STRING;

    contentFrame.setShortDesc(contentStr); // for accessibility
    contentFrame.setLongDescURL("#");     // for accessibility
    contentFrame.setHeight("100%");
    contentFrame.setWidth("100%");

    // Get the query string.
    // trim out any "_t" parameter, which was only used to get here.
    // trim out any sizing parameters
    // trim out any redirect parameters
    String queryString = _getQueryString(
       context.getExternalContext().getRequestParameterValuesMap());

    // grab any sizing parameters
    String widthParam = requestParameters.get(_MIN_WIDTH_PARAM);
    boolean gotWidth = (widthParam != null);

    String heightParam = requestParameters.get(_MIN_HEIGHT_PARAM);
    boolean gotHeight = (heightParam != null);

    String viewIdRedirect = requestParameters.get(_VIEW_ID_REDIRECT_PARAM);
    if (viewIdRedirect != null)
    {
      ViewHandler vh =
        context.getApplication().getViewHandler();
      // Prepend an extra slash to avoid re-prepending the context path
      String redirectString = "/" + vh.getActionURL(context,
                                                    viewIdRedirect);
      // if redirectString contains ?, append queryString with &,
      // otherwise append queryString with &
      char sep = (redirectString.indexOf('?') != -1) ? '&' : '?';
      contentFrame.setSource(redirectString + sep + queryString);
    }
    else
    {
      String internalRedirect = requestParameters.get("_red");
      if (internalRedirect != null)
      {
        String path = GenericEntry.getGenericEntryURL(context,
                                                      internalRedirect);
        // Prepend an extra slash to avoid re-prepending the context path
        contentFrame.setSource("/" + path + "&" + queryString);
      }
    }

    HtmlFrameBorderLayout frameSet = new HtmlFrameBorderLayout();
    frameSet.setShortDesc(contentStr); // for accessibility
    frameSet.setCenter(contentFrame);
    // this border attribute is a "secret" attribute set to fix
    // 4339153 DIALOGS IN FIREFOX HAVE WHITE LINE AT THE BOTTOM
    frameSet.getAttributes().put("border", Boolean.FALSE);
    // see bug 3198336 apss accessibility violations
    CoreOutputText alternateContent = new CoreOutputText();
    alternateContent.setValue(arc.getTranslatedString("NO_FRAMES_MESSAGE"));
    frameSet.setAlternateContent(alternateContent);

    // Set the title to the title of the content, and then shrink (or expand)
    // the window to fit the content.  The 25 pixel fudge factor is purely
    // a hack to handle calendarDialog, which regularly needs to grow
View Full Code Here


    {
      writer.writeAttribute("type", type.toLowerCase(), "type");
      writer.writeAttribute("value", label, "value");
    }
   
    RenderingContext arc = RenderingContext.getCurrentInstance();
    String script = AutoSubmitUtils.getFullPageSubmitScript(
              arc, id, false,
              null/*no event*/,
              null,
              false/* return false*/);
 
View Full Code Here

  private void _writeScript(FacesContext context,
                            UIComponent component,
                            String js)
    throws IOException
  {
    RenderingContext arc = RenderingContext.getCurrentInstance();

    ResponseWriter writer = context.getResponseWriter();
   
    writer.startElement("script", null);
    XhtmlRenderer.renderScriptDeferAttribute(context, arc);
View Full Code Here

  /**
   * @return true if we are in inaccessible mode
   */
  public static boolean isInaccessibleMode(UIXRenderingContext context)
  {
    RenderingContext rc = RenderingContext.getCurrentInstance();
    return rc.getAccessibilityMode() ==
       RequestContext.Accessibility.INACCESSIBLE;
  }
View Full Code Here

  /**
   * @return true if we are in screen reader mode
   */
  public static boolean isScreenReaderMode(UIXRenderingContext context)
  {
    RenderingContext rc = RenderingContext.getCurrentInstance();
    return rc.getAccessibilityMode() ==
       RequestContext.Accessibility.SCREEN_READER;
  }
View Full Code Here

    // Get the Icon objects that we'll use to render this messageBox.
    IconData icons = _getIconData(context);
    int columnCount = _getColumnCount(icons);
   
    FacesContext fContext = context.getFacesContext();
    RenderingContext arc = RenderingContext.getCurrentInstance();
    // Render the top row if we have one
    if (_hasTopRow(icons))
      _renderTopRow(fContext, arc, icons, columnCount);

    // Start the contents row
View Full Code Here

    // Get the Icon objects that we'll use to render this messageBox.
    IconData icons = _getIconData(context);
    int columnCount = _getColumnCount(icons);
   
    FacesContext fContext = context.getFacesContext();
    RenderingContext arc = RenderingContext.getCurrentInstance();
   
    // Close up the contents row
    _endContentsRow(fContext, arc, icons);

    // Render the bottom row if we have one
View Full Code Here

  {

    ResponseWriter writer = context.getResponseWriter();

    MarlinBean text = new MarlinBean(STYLED_TEXT_NAME);
    RenderingContext arc = RenderingContext.getCurrentInstance();
    FacesContext fContext = context.getFacesContext();
    icon.renderIcon(fContext, arc, null);

    if (icon != null)
      writer.write("&nbsp;");
View Full Code Here

    // Get the Icon objects that we'll use to render this sideBar.
    IconData icons = _getIconData(context);
    int columnCount = _getColumnCount(icons);

    FacesContext fContext = context.getFacesContext();
    RenderingContext arc = RenderingContext.getCurrentInstance();

    // Render the top row if we have one
    if (_hasTopRow(icons))
      _renderTopRow(fContext, arc, icons, columnCount);
View Full Code Here

    // Get the Icon objects that we'll use to render this sideBar.
    IconData icons = _getIconData(context);
    int columnCount = _getColumnCount(icons);

    FacesContext fContext = context.getFacesContext();
    RenderingContext arc = RenderingContext.getCurrentInstance();
   
    // Close up the contents row
    _endContentsRow(fContext, arc, icons);

View Full Code Here

TOP

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

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.