@Override
  protected void writeErrorSummary(
      FacesContext context, ResponseWriter w, FormLayout c, ComputedFormData formData)
      throws IOException {
    if (!c.isDisableErrorSummary()) {
      // Should we apply a filter to retain only the message belonging to the controls within the
      // form?
      // Easy enough with a FilteredIterator
      Iterator<FacesMessage> msg = ((DominoFacesContext) context).getMessages();
      if (msg.hasNext()) {
        String id =
            c.getClientId(context) + NamingContainer.SEPARATOR_CHAR + "popup"; // $NON-NLS-1$
        String shadeId =
            c.getClientId(context) + NamingContainer.SEPARATOR_CHAR + "shade"; // $NON-NLS-1$
        writeErrorSummaryShade(context, w, c, shadeId);

        // TODO: make the addition of js to the component a separate function
        // center the error dialog on the screen
        StringBuilder b = new StringBuilder();
        b.append("XSP.addOnLoad(function(){"); // $NON-NLS-1$
        b.append("XSP.centerNode("); // $NON-NLS-1$
        JavaScriptUtil.addString(b, id);
        b.append(");"); // $NON-NLS-1$
        b.append("});"); // $NON-NLS-1$
        String script = b.toString();
        ExtLibUtil.addScript(context, script);

        w.startElement("div", c); // $NON-NLS-1$
        String style = (String) getProperty(PROP_STYLEERRORSUMMARY);
        if (StringUtil.isNotEmpty(style)) {
          w.writeAttribute("style", style, null); // $NON-NLS-1$
        }
        String cls = (String) getProperty(PROP_STYLECLASSERRORSUMMARY);
        if (StringUtil.isNotEmpty(cls)) {
          w.writeAttribute("class", cls, null); // $NON-NLS-1$
        }
        if (StringUtil.isNotEmpty(id)) {
          w.writeAttribute("id", id, null); // $NON-NLS-1$
        }

        writeErrorSummaryContent(context, w, c, msg);
        writeErrorSummaryButton(context, w, c, id, shadeId);
        w.endElement("div"); // $NON-NLS-1$
      }
    }
  }
  @Override
  protected void writeFormLayout(FacesContext context, ResponseWriter w, FormLayout c)
      throws IOException {
    ComputedFormData formData = createFormData(context, c);
    String style = c.getStyle();
    String styleClass = c.getStyleClass();

    w.startElement("div", c); // $NON-NLS-1$
    String styleProp = (String) getProperty(PROP_FORMCONTAINERSTYLE);
    if (StringUtil.isNotEmpty(styleProp)) {
      style = ExtLibUtil.concatStyles(style, styleProp);
    }
    if (!StringUtil.isEmpty(style)) {
      w.writeAttribute("style", style, null); // $NON-NLS-1$
    }
    String styleClassProp = (String) getProperty(PROP_FORMCONTAINERSTYLECLASS);
    if (StringUtil.isNotEmpty(styleClassProp)) {
      styleClass = ExtLibUtil.concatStyleClasses(styleClass, styleClassProp);
    }
    if (!StringUtil.isEmpty(styleClass)) {
      w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
    }
    w.writeAttribute("id", c.getClientId(context), null); // $NON-NLS-1$

    newLine(w);
    writeErrorSummary(context, w, c, formData);
    writeHeader(
        context, w,
        c); // TODO:this is sort of messed up in how it is placing its divs, needs to be fixed
    w.startElement("div", c); // $NON-NLS-1$
    writeMainTableTag(context, w, c);
    newLine(w);

    writeForm(context, w, c, formData);

    w.endElement("div"); // $NON-NLS-1$
    newLine(w);
    writeFooter(context, w, c);
    w.endElement("div"); // $NON-NLS-1$
    newLine(w);
  }
 @Override
 protected void writeErrorSummaryMainText(
     FacesContext context, ResponseWriter w, FormLayout c, FacesMessage.Severity sev)
     throws IOException {
   w.startElement("h1", c); // $NON-NLS-1$
   String style = (String) getProperty(PROP_ERRORSUMMARYSTYLE);
   if (StringUtil.isNotEmpty(style)) {
     w.writeAttribute("style", style, null); // $NON-NLS-1$
   }
   String cls = (String) getProperty(PROP_ERRORSUMMARYCLASS);
   if (StringUtil.isNotEmpty(cls)) {
     w.writeAttribute("class", cls, null); // $NON-NLS-1$
   }
   String mainText = c.getErrorSummaryText();
   if (StringUtil.isEmpty(mainText)) {
     mainText = (String) getProperty(PROP_ERRORSUMMARYMAINTEXT);
   }
   writeErrorMessage(context, w, c, mainText);
   w.endElement("h1"); // $NON-NLS-1$
 }
 @Override
 protected void writeMainTableTag(FacesContext context, ResponseWriter w, FormLayout c)
     throws IOException {
   String ariaLabel = c.getAriaLabel();
   if (StringUtil.isNotEmpty(ariaLabel)) {
     w.writeAttribute("aria-label", ariaLabel, null); // $NON-NLS-1$
   }
   String tbStyle = (String) getProperty(PROP_TABLESTYLE);
   if (StringUtil.isNotEmpty(tbStyle)) {
     w.writeAttribute("style", tbStyle, null); // $NON-NLS-1$
   }
   String tbStyleClass = (String) getProperty(PROP_TABLESTYLECLASS);
   if (StringUtil.isNotEmpty(tbStyleClass)) {
     w.writeAttribute("class", tbStyleClass, null); // $NON-NLS-1$
   }
   String tbRole = (String) getProperty(PROP_TABLEROLE);
   if (StringUtil.isNotEmpty(tbStyleClass)) {
     w.writeAttribute("role", tbRole, null); // $NON-NLS-1$
   }
 }
  // This function is being overridden to provide style/class to tds...probably
  // should be bubbled up to the actual general FormTableRenderer
  @Override
  protected void writeFormRowData(
      FacesContext context,
      ResponseWriter w,
      FormLayout c,
      ComputedFormData formData,
      UIFormLayoutRow row,
      UIInput edit,
      ComputedRowData rowData)
      throws IOException {
    w.startElement("div", c); // $NON-NLS-1$

    String fieldStyle = row.getStyle();
    if (StringUtil.isEmpty(fieldStyle)) {
      fieldStyle = (String) getProperty(PROP_FIELDROWSTYLE);
    }
    if (StringUtil.isNotEmpty(fieldStyle)) {
      w.writeAttribute("style", fieldStyle, null); // $NON-NLS-1$
    }
    String fieldClass = row.getStyleClass();
    if (StringUtil.isEmpty(fieldClass)) {
      fieldClass = (String) getProperty(PROP_FIELDROWCLASS);
    }
    if (StringUtil.isNotEmpty(fieldClass)) {
      w.writeAttribute("class", fieldClass, null); // $NON-NLS-1$
    }

    // TODO: I think this section is dead code. Look into that.
    boolean rowError = false;
    if (edit != null) {
      // Write the error messages, if any
      if (!formData.isDisableRowError()) {
        Iterator<FacesMessage> msg =
            ((DominoFacesContext) context).getMessages(edit.getClientId(context));
        if (msg.hasNext()) {
          rowError = true;
        }
      }
    }

    boolean hasLabel = rowData.hasLabel();
    boolean labelAbove = rowData.isLabelAbove();

    // Write the label
    w.startElement("div", c); // $NON-NLS-1$
    String tdStyle = (String) getProperty(PROP_FIELDCOLUMNSTYLE);
    if (StringUtil.isNotEmpty(tdStyle)) {
      w.writeAttribute("style", tdStyle, null); // $NON-NLS-1$
    }
    // if we have an error, assign the appropriate classes
    String tdClass =
        hasLabel
            ? (String) getProperty(PROP_FIELDCOLUMNSTYLECLASS)
            : (String) getProperty(PROP_FIELDEDITNOLABELCLASS);
    tdClass =
        (rowError)
            ? ExtLibUtil.concatStyleClasses(
                (String) getProperty(PROP_ERRORROWTITLESTYLECLASS), tdClass)
            : tdClass;
    if ((TypedUtil.getChildren(row).get(0) instanceof XspInputTextarea
            || TypedUtil.getChildren(row).get(0) instanceof UIDojoTextarea)
        && getProperty(PROP_TEXTAREALABELCLASS)
            != null) { // if our row contains a textarea component, we need a special label class
      tdClass =
          ExtLibUtil.concatStyleClasses(tdClass, (String) getProperty(PROP_TEXTAREALABELCLASS));
    }
    if (StringUtil.isNotEmpty(tdClass)) {
      w.writeAttribute("class", tdClass, null); // $NON-NLS-1$
    }
    if (hasLabel) {
      String lblStyle = (String) getProperty(PROP_FIELDLABELSTYLE);
      String lblClass = (String) getProperty(PROP_FIELDLABELCLASS);
      if (labelAbove) {
        w.startElement("div", c); // $NON-NLS-1$
      } else {
        String width = row.getLabelWidth();
        if (StringUtil.isEmpty(width)) {
          width = formData.getLabelWidth();
        }
        if (StringUtil.isEmpty(width)) {
          width = (String) getProperty(PROP_FIELDLABELWIDTH);
        }
        if (StringUtil.isNotEmpty(width)) {
          lblStyle =
              ExtLibUtil.concatStyles(
                  "width:" + width, (String) getProperty(PROP_FIELDLABELSTYLE)); // $NON-NLS-1$
        }
      }
      if (StringUtil.isNotEmpty(lblStyle)) {
        w.writeAttribute("style", lblStyle, null); // $NON-NLS-1$
      }
      if (StringUtil.isNotEmpty(lblClass)) {
        w.writeAttribute("class", lblClass, null); // $NON-NLS-1$
      }
      String label = row.getLabel();
      writeFormRowLabel(context, w, c, formData, row, edit, label);
      if (labelAbove) {
        if (c.isFieldHelp()) {
          writeFormRowHelp(context, w, c, row, edit);
        }
        w.endElement("div"); // $NON-NLS-1$
        w.startElement("div", c); // $NON-NLS-1$
      } else {
        w.endElement("div"); // $NON-NLS-1$
        w.startElement("div", c); // $NON-NLS-1$
      }
    }

    String editStyle =
        (hasLabel && !labelAbove)
            ? ExtLibUtil.concatStyles(
                (String) getProperty(PROP_FORMROWEDITSTYLE),
                (String) getProperty(PROP_FIELDEDITSTYLE))
            : (String) getProperty(PROP_FIELDEDITSTYLE);
    if (StringUtil.isNotEmpty(editStyle)) {
      w.writeAttribute("style", editStyle, null); // $NON-NLS-1$
    }
    String editClass = (String) getProperty(PROP_FIELDEDITCLASS);
    if (TypedUtil.getChildren(row).get(0) instanceof XspInputTextarea
        || TypedUtil.getChildren(row).get(0) instanceof UIDojoTextarea) {
      editClass =
          ExtLibUtil.concatStyleClasses(editClass, (String) getProperty(PROP_TEXTAREASTYLECLASS));
    }
    if (StringUtil.isNotEmpty(editClass)) {
      w.writeAttribute("class", editClass, null); // $NON-NLS-1$
    }

    writeFormRowDataField(context, w, c, row, edit);

    if (hasLabel) {
      if (labelAbove) {
        w.endElement("div"); // $NON-NLS-1$
      }
      // Write the help
      if (hasLabel) {
        if (!labelAbove) {
          if (c.isFieldHelp()) {
            w.startElement("div", c); // $NON-NLS-1$
            writeFormRowHelp(context, w, c, row, edit);
            w.endElement("div"); // $NON-NLS-1$
          }
        }
      }
    }

    w.endElement("div"); // $NON-NLS-1$
    w.endElement("div"); // $NON-NLS-1$
  }