Author: jaz
Date: Thu Mar 8 23:28:10 2007 New Revision: 516319 URL: http://svn.apache.org/viewvc?view=rev&rev=516319 Log: implemented multi-select Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?view=diff&rev=516319&r1=516318&r2=516319 ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Thu Mar 8 23:28:10 2007 @@ -565,6 +565,14 @@ </xs:restriction> </xs:simpleType> </xs:attribute> + <xs:attribute name="allow-multiple" default="false"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> <xs:attribute name="current" default="first-in-list"> <xs:simpleType> <xs:restriction base="xs:token"> @@ -576,6 +584,7 @@ <xs:attribute type="xs:string" name="no-current-selected-key"> <xs:annotation><xs:documentation>The key to mark as selected when there is no current entry value.</xs:documentation></xs:annotation> </xs:attribute> + <xs:attribute type="xs:integer" name="size" default="1"/> <xs:attribute type="xs:string" name="current-description"/> <xs:attribute type="xs:integer" name="other-field-size" default="0"> <xs:annotation><xs:documentation>If non-zero, a text field will conditionally show Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?view=diff&rev=516319&r1=516318&r2=516319 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Thu Mar 8 23:28:10 2007 @@ -2439,7 +2439,9 @@ public static class DropDownField extends FieldInfoWithOptions { protected boolean allowEmpty = false; + protected boolean allowMulti = false; protected String current; + protected String size; protected FlexibleStringExpander currentDescription; protected SubHyperlink subHyperlink; protected int otherFieldSize = 0; @@ -2460,9 +2462,16 @@ super(element, modelFormField); this.current = element.getAttribute("current"); + this.size = element.getAttribute("size"); this.allowEmpty = "true".equals(element.getAttribute("allow-empty")); + this.allowMulti = "true".equals(element.getAttribute("allow-multiple")); this.currentDescription = new FlexibleStringExpander(element.getAttribute("current-description")); + // set the default size + if (size == null) { + size = "1"; + } + String sizeStr = element.getAttribute("other-field-size"); try { this.otherFieldSize = Integer.parseInt(sizeStr); @@ -2486,6 +2495,10 @@ return this.allowEmpty; } + public boolean isAllowMultiple() { + return this.allowMulti; + } + public String getCurrent() { if (UtilValidate.isEmpty(this.current)) { return "first-in-list"; @@ -2522,6 +2535,10 @@ public int getOtherFieldSize() { return this.otherFieldSize; + } + + public String getSize() { + return this.size; } /** 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?view=diff&rev=516319&r1=516318&r2=516319 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Thu Mar 8 23:28:10 2007 @@ -554,6 +554,10 @@ buffer.append(idName); buffer.append('"'); } + + if (dropDownField.isAllowMultiple()) { + buffer.append(" multiple=\"multiple\""); + } int otherFieldSize = dropDownField.getOtherFieldSize(); String otherFieldName = dropDownField.getParameterNameOther(context); @@ -576,7 +580,7 @@ buffer.append('"'); } - buffer.append(" size=\"1\">"); + buffer.append(" size=\"").append(dropDownField.getSize()).append("\">"); String currentValue = modelFormField.getEntry(context); List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator()); |
Free forum by Nabble | Edit this page |