private String getLink(
      final String event,
      final String label,
      final String css,
      String defaultValue,
      String selectedValue,
      String tooltip) {
    String status = Utilities.escapeHTML(Utilities.filterOutHTMLTags(tooltip));

    StringBuffer link = new StringBuffer();
    defaultValue = defaultValue == null ? AbstractChip.FALSE : defaultValue;
    selectedValue = selectedValue == null ? AbstractChip.TRUE : selectedValue;
    link.append("<input type=\"hidden\" name=\"" + event + "\" value=\"" + defaultValue + "\" />");
    link.append(
        "<a href=\"#\" onMouseover=\"window.status='"
            + status
            + "'; return true;\" onMouseout=\"window.status=''; return true;\" ");
    if (css != null) {
      link.append("class=\"" + css + "\" ");
    }
    link.append("hidefocus=\"true\" ");
    link.append(
        "onclick=\"document.editorForm.elements['"
            + event
            + "'].value='"
            + selectedValue
            + "';setScrollAndSubmit();return false;\">");
    link.append(label);
    link.append("</a>");
    return link.toString();
  }
 /**
  * If the appropriate config property is true (hmc.escape.html), all html content in the given
  * string will be escaped.
  */
 private String escapeHTML(String text) {
   if (ConfigConstants.getInstance().HTML_ESCAPE) {
     return Utilities.escapeHTML(text);
   } else {
     return text;
   }
 }
  private String getSimpleImageConfirmLink(
      final String event,
      final String label,
      final String image,
      String imageOver,
      String javascript) {
    String status = Utilities.escapeHTML(Utilities.filterOutHTMLTags(label));

    if ((imageOver == null) || imageOver.equals("")) {
      imageOver = image;
    }

    if ((javascript == null) || javascript.equals("")) {
      javascript = "true";
    }

    final String imageID = event + "_img";

    StringBuffer link = new StringBuffer();

    link.append("<input type=\"hidden\" name=\"")
        .append(event)
        .append("\" value=\"")
        .append(AbstractChip.FALSE)
        .append("\" />");
    link.append("<a href=\"#\" hidefocus=\"true\" style=\"text-decoration:none; \" alt=\"")
        .append(status)
        .append("\" title=\"")
        .append(status)
        .append("\"");
    link.append("onMouseover=\"window.status='")
        .append(status)
        .append("'; swapImage('")
        .append(imageID)
        .append("', '")
        .append(imageOver)
        .append("'); return true;\" ");
    link.append("onMouseout=\"window.status=''; swapImage('")
        .append(imageID)
        .append("', '")
        .append(image)
        .append("'); return true;\" ");
    link.append("onFocus=\"swapImage('")
        .append(imageID)
        .append("', '")
        .append(imageOver)
        .append("'); return true;\" ");
    link.append("onBlur=\"swapImage('")
        .append(imageID)
        .append("', '")
        .append(image)
        .append("'); return true;\" ");
    link.append("onclick=\"document.editorForm.elements['")
        .append(event)
        .append("'].value = ")
        .append(javascript)
        .append("; setScrollAndSubmit(); return false;\">");
    link.append("<img id=\"")
        .append(imageID)
        .append("\" src=\"")
        .append(image)
        .append("\" alt=\"")
        .append(status)
        .append("\">");
    link.append("</a>");

    return link.toString();
  }
  private String getIconButton(
      final String event,
      final String label,
      final String image,
      String javascript,
      boolean showLabel,
      boolean isEnabled) {
    String status = Utilities.escapeHTML(Utilities.filterOutHTMLTags(label));

    if ((javascript == null) || javascript.equals("")) {
      javascript = "true";
    }

    final String imageID = event + "_img";

    StringBuffer link = new StringBuffer();
    final String color = isEnabled ? "#ffffff" : "#D8DCE3";

    if (isEnabled) {
      link.append(
          "<input type=\"hidden\" name=\"" + event + "\" value=\"" + AbstractChip.FALSE + "\" />");
      link.append(
          "<a href=\"#\" hidefocus=\"true\" style=\"text-decoration:none; \" alt=\""
              + status
              + "\" ");
      link.append(
          "onMouseover=\"window.status='"
              + status
              + "'; "
              + " document.getElementById('"
              + imageID
              + "_bg_left').style.backgroundImage = 'url(images/icons/icon_button_background_hover_l.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_middle').style.backgroundImage = 'url(images/icons/icon_button_background_hover_m.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_right').style.backgroundImage = 'url(images/icons/icon_button_background_hover_r.gif)'; "
              + " return true;\" ");
      link.append(
          "onMouseout=\"window.status='';"
              + " document.getElementById('"
              + imageID
              + "_bg_left').style.backgroundImage = 'url(images/icons/icon_button_background_l.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_middle').style.backgroundImage = 'url(images/icons/icon_button_background_m.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_right').style.backgroundImage = 'url(images/icons/icon_button_background_r.gif)'; "
              + " return true;\" ");
      link.append(
          "onFocus=\"window.status='"
              + status
              + "'; "
              + " document.getElementById('"
              + imageID
              + "_bg_left').style.backgroundImage = 'url(images/icons/icon_button_background_hover_l.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_middle').style.backgroundImage = 'url(images/icons/icon_button_background_hover__m.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_right').style.backgroundImage = 'url(images/icons/icon_button_background_hover__r.gif)'; "
              + " return true;\" ");
      link.append(
          "onBlur=\"window.status='';"
              + " document.getElementById('"
              + imageID
              + "_bg_left').style.backgroundImage = 'url(images/icons/icon_button_background_l.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_middle').style.backgroundImage = 'url(images/icons/icon_button_background_m.gif)'; "
              + " document.getElementById('"
              + imageID
              + "_bg_right').style.backgroundImage = 'url(images/icons/icon_button_background_r.gif)'; "
              + " return true;\" ");
      link.append(
          "onclick=\"document.editorForm.elements['"
              + event
              + "'].value = "
              + javascript
              + "; setScrollAndSubmit(); return false;\">");
    }

    link.append(
        "<table title=\""
            + status
            + "\" style=\"vertical-align:middle; width:100%; height:23px; padding:0px;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
    link.append("<tr>");
    link.append(
        "<td id=\""
            + imageID
            + "_bg_left\" style=\"width:3px;font-size:1pt;padding:0px;\" background=\"images/icons/icon_button_background_l.gif\"><div style=\"width:3px;\"></div></td>");
    link.append(
        "<td id=\""
            + imageID
            + "_bg_middle\" style=\"white-space:nowrap;vertical-align:middle;text-align:center;padding:0px;\" background=\"images/icons/icon_button_background_m.gif\">");

    link.append(
        "<img id=\"" + imageID + "\" style=\"vertical-align:middle\" src=\"" + image + "\">");
    if (showLabel) {
      link.append("<span style=\"padding-left:5px; color:" + color + "\">" + label + "</span>");
    }

    link.append("</td>");
    link.append(
        "<td id=\""
            + imageID
            + "_bg_right\" style=\"width:3px;font-size:1pt;padding:0px;\" background=\"images/icons/icon_button_background_r.gif\"><div style=\"width:3px;\"></div></td>");
    link.append("</tr>");
    link.append("</table>");

    if (isEnabled) {
      link.append("</a>");
    }

    return link.toString();
  }