Author: lektran
Date: Wed Apr 7 03:31:24 2010 New Revision: 931416 URL: http://svn.apache.org/viewvc?rev=931416&view=rev Log: Added support for setting a class attribute (using widget-style) on the div rendered by ContainerField. Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=931416&r1=931415&r2=931416&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 7 03:31:24 2010 @@ -39,6 +39,7 @@ import javolution.util.FastList; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; @@ -2988,15 +2989,15 @@ public class MacroFormRenderer implement public void renderContainerFindField(Appendable writer, Map<String, Object> context, ContainerField containerField) throws IOException { - // TODO Auto-generated method stub - String id = ""; - if (UtilValidate.isNotEmpty(containerField.getId())) { - id = containerField.getId(); - } + String id = containerField.getId(); + String className = UtilFormatOut.checkNull(containerField.getModelFormField().getWidgetStyle()); + StringWriter sr = new StringWriter(); sr.append("<@renderContainerField "); sr.append("id=\""); sr.append(id); + sr.append("\" class=\""); + sr.append(className); sr.append("\" />"); executeMacro(sr.toString()); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=931416&r1=931415&r2=931416&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 7 03:31:24 2010 @@ -2914,7 +2914,13 @@ public class HtmlFormRenderer extends Ht if (UtilValidate.isNotEmpty(id)) { writer.append("id=\""); writer.append(id); - writer.append("\""); + writer.append("\" "); + } + String className = containerField.getModelFormField().getWidgetStyle(); + if (UtilValidate.isNotEmpty(className)) { + writer.append("class=\""); + writer.append(className); + writer.append("\" "); } writer.append("/>"); } Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=931416&r1=931415&r2=931416&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Wed Apr 7 03:31:24 2010 @@ -502,7 +502,7 @@ ${item.description}</div> </tr> </table> </#macro> -<#macro renderContainerField id><div id="${id?if_exists}"/></#macro> +<#macro renderContainerField id className><div id="${id}" class="${className}"/></#macro> <#macro renderFieldGroupOpen style id title collapsed collapsibleAreaId collapsible expandToolTip collapseToolTip> <#if style?has_content || id?has_content || title?has_content><div class="fieldgroup<#if style?has_content> ${style}</#if>"<#if id?has_content> id="${id}"</#if>> |
Free forum by Nabble | Edit this page |