@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); }
// 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$ }
@Override protected String getContainerStyle(TreeContextImpl node) { String style = super.getContainerStyle(node); return ExtLibUtil.concatStyles(style, "margin-left:2em; margin-right:2em"); }