details:   /erp/devel/pi/rev/d1ae0c44fd55
changeset: 9628:d1ae0c44fd55
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 08 00:21:14 2011 +0100
summary:   Changes in way link icon is visualized in title

details:   /erp/devel/pi/rev/f957f1273265
changeset: 9629:f957f1273265
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 08 00:22:17 2011 +0100
summary:   Incorporated message bar and toolbar changes

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-messagebar.js
            |   50 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
         |  168 +++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
               |  293 +++++----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
             |  198 ++++++-
 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
 |   10 -
 5 files changed, 491 insertions(+), 228 deletions(-)

diffs (truncated from 1389 to 300 lines):

diff -r 57637715b2e8 -r f957f1273265 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-messagebar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-messagebar.js
 Sat Jan 08 00:20:07 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-messagebar.js
 Sat Jan 08 00:22:17 2011 +0100
@@ -4,7 +4,7 @@
  * 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 
+ * 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
@@ -16,8 +16,6 @@
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
-
-
 isc.ClassFactory.defineClass('OBMessageBarMainIcon', isc.Img);
 
 isc.ClassFactory.defineClass('OBMessageBarDescriptionText', isc.HTMLFlow);
@@ -26,7 +24,7 @@
 
 isc.OBMessageBarCloseIcon.addProperties({
   messageBar: null,
-  action: function() {
+  action: function(){
     this.messageBar.hide();
   }
 });
@@ -46,34 +44,36 @@
   mainIcon: null,
   text: null,
   closeIcon: null,
-
-  initWidget: function() {
+  
+  initWidget: function(){
     this.mainIcon = isc.OBMessageBarMainIcon.create({});
     this.text = isc.OBMessageBarDescriptionText.create({
       contents: ''
     });
-    this.closeIcon = isc.OBMessageBarCloseIcon.create({messageBar: this});
-
+    this.closeIcon = isc.OBMessageBarCloseIcon.create({
+      messageBar: this
+    });
+    
     this.addMembers([this.mainIcon, this.text, this.closeIcon]);
   },
-
-  setType: function(type) {
+  
+  setType: function(type){
     if (this.setTypeStyle) {
       this.setTypeStyle(type);
     }
     this.type = type;
   },
-
-  setText: function(title, text) {
-    if (!title) {      
+  
+  setText: function(title, text){
+    if (!title) {
       this.text.setContents(text);
     } else {
       // TODO: low-prio, move styling to a css class
       this.text.setContents('<b>' + title + '</b><br/>' + text);
     }
   },
-
-  getDefaultTitle: function(type) {
+  
+  getDefaultTitle: function(type){
     if (type === isc.OBMessageBar.TYPE_SUCCESS) {
       return OB.I18N.getLabel('OBUIAPP_Success');
     } else if (type === isc.OBMessageBar.TYPE_ERROR) {
@@ -83,10 +83,10 @@
     } else if (type === isc.OBMessageBar.TYPE_WARNING) {
       return OB.I18N.getLabel('OBUIAPP_Warning');
     }
-    return null;  
+    return null;
   },
-
-  setMessage: function(type, title, text) {
+  
+  setMessage: function(type, title, text){
     var i, length, newText;
     this.setType(type);
     if (isc.isAn.Array(text)) {
@@ -100,5 +100,17 @@
     }
     this.setText(title || this.getDefaultTitle(type), text);
     this.show();
+  },
+
+  // calls te OB.I18N.getLabel to asynchronously get a label
+  // and display it  
+  setLabel: function(type, title, label){
+    var me = this;
+    OB.I18N.getLabel(label, null, {
+      setLabel: function(text){
+        me.setMessage(type, title, text);
+      }
+    }, 'setLabel');
   }
-});
\ No newline at end of file
+  
+});
diff -r 57637715b2e8 -r f957f1273265 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Sat Jan 08 00:20:07 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Sat Jan 08 00:22:17 2011 +0100
@@ -20,9 +20,8 @@
 
 // The OBStandardWindow contains the toolbar and the root view.
 isc.OBStandardWindow.addProperties({
-  toolBar: null,
+  toolBarLayout: null,
   view: null,
-  messageBar: null,
   
   viewProperties: null,
   
@@ -30,58 +29,27 @@
   
   initWidget: function(){
     var standardWindow = this;
-    this.toolBar = isc.OBToolbar.create({
-      height: this.toolBarHeight,
-      minHeight: this.toolBarHeight,
-      maxHeight: this.toolBarHeight,
-      leftMembers: [isc.OBToolbarIconButton.create({
-        action: 'alert(\'New Document\')',
-        buttonType: 'newDoc',
-        prompt: 'New Document'
-      }), isc.OBToolbarIconButton.create({
-        action: 'alert(\'New Row\')',
-        buttonType: 'newRow',
-        prompt: 'New Row'
-      })],
-      rightMembers: [isc.OBToolbarTextButton.create({
-        action: 'OB.Utilities.openActionButton(this, {viewId: 
"OBPopupClassicWindow", obManualURL: "TablesandColumns/Table_Edition.html", 
processId: "173", id: "173", command: "BUTTONImportTable173", tabTitle: 
"Testing"});',
-        title: 'Button A'
-      })]
+    
+    this.toolBarLayout = isc.HLayout.create({
+      width: '100%',
+      height: 1, // is set by its content
+      overflow: 'visible'
     });
     
-    this.toolBar.addLeftMembers([isc.OBToolbarIconButton.create({
-      action: 'alert(\'Save\')',
-      buttonType: 'save',
-      prompt: 'Save'
-    }), isc.OBToolbarIconButton.create({
-      action: 'alert(\'Create Copy\')',
-      buttonType: 'createCopy',
-      prompt: 'Create Copy'
-    })]);
-    
-    this.toolBar.addRightMembers([isc.OBToolbarTextButton.create({
-      action: 'alert(\'Button B\')',
-      title: 'Button B'
-    })]);
-    
-    this.messageBar = isc.OBMessageBar.create({visibility: 'hidden'});
-    
-    this.addMember(this.messageBar);
-    this.addMember(this.toolBar);
+    this.addMember(this.toolBarLayout);
     
     this.viewProperties.standardWindow = this;
     
     this.view = isc.OBStandardView.create(this.viewProperties);
     this.addMember(this.view);
     this.Super('initWidget', arguments);
-    this.view.toolBar = this.toolBar;
     
     // is set later after creation
     this.view.tabTitle = this.tabTitle;
   },
   
   show: function(){
-    var ret = this.Super("show", arguments);
+    var ret = this.Super('show', arguments);
     this.setFocusInView();
     return ret;
   },
@@ -215,6 +183,8 @@
   // ** {{{ toolbar }}} **
   // The toolbar canvas.
   toolBar: null,
+
+  messageBar: null,
   
   // ** {{{ formGridLayout }}} **
   // The layout which holds the form and grid.
@@ -274,6 +244,10 @@
   initWidget: function(properties){
     var isRootView = !this.parentProperty;
     
+    this.messageBar = isc.OBMessageBar.create({
+      visibility: 'hidden'
+    });
+    
     if (isRootView) {
       this.buildStructure();
     }
@@ -281,6 +255,20 @@
     OB.TestRegistry.register('org.openbravo.client.application.ViewGrid_' + 
this.tabId, this.viewGrid);
     OB.TestRegistry.register('org.openbravo.client.application.ViewForm_' + 
this.tabId, this.viewForm);
     
+    this.toolBar = isc.OBToolbar.create({
+      view: this,
+      visibility: 'hidden',
+      leftMembers: 
[isc.OBToolbarIconButton.create(isc.OBToolbar.NEW_BUTTON_PROPERTIES), 
isc.OBToolbarIconButton.create(isc.OBToolbar.SAVE_BUTTON_PROPERTIES), 
isc.OBToolbarIconButton.create(isc.OBToolbar.DELETE_BUTTON_PROPERTIES), 
isc.OBToolbarIconButton.create(isc.OBToolbar.UNDO_BUTTON_PROPERTIES)],
+      rightMembers: [isc.OBToolbarTextButton.create({
+        action: 'OB.Utilities.openActionButton(this, {viewId: 
"OBPopupClassicWindow", obManualURL: "TablesandColumns/Table_Edition.html", 
processId: "173", id: "173", command: "BUTTONImportTable173", tabTitle: 
"Testing"});',
+        title: 'Button A'
+      })]
+    });
+    
+    if (isRootView) {
+      this.standardWindow.toolBarLayout.addMember(this.toolBar);
+    }
+    
     this.Super('initWidget', arguments);
   },
   
@@ -354,8 +342,12 @@
             } else {
               OB.KernelUtilities.handleSystemException(error.message);
             }
+          } else if (!dsRequest.willHandleError) {
+            OB.KernelUtilities.handleSystemException('Error occured');
+          } else if (dsResponse.status && dsResponse.status === 
isc.RPCResponse.STATUS_FAILURE) {
+            this.view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, 
jsonData.data);
           } else {
-            OB.KernelUtilities.handleSystemException('Error occured');
+            this.view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, 
OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
           }
         }
         return this.Super('transformResponse', arguments);
