This is a nice addition. Looking over it a question does come to mind: why don't we just automatically create this when the use-row- submit attribute is set to true? I guess to look at it from the flip-side: is there any circumstance where you would want the row-submit turned on without having this field? -David On Sep 25, 2006, at 9:59 PM, [hidden email] wrote: > Author: sichen > Date: Mon Sep 25 13:59:02 2006 > New Revision: 449813 > > URL: http://svn.apache.org/viewvc?view=rev&rev=449813 > Log: > OFBIZ-240 - Render a selectAll checkbox for forms of type multi. > To activate it, define a field named _rowSubmit of type <check/> > and give it a title. > > Modified: > incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ > form/ModelFormField.java > incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ > html/HtmlFormRenderer.java > > Modified: incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/ > widget/form/ModelFormField.java > URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/ > widget/src/org/ofbiz/widget/form/ModelFormField.java? > view=diff&rev=449813&r1=449812&r2=449813 > ====================================================================== > ======== > --- incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ > form/ModelFormField.java (original) > +++ incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ > form/ModelFormField.java Mon Sep 25 13:59:02 2006 > @@ -1063,6 +1063,16 @@ > } > > /** > + * Checks if field is a row submit field. > + */ > + public boolean isRowSubmit() { > + if (!"multi".equals(getModelForm().getType())) return false; > + if (getFieldInfo().getFieldType() != > ModelFormField.FieldInfo.CHECK) return false; > + if (!CheckField.ROW_SUBMIT_FIELD_NAME.equals(getName())) > return false; > + return true; > + } > + > + /** > * @return > */ > public String getWidgetAreaStyle() { > @@ -2557,6 +2567,8 @@ > } > > public static class CheckField extends FieldInfo { > + public final static String ROW_SUBMIT_FIELD_NAME = > "_rowSubmit"; > + > protected CheckField() { > super(); > } > > Modified: incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/ > widget/html/HtmlFormRenderer.java > URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/ > widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java? > view=diff&rev=449813&r1=449812&r2=449813 > ====================================================================== > ======== > --- incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ > html/HtmlFormRenderer.java (original) > +++ incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ > html/HtmlFormRenderer.java Mon Sep 25 13:59:02 2006 > @@ -2190,7 +2190,7 @@ > > /** > * Renders a link for the column header fields when there is a > header-link="" specified in the <field > tag, using > - * style from header-link-style="" > + * style from header-link-style="". Also renders a selectAll > checkbox in multi forms. > * @param buffer > * @param context > * @param modelFormField > @@ -2207,6 +2207,11 @@ > targetType="plain"; > } > makeHyperlinkString(buffer, > modelFormField.getHeaderLinkStyle(), targetType, > targetBuffer.toString(), titleText, null); > + } else if (modelFormField.isRowSubmit()) { > + if (UtilValidate.isNotEmpty(titleText)) buffer.append > (titleText).append("<br>"); > + buffer.append("<input type=\"checkbox\" name= > \"selectAll\" value=\"Y\" onclick=\"javascript:toggleAll(this, '"); > + buffer.append(modelFormField.getModelForm().getName()); > + buffer.append("');\"/>"); > } else { > buffer.append(titleText); > } > > |
Free forum by Nabble | Edit this page |