@Override protected void writeFormRow( FacesContext context, ResponseWriter w, FormLayout c, ComputedFormData formData, UIFormLayoutRow row) throws IOException { ComputedRowData rowData = createRowData(context, c, formData, row); UIInput edit = row.getForComponent(); if (edit != null) { // Write the error messages, if any if (!formData.isDisableRowError()) { Iterator<FacesMessage> msg = ((DominoFacesContext) context).getMessages(edit.getClientId(context)); if (msg.hasNext()) { while (msg.hasNext()) { FacesMessage m = msg.next(); writeFormRowError(context, w, c, row, edit, m, rowData); } } } } // The write the children writeFormRowData(context, w, c, formData, row, edit, rowData); }
// 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$ }