fixed bug 28651: list reference are validated while typing
authorAsier Lostalé <asier.lostale@openbravo.com>
Tue, 31 Mar 2015 12:45:26 +0200
changeset 26301 f1075c59ffbf
parent 26300 a20d7406cc39
child 26302 115dc3041496
fixed bug 28651: list reference are validated while typing

This caused to see the field in red as non valid while typing to filter a value.

It has been fixed in the same way selector reference does: preventing validation
on filterComplete. A new OBComboBoxItem class has been implemented in order to
make both list and selectors (including table and tableDir) extend it preventing
in this manner code duplicities.
modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Mon Mar 30 13:43:26 2015 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Tue Mar 31 12:45:26 2015 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -118,6 +118,8 @@
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-linkbutton.js", true));
     globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js", true));
+    globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js", true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js", true));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js	Tue Mar 31 12:45:26 2015 +0200
@@ -0,0 +1,39 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use. this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+// == OBComboBoxItem ==
+// Base Combo Box for list and selector references
+isc.ClassFactory.defineClass('OBComboBoxItem', isc.ComboBoxItem);
+
+isc.OBComboBoxItem.addProperties({
+
+  // ** {{{ filterComplete }}} **
+  //
+  // Prevents validation of this item while filtering because real value is not 
+  // set yet.
+  // see issues #26189 and #28651
+  filterComplete: function () {
+    var ret;
+
+    this.preventValidation = true;
+    ret = this.Super('filterComplete', arguments);
+    delete this.preventValidation;
+    return ret;
+  }
+});
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js	Mon Mar 30 13:43:26 2015 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js	Tue Mar 31 12:45:26 2015 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -19,7 +19,7 @@
 
 // == OBListItem ==
 // Combo box for list references, note is extended by OBFKItem again.
-isc.ClassFactory.defineClass('OBListItem', isc.ComboBoxItem);
+isc.ClassFactory.defineClass('OBListItem', isc.OBComboBoxItem);
 
 isc.OBListItem.addProperties({
   operator: 'equals',
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Mon Mar 30 13:43:26 2015 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Mar 31 12:45:26 2015 +0200
@@ -427,7 +427,7 @@
 // 1) a combo box with a picker icon
 // 2) a popup window showing a search grid with data
 //
-isc.ClassFactory.defineClass('OBSelectorItem', isc.ComboBoxItem);
+isc.ClassFactory.defineClass('OBSelectorItem', isc.OBComboBoxItem);
 
 isc.ClassFactory.mixInInterface('OBSelectorItem', 'OBLinkTitleItem');
 
@@ -477,18 +477,6 @@
     }
   },
 
-  filterComplete: function () {
-    var ret;
-
-    // Prevents validation of this item while filtering because real value is
-    // not yet set. This also caused form item to be redrawn removing typed 
-    // text for filtering (see issue #26189)
-    this.preventValidation = true;
-    ret = this.Super('filterComplete', arguments);
-    delete this.preventValidation;
-    return ret;
-  },
-
   hidePickListOnBlur: function () {
     // when the form gets redrawn the focus may not be in
     // the item but it is still the item which gets the focus