details:   /erp/devel/pi/rev/6cd690fa3bbc
changeset: 10558:6cd690fa3bbc
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 11 10:53:54 2011 +0100
summary:   Implemented time field

details:   /erp/devel/pi/rev/7288f9e31c11
changeset: 10559:7288f9e31c11
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 11 10:54:27 2011 +0100
summary:   Do not do autosave on main tab deselect

details:   /erp/devel/pi/rev/09194b7caa52
changeset: 10560:09194b7caa52
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 11 10:54:59 2011 +0100
summary:   Prevent yellow background for datefields in filter editor

details:   /erp/devel/pi/rev/2dce62da9dc3
changeset: 10561:2dce62da9dc3
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 11 10:55:53 2011 +0100
summary:   Prevent strange null values in FIC return handling, show errors for 
hidden fields in overall message bar

details:   /erp/devel/pi/rev/1b8467d745a8
changeset: 10562:1b8467d745a8
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 11 10:56:31 2011 +0100
summary:   Show loading tab when loading a view

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
                                                      |   17 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
                                                       |    1 -
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
                                                                   |    4 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
                                                             |    3 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
                                                             |   36 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
                                                             |    2 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
                                                          |  219 ++++++---
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js
 |    9 +
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
                                                          |   54 ++-
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
                                                                   |    8 +-
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
                                                                |    5 +-
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
                                                                   |   51 +-
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java
                                                                             |  
 12 +-
 13 files changed, 310 insertions(+), 111 deletions(-)

diffs (truncated from 807 to 300 lines):

diff -r fbb6c6efad91 -r 1b8467d745a8 
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
   Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Fri Feb 11 10:56:31 2011 +0100
@@ -451,6 +451,8 @@
 // Extends OBListItem
 isc.ClassFactory.defineClass('OBFKItem', isc.OBListItem);
 
+isc.ClassFactory.mixInInterface('OBFKItem', 'OBLinkTitleItem');
+
 isc.OBFKItem.addProperties({
   textMatchStyle: 'substring',
     
@@ -494,6 +496,21 @@
   };
 }
 
+
+//== OBTimeItem ==
+//OBTimeItem handles time values.
+isc.ClassFactory.defineClass('OBTimeItem', TimeItem);
+
+isc.OBTimeItem.addProperties({
+  validateOnExit: true,
+  showHint: false,
+  displayFormat: 'to24HourTime',
+  short24TimeFormat: 'HH:MM:SS',
+  shortTimeFormat: 'HH:MM:SS',
+  long24TimeFormat: 'HH:MM:SS',
+  longTimeFormat: 'HH:MM:SS'
+});
+
 // == OBDateItem ==
 // OBDateItem inherits from SmartClient DateItem
 // adds autocomplete and formatting based on the Openbravo date pattern
diff -r fbb6c6efad91 -r 1b8467d745a8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
    Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
    Fri Feb 11 10:56:31 2011 +0100
@@ -248,7 +248,6 @@
   
   // is called from the main app tabset
   tabDeselected: function(tabNum, tabPane, ID, tab, newTab){
-    this.autoSave();
     this.wasDeselected = true;
   },
   
diff -r fbb6c6efad91 -r 1b8467d745a8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
        Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
        Fri Feb 11 10:56:31 2011 +0100