@@ -405,7 +397,7 @@
       this.formGridLayout = isc.HLayout.create({
         width: '100%',
         height: '*',
-        overflow: 'auto',
+        overflow: 'visible',
         view: this,
         focusChanged: function(hasFocus){
           if (hasFocus) {
@@ -431,8 +423,6 @@
         }
       });
       
-      this.formGridLayout.addMember(this.activeBar);
-      
       if (this.viewGrid) {
         this.viewGrid.setWidth('100%');
         this.viewGrid.view = this;
@@ -445,7 +435,9 @@
         this.viewForm.view = this;
       }
       
-      this.statusBar = this.createStatusBar();
+      this.statusBar = isc.OBStatusBar.create({
+        view: this.viewForm.view
+      });
       
       this.statusBarFormLayout = isc.VLayout.create({
         width: '100%',
@@ -466,7 +458,27 @@
       this.statusBarFormLayout.addMember(formContainerLayout);
       
       this.formGridLayout.addMember(this.statusBarFormLayout);
-      this.addMember(this.formGridLayout);
+
+      // wrap the messagebar and the formgridlayout in a VLayout
+      var gridFormMessageLayout = isc.VLayout.create({
+        height: '100%',
+        width: '100%',
+        overflow: 'auto'
+      });
+      gridFormMessageLayout.addMember(this.messageBar);
+      gridFormMessageLayout.addMember(this.formGridLayout);
+
+      // and place the active bar to the left of the form/grid/messagebar
+      var activeGridFormMessageLayout = isc.HLayout.create({
+        height: '100%',
+        width: '100%',
+        overflow: 'hidden'
+      });
+      
+      activeGridFormMessageLayout.addMember(this.activeBar);
+      activeGridFormMessageLayout.addMember(gridFormMessageLayout);

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
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