details:   /erp/devel/pi/rev/befa79fc1364
changeset: 9506:befa79fc1364
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Jan 03 22:47:04 2011 +0100
summary:   Added clear icon to search field

details:   /erp/devel/pi/rev/5f9747ff5f61
changeset: 9507:5f9747ff5f61
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Jan 03 22:47:27 2011 +0100
summary:   Solved cce and jsonexception

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
                                        |   8 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
                                                      |  20 +++++++
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
 |  28 ++++++++-
 3 files changed, 50 insertions(+), 6 deletions(-)

diffs (100 lines):

diff -r 5f821bb399a9 -r 5f9747ff5f61 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Mon Jan 03 21:44:36 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Mon Jan 03 22:47:27 2011 +0100
@@ -612,8 +612,8 @@
                       // Normal data
                       Object el = element.get(1, null);
                       String value;
-                      if (el instanceof Double) {
-                        value = ((Double) el).toString();
+                      if (el instanceof Number) {
+                        value = ((Number) el).toString();
                       } else {
                         value = (String) el;
                       }
@@ -632,7 +632,9 @@
                       // We set the value as formatted in the JSONObject in 
the request, so that the
                       // request now is format safe and additional 
getFieldProperties calls do not
                       // fail
-                      rq.setRequestParameter(colId, 
jsonobj.getString("value"));
+                      if (jsonobj.has("value")) {
+                        rq.setRequestParameter(colId, 
jsonobj.getString("value"));
+                      }
                     }
                     if (changed && col.getCallout() != null) {
                       // We need to fire this callout, as the column value was 
changed
diff -r 5f821bb399a9 -r 5f9747ff5f61 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Mon Jan 03 21:44:36 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Mon Jan 03 22:47:27 2011 +0100
@@ -103,6 +103,26 @@
 isc.OBSearchItem.addProperties({
   showPickerIcon: true,
 
+  setValue: function(value) {
+    var ret = this.Super('setValue', arguments);
+    // in this case the clearIcon needs to be shown or hidden
+    if (!this.disabled && !this.required) {
+      if (value) {
+        this.showIcon(this.instanceClearIcon);
+      } else {        
+        this.hideIcon(this.instanceClearIcon);
+      }
+    }
+    return ret;
+  },
+
+  init: function() {
+    this.instanceClearIcon = isc.shallowClone(this.clearIcon); 
+    this.icons = [this.instanceClearIcon];
+    this.icons[0].formItem = this;
+    return this.Super('init', arguments);
+  },
+
   getTitleHTML: function() {
     // calls the method from the OBLinkTitleItem interface
     return this.getLinkTitleHTML();
diff -r 5f821bb399a9 -r 5f9747ff5f61 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
      Mon Jan 03 21:44:36 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
      Mon Jan 03 22:47:27 2011 +0100
@@ -15,9 +15,7 @@
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
-*/
-
-
+ */
 isc.OBViewForm.addProperties({
   styleName: 'OBViewForm',
   //cellBorder: 1, // debug layout
@@ -48,6 +46,30 @@
   pickerIconHeight: 21,
   pickerIconWidth: 21,
   pickerIconSrc: 
'[SKINIMG]../../org.openbravo.client.application/images/form/search_picker.png',
+  clearIcon: {
+    height: 15,
+    width: 15,
+    // note: TODO: show a helpfull text, need to be present in the messages 
table
+    //prompt: 'test',
+    showIf: function(form, item){
+      if (item.disabled) {
+        return false;
+      }
+      if (item.required) {
+        return false;
+      }
+      if (item.getValue()) {
+        return true;
+      }
+      return false;
+    },
+    
+    click: function() {
+      this.formItem.clearValue();
+    },
+    
+    src: 
'[SKINIMG]../../org.openbravo.client.application/images/form/clear-field.png'
+  },
   newTabIconSrc: 
'[SKINIMG]../../org.openbravo.client.application/images/form/ico-to-new-tab.png',
   newTabIconSize: 8
 });

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to