@@ -63,7 +63,9 @@
   }),
 
   tabSelected: function(tabNum, tabPane, ID, tab) {
-    OB.Layout.HistoryManager.updateHistory();
+    if (!tabPane.isLoadingTab) {
+      OB.Layout.HistoryManager.updateHistory();
+    }
     if (tabPane.tabSelected) {
       tabPane.tabSelected(tabNum, tabPane, ID, tab);
     }
diff -r fbb6c6efad91 -r 1b8467d745a8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
  Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
  Fri Feb 11 10:56:31 2011 +0100
@@ -41,6 +41,9 @@
     // if we already did append it
     if (item.textFieldProperties && item.textFieldProperties.textBoxStyle) {
       if (!item.textFieldProperties.textBoxStyle.endsWith('Required')) {
+        // make a copy as the textFieldProperties object is shared by many 
instances
+        // so you can't change it directly
+        item.textFieldProperties = isc.addProperties({}, 
item.textFieldProperties);
         item.textFieldProperties.textBoxStyle = 
item.textFieldProperties.textBoxStyle + 'Required';
       }
     } else if (item.textBoxStyle && !item.textBoxStyle.endsWith('Required')) {
diff -r fbb6c6efad91 -r 1b8467d745a8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Fri Feb 11 10:56:31 2011 +0100
@@ -397,7 +397,7 @@
       editValues[prop + '._valueMap'] = field.valueMap;
     }
     
-    if (columnValue.value && columnValue.value === 'null') {
+    if (columnValue.value && (columnValue.value === 'null' || 
columnValue.value === '')) {
       // handle the case that the FIC returns a null value as a string
       // should be repaired in the FIC
       // note: do not use clearvalue as this removes the value from the form
@@ -516,7 +516,6 @@
   },
   
   itemChanged: function(item, newValue){
-    this.itemChangeActions(item);
     this.handleItemChange(item);
   },
   
@@ -653,15 +652,30 @@
   },
   
   handleFieldErrors: function(errors){
+    var msg = OB.I18N.getLabel('OBUIAPP_ErrorInFields');
+    var additionalMsg = '';
     if (errors) {
       this.setErrors(errors, true);
+      for (var err in errors) {
+        if (errors.hasOwnProperty(err)) {
+          var fld = this.getField(err); 
+          if (!fld || !fld.visible) {
+            if (additionalMsg !== '') {
+              additionalMsg = additionalMsg + '<br/>';
+            }
+            additionalMsg = additionalMsg + errors[err]; 
+          }
+        }
+      }
+      if (additionalMsg) {
+        msg = additionalMsg;
+      }
     }
-    var msg = OB.I18N.getLabel('OBUIAPP_ErrorInFields');
     var errorFld = this.getFirstErrorItem();
     // special case
     // if there is only an error on the id and no error on any field
     // display that message then
-    if (errors && errors.id && !errorFld) {
+    if (!additionalMsg && errors && errors.id && !errorFld && 
errors.id.errorMessage) {
       msg = errors.id.errorMessage;
     }
        
@@ -754,7 +768,19 @@
 
   onFieldChanged: function(form, item, value) {
     // To be implemented dynamically
-  }
+  },
+    
+  // overridden to prevent updating of a time value which 
+  // has only been edited half, only do this if we are in change
+  // handling (to enable buttons etc.)
+  updateFocusItemValue: function() {
+    var focusItem = this.getFocusSubItem();
+    if (this.inChangeHandling && focusItem && !focusItem.changeOnKeypress) {
+      return;
+    }
+    return this.Super('updateFocusItemValue', arguments);
+  } 
+
 };
 
 isc.OBViewForm.addProperties(OB.ViewFormProperties);
diff -r fbb6c6efad91 -r 1b8467d745a8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Fri Feb 11 10:56:31 2011 +0100
@@ -139,6 +139,8 @@
   // undo, which means clicks outside of the current form.
   modalEditing: false,
   
+  timeFormatter: 'to24HourTime',
+  
   dataProperties: {
     useClientFiltering: false,
     useClientSorting: false,
diff -r fbb6c6efad91 -r 1b8467d745a8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
       Fri Feb 11 10:25:33 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
       Fri Feb 11 10:56:31 2011 +0100
@@ -35,6 +35,7 @@
   // cache object references locally
   var L = OB.Layout, M = OB.MainView, ISC = isc, vmgr; // Local reference to
   // ViewManager instance
+  var tabSet = M.TabSet;
   
   function ViewManager(){
   }
@@ -54,14 +55,14 @@
         for (i = len; i > 0; i--) {
           item = this.cache[i - 1];
           if (item.instance.isSameTab && item.instance.isSameTab(vName, 
params)) {
-            return item.viewTabID;
+            return item.viewTabId;
           }
         }
         return null;
       },
       
       getTabNumberFromViewParam: function(/* String */param, value){
-        var tabSet = M.TabSet, numberOfTabs = tabSet.tabs.length, viewParam = 
'', result = null;
+        var numberOfTabs = tabSet.tabs.length, viewParam = '', result = null;
         for (var i = 0; i < numberOfTabs; i++) {
           viewParam = tabSet.getTabPane(i)[param];
           if (viewParam === value) {
@@ -75,11 +76,11 @@
         this.cache.push(instanceDetails);
       },
       
-      removeTab: function(/* String */viewTabID){
+      removeTab: function(/* String */viewTabId){
         var len = this.cache.length, i, item, removed;
         for (i = len; i > 0; i--) {
           item = this.cache[i - 1];
-          if (item.viewTabID === viewTabID) {
+          if (item.viewTabId === viewTabId) {
             removed = this.cache.splice(i - 1, 1);
             return;
           }
@@ -87,7 +88,31 @@
       }
     },
 
-    fetchView: function(/* String */viewId, /*function*/ callback, /*Object*/ 
clientContext){
+    findLoadingTab: function(params) {
+      if (!params.loadingTabId) {
+        return null;
+      }
+      for (var i = 0; i < tabSet.tabs.length; i++) {
+        var pane = tabSet.tabs[i].pane;
+        if (pane.viewTabId && pane.viewTabId === params.loadingTabId) {
+          return tabSet.tabs[i];
+        }
+      }
+      return null;
+    },
+    
+    fetchView: function(/* String */viewId, /*function*/ callback, /*Object*/ 
clientContext, /*Object*/params, useLoadingTab){
+      if (useLoadingTab) {
+        // open a loading tab
+        params = params || {};
+        var layout = OB.Utilities.createLoadingLayout();
+        // is used to prevent history updating
+        layout.isLoadingTab = true;
+        var viewTabId = '_' + new Date().getTime();
+        params.loadingTabId = viewTabId;
+        this.createTab(viewId, viewTabId, layout, params);
+      }
+      
       var rpcMgr = ISC.RPCManager;
       var reqObj = {
         params: {
@@ -103,6 +128,64 @@
       var request = rpcMgr.sendRequest(reqObj);
     },
     
+    createTab: function(viewName, viewTabId, viewInstance, params) {
+      if (params.i18nTabTitle) {
+        // note call to I18N is done below after the tab
+        // has been created
+        tabTitle = '';
+      } else {
+        tabTitle = params.tabTitle || viewInstance.tabTitle || params.tabId ||
+        viewName;
+      }
+      
+      var tabDef = {
+        ID: viewTabId,
+        title: tabTitle,
+        canClose: true,
+        viewName: viewName,
+        params: params,
+        pane: viewInstance
+      };
+      
+      // let the params override tab properties like canClose
+      tabDef = isc.addProperties(tabDef, params);
+      
+      // Adding to the MainView tabSet
+      tabSet.addTab(tabDef);
+      
+      if (params.i18nTabTitle) {
+        tabTitle = '';
+        // note the callback calls the tabSet
+        // with the tabid to set the label
+        OB.I18N.getLabel(params.i18nTabTitle, null, {
+          setTitle: function(label){
+            tabSet.setTabTitle(viewTabId, label);
+          }
+        }, 'setTitle');
+      }
+      
+      // tell the viewinstance what tab it is on
+      // note do not use tabId on the viewInstance
+      // as tabId is used by the classic ob window
+      // local variable is: viewTabId
+      if (viewInstance.setViewTabId) {
+        viewInstance.setViewTabId(viewTabId);
+      } else {
+        viewInstance.viewTabId = viewTabId;
+      }
+      
+      // Adding a reference to opened views collection
+      vmgr.views.push({
+        viewName: viewName,
+        params: params,
+        instance: viewInstance,
+        viewTabId: viewTabId
+      });
+      
+      // the select tab event will update the history
+      tabSet.selectTab(viewTabId);
+    },
+  
     // ** {{{ ViewManager.openView(viewName, params) }}} **
     //
     // Shows a new tab in the {{{ Main Layout }}}
@@ -137,7 +220,13 @@
         //

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to