コード例 #1
0
  /**
   * gets the redirect URL as workaround for opening a new window or refreshing a window (Noscript
   * version)
   */
  private String getWindowOpener() {
    String result = "";
    IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
    WebForm activeForm = FormManager.getActive();

    WebForm[] allForms = FormManager.getAll();
    boolean finished = false;
    for (int i = 0; !finished && i < allForms.length; i++) {
      WebForm form = allForms[i];
      IFormAdapter formAdapter = WebFormUtil.getFormAdapter(form);
      if (stateInfo.isExpired()) {
        if (!formAdapter.getWindowOpenerBuffer().equals("")) {
          result = formAdapter.getWindowOpenerBuffer();
          finished = true;
        }
      } else {
        if (WebComponentControl.openInNewWindow(form) || WebComponentControl.refreshWindow(form)) {
          result =
              "<meta http-equiv=\"refresh\" content=\"0; url="
                  + RenderUtil.createEncodedFormGetURL(form)
                  + "\">";
          formAdapter.addWindowOpenerBuffer(result);
          NoscriptFormStack.getInstance().push(activeForm);
          finished = true;
        } else {
          formAdapter.addWindowOpenerBuffer("");
        }
      }
    }
    return result;
  }
コード例 #2
0
 /** builds the String containing attributes for the <body> tag */
 StringBuffer getBodyAttributes() {
   StringBuffer result = new StringBuffer();
   WebForm form = FormManager.getActive();
   if (form != null) {
     HTMLUtil.attribute(result, HTML.BGCOLOR, form.getBgColor().toString());
     HTMLUtil.attribute(result, HTML.TEXT, form.getTextColor().toString());
     HTMLUtil.attribute(result, HTML.LEFTMARGIN, form.getLeftmargin());
     HTMLUtil.attribute(result, HTML.TOPMARGIN, form.getTopmargin());
     HTMLUtil.attribute(result, HTML.MARGINHEIGHT, form.getMarginheight());
     HTMLUtil.attribute(result, HTML.MARGINWIDTH, form.getMarginwidth());
     result.append(" ");
     result.append(WebComponentControl.getUniversalAttributes(form));
     result.append(" ");
   }
   return result;
 }