Examples of HtmlHtml


Examples of com.gargoylesoftware.htmlunit.html.HtmlHtml

        // take the WebResponse of the opener (not really correct, but...)
        final WebResponse webResponse = openerWindow.getEnclosedPage().getWebResponse();
        final HtmlPage popupPage = new HtmlPage(null, webResponse, popupPseudoWindow);
        setDomNode(popupPage);
        popupPseudoWindow.setEnclosedPage(popupPage);
        final HtmlHtml html = (HtmlHtml) HTMLParser.getFactory(HtmlHtml.TAG_NAME).createElement(
                popupPage, HtmlHtml.TAG_NAME, null);
        popupPage.appendChild(html);
        final HtmlBody body = (HtmlBody) HTMLParser.getFactory(HtmlBody.TAG_NAME).createElement(
                popupPage, HtmlBody.TAG_NAME, null);
        html.appendChild(body);

        document_.setDomNode(popupPage);
    }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

  {
    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
    // a line or two.  A better method that accounts for font heights
    // would be good...

    // Bug #2464627: Allow support for forcing a minimum size
    StringBuffer onload = new StringBuffer(_FRAMESET_ONLOAD_TEXT.length()
                                           // space for the param plus the 'W:'
                                           + (gotWidth
                                              ? widthParam.length() + 2
                                              : 0)
                                           // space for the param plus the 'H:'
                                           + (gotHeight
                                              ? heightParam.length() + 2
                                              : 0)
                                           // space for commas, brackets,
                                           // and closing paren
                                           + 5);

    onload.append(_FRAMESET_ONLOAD_TEXT);
    if (gotWidth || gotHeight)
    {
      // open the parameter object
      onload.append(",{");
      if (gotWidth)
      {
        // add in the width parameter
        onload.append("W:");
        onload.append(widthParam);
      }
      if (gotHeight)
      {
        // If something preceded this param, separate with a comma
        if (gotWidth)
          onload.append(",");
        onload.append("H:");
        onload.append(heightParam);
      }
      // close the parameter object
      onload.append("}");
    }
    // close the handler
    onload.append(")");

    frameSet.setOnload(onload.toString());
    frameSet.setOnunload(_FRAMESET_ONUNLOAD_TEXT);
    root.getChildren().add(frameSet);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

    RenderingContext arc = RenderingContext.getCurrentInstance();
    arc.getPartialPageContext().addPartialTarget(
              requestParams.get(XhtmlConstants.SOURCE_PARAM));

    // Use Html and Body to avoid the cost of the stylesheet
    HtmlHtml html = new HtmlHtml();
    context.getViewRoot().getChildren().add(html);

    HtmlBody body = new HtmlBody();
    html.getChildren().add(body);

    body.getChildren().add(CalendarUtils.createChooseDate(context));
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

  {
    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);
    headEnd.setEscape(false);
    headEnd.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
    // a line or two.  A better method that accounts for font heights
    // would be good...

    // Bug #2464627: Allow support for forcing a minimum size
    StringBuilder onload = new StringBuilder(_FRAMESET_ONLOAD_TEXT.length()
                                           // space for the param plus the 'W:'
                                           + (gotWidth
                                              ? widthParam.length() + 2
                                              : 0)
                                           // space for the param plus the 'H:'
                                           + (gotHeight
                                              ? heightParam.length() + 2
                                              : 0)
                                           // space for commas, brackets,
                                           // and closing paren
                                           + 5);

    onload.append(_FRAMESET_ONLOAD_TEXT);
    if (gotWidth || gotHeight)
    {
      // open the parameter object
      onload.append(",{");
      if (gotWidth)
      {
        // add in the width parameter
        onload.append("W:");
        onload.append(widthParam);
      }
      if (gotHeight)
      {
        // If something preceded this param, separate with a comma
        if (gotWidth)
          onload.append(",");
        onload.append("H:");
        onload.append(heightParam);
      }
      // close the parameter object
      onload.append("}");
    }
    // close the handler
    onload.append(")");

    frameSet.setOnload(onload.toString());
   
    // http://issues.apache.org/jira/browse/ADFFACES-191   
    // Following code was once in CoreRenderKit.launchDialog.

    if (returnId != null)
    {
      StringBuilder onunload = new StringBuilder(53 + returnId.length());
      onunload.append(_FRAMESET_ONUNLOAD_TEXT);
      onunload.append(";window.opener.setTimeout(");
      onunload.append("'ADFDialogReturn[").append(returnId).append("]();'");
      onunload.append(",1)");
      frameSet.setOnunload(onunload.toString());
    }
    else
    {
      frameSet.setOnunload(_FRAMESET_ONUNLOAD_TEXT);
    }

    root.getChildren().add(frameSet);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

  {
    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!
    // We parse to a long to help avoid cross-site scripting attacks
    Long returnId = JspUtils.longValueOfParam(requestParameters, _RETURN_ID_PARAM);
   
    String returnIdString;
   
    if (returnId != null)
    {
      returnIdString = returnId.toString();
      CoreRenderKit.saveDialogPostbackValues(returnIdString);
    }
    else
    {
      returnIdString = null;
    }
   
    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);
    headEnd.setEscape(false);
    headEnd.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.  We convert these to their parsed parameters to avoid
    // cross site scripting injects attacks
    Integer width = JspUtils.integerValueOfParam(requestParameters, _MIN_WIDTH_PARAM);
    boolean gotWidth = (width != null);

    Integer height = JspUtils.integerValueOfParam(requestParameters, _MIN_HEIGHT_PARAM);
    boolean gotHeight = (height != 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
    // a line or two.  A better method that accounts for font heights
    // would be good...

    // Bug #2464627: Allow support for forcing a minimum size
    StringBuilder onload = new StringBuilder(_FRAMESET_ONLOAD_TEXT.length()
                                           // space for the max param (5 digits) plus the 'W:'
                                           + 7
                                           // space for the max param (5 digits) plus the 'H:'
                                           + 7
                                           // space for commas, brackets,
                                           // and closing paren
                                           + 5);

    onload.append(_FRAMESET_ONLOAD_TEXT);
    if (gotWidth || gotHeight)
    {
      // open the parameter object
      onload.append(",{");
      if (gotWidth)
      {
        // add in the width parameter
        onload.append("W:");
        onload.append(width);
      }
      if (gotHeight)
      {
        // If something preceded this param, separate with a comma
        if (gotWidth)
          onload.append(",");
        onload.append("H:");
        onload.append(height);
      }
      // close the parameter object
      onload.append("}");
    }
    // close the handler
    onload.append(")");

    frameSet.setOnload(onload.toString());
   
    // http://issues.apache.org/jira/browse/ADFFACES-191   
    // Following code was once in CoreRenderKit.launchDialog.

    if (returnId != null)
    {
      StringBuilder onunload = new StringBuilder(53 + 20); // allow 20 digits for the returnId
      onunload.append(_FRAMESET_ONUNLOAD_TEXT);
      onunload.append(";window.opener.setTimeout(");
      onunload.append("'ADFDialogReturn[").append(returnIdString).append("]();'");
      onunload.append(",1)");
      frameSet.setOnunload(onunload.toString());
    }
    else
    {
      frameSet.setOnunload(_FRAMESET_ONUNLOAD_TEXT);
    }

    root.getChildren().add(frameSet);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

    RenderingContext arc = RenderingContext.getCurrentInstance();
    arc.getPartialPageContext().addPartialTarget(
              requestParams.get(XhtmlConstants.SOURCE_PARAM));

    // Use Html and Body to avoid the cost of the stylesheet
    HtmlHtml html = new HtmlHtml();
    context.getViewRoot().getChildren().add(html);

    HtmlBody body = new HtmlBody();
    html.getChildren().add(body);

    body.getChildren().add(CalendarUtils.createChooseDate(context));
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

  {
    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!
    // We parse to a long to help avoid cross-site scripting attacks
    Long returnId = JspUtils.longValueOfParam(requestParameters, _RETURN_ID_PARAM);
   
    String returnIdString;
   
    if (returnId != null)
    {
      returnIdString = returnId.toString();
      CoreRenderKit.saveDialogPostbackValues(returnIdString);
    }
    else
    {
      returnIdString = null;
    }
   
    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);
    headEnd.setEscape(false);
    headEnd.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.  We convert these to their parsed parameters to avoid
    // cross site scripting injects attacks
    Integer width = JspUtils.integerValueOfParam(requestParameters, _MIN_WIDTH_PARAM);
    boolean gotWidth = (width != null);

    Integer height = JspUtils.integerValueOfParam(requestParameters, _MIN_HEIGHT_PARAM);
    boolean gotHeight = (height != 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
    // a line or two.  A better method that accounts for font heights
    // would be good...

    // Bug #2464627: Allow support for forcing a minimum size
    StringBuilder onload = new StringBuilder(_FRAMESET_ONLOAD_TEXT.length()
                                           // space for the max param (5 digits) plus the 'W:'
                                           + 7
                                           // space for the max param (5 digits) plus the 'H:'
                                           + 7
                                           // space for commas, brackets,
                                           // and closing paren
                                           + 5);

    onload.append(_FRAMESET_ONLOAD_TEXT);
    if (gotWidth || gotHeight)
    {
      // open the parameter object
      onload.append(",{");
      if (gotWidth)
      {
        // add in the width parameter
        onload.append("W:");
        onload.append(width);
      }
      if (gotHeight)
      {
        // If something preceded this param, separate with a comma
        if (gotWidth)
          onload.append(",");
        onload.append("H:");
        onload.append(height);
      }
      // close the parameter object
      onload.append("}");
    }
    // close the handler
    onload.append(")");

    frameSet.setOnload(onload.toString());
   
    // http://issues.apache.org/jira/browse/ADFFACES-191   
    // Following code was once in CoreRenderKit.launchDialog.

    if (returnId != null)
    {
      StringBuilder onunload = new StringBuilder(53 + 20); // allow 20 digits for the returnId
      onunload.append(_FRAMESET_ONUNLOAD_TEXT);
      onunload.append(";window.opener.setTimeout(");
      onunload.append("'ADFDialogReturn[").append(returnIdString).append("]();'");
      onunload.append(",1)");
      frameSet.setOnunload(onunload.toString());
    }
    else
    {
      frameSet.setOnunload(_FRAMESET_ONUNLOAD_TEXT);
    }

    root.getChildren().add(frameSet);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

      return root;
    }
   
    if (_sHtmlComponents.contains(componentType))
    {
      HtmlHtml html = new HtmlHtml();
      html.setId("htmlId");
      root.getChildren().add(html);
      return html;
    }
    else
    {
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

  {
    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
    // a line or two.  A better method that accounts for font heights
    // would be good...

    // Bug #2464627: Allow support for forcing a minimum size
    StringBuilder onload = new StringBuilder(_FRAMESET_ONLOAD_TEXT.length()
                                           // space for the param plus the 'W:'
                                           + (gotWidth
                                              ? widthParam.length() + 2
                                              : 0)
                                           // space for the param plus the 'H:'
                                           + (gotHeight
                                              ? heightParam.length() + 2
                                              : 0)
                                           // space for commas, brackets,
                                           // and closing paren
                                           + 5);

    onload.append(_FRAMESET_ONLOAD_TEXT);
    if (gotWidth || gotHeight)
    {
      // open the parameter object
      onload.append(",{");
      if (gotWidth)
      {
        // add in the width parameter
        onload.append("W:");
        onload.append(widthParam);
      }
      if (gotHeight)
      {
        // If something preceded this param, separate with a comma
        if (gotWidth)
          onload.append(",");
        onload.append("H:");
        onload.append(heightParam);
      }
      // close the parameter object
      onload.append("}");
    }
    // close the handler
    onload.append(")");

    frameSet.setOnload(onload.toString());
   
    // http://issues.apache.org/jira/browse/ADFFACES-191   
    // Following code was once in CoreRenderKit.launchDialog.

    if (returnId != null)
    {
      StringBuilder onunload = new StringBuilder(53 + returnId.length());
      onunload.append(_FRAMESET_ONUNLOAD_TEXT);
      onunload.append(";window.opener.setTimeout(");
      onunload.append("'ADFDialogReturn[").append(returnId).append("]();'");
      onunload.append(",1)");
      frameSet.setOnunload(onunload.toString());
    }
    else
    {
      frameSet.setOnunload(_FRAMESET_ONUNLOAD_TEXT);
    }

    root.getChildren().add(frameSet);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.component.html.HtmlHtml

      return root;
    }

    if (_sHtmlComponents.contains(componentType))
    {
      HtmlHtml html = new HtmlHtml();
      html.setId("htmlId");
      root.getChildren().add(html);
      return html;
    }
    else
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.