Added save and close button, support for del key, moved toolbar to the left
authorMartin Taal <martin.taal@openbravo.com>
Thu, 03 Mar 2011 15:01:36 +0100
changeset 10993 8fa360d7c861
parent 10992 1cd103b3bf2a
child 10994 2f0491185ae7
Added save and close button, support for del key, moved toolbar to the left
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/images/toolbar/iconButton-saveclose.png
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/images/toolbar/iconButton-savecloseX.png
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.css
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.js
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Mar 03 15:01:36 2011 +0100
@@ -1168,4 +1168,15 @@
 <!--FF8081812E7BA4E8012E7BADC6FE0028-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--FF8081812E7BA4E8012E7BADC6FE0028--></AD_MESSAGE>
 
+<!--FF8081812E7BEED8012E7BFA9EC0000D--><AD_MESSAGE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_MESSAGE_ID><![CDATA[FF8081812E7BEED8012E7BFA9EC0000D]]></AD_MESSAGE_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <VALUE><![CDATA[OBUIAPP_SaveClose]]></VALUE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <MSGTEXT><![CDATA[Save and close form view ]]></MSGTEXT>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D--></AD_MESSAGE>
+
 </data>
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Thu Mar 03 15:01:36 2011 +0100
@@ -195,6 +195,7 @@
     leftMemberButtons = [isc.OBToolbarIconButton.create(isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES),
                    isc.OBToolbarIconButton.create(isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.SAVE_BUTTON_PROPERTIES), 
+                   isc.OBToolbarIconButton.create(isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.UNDO_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.DELETE_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES)];
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js	Thu Mar 03 15:01:36 2011 +0100
@@ -112,7 +112,7 @@
       buttonType: 'next',
       prompt: OB.I18N.getLabel('OBUIAPP_NEXTBUTTON')
     });
-    var closeButton = isc.OBStatusBarIconButton.create({
+    this.closeButton = isc.OBStatusBarIconButton.create({
       view: this.view,
       buttonType: 'close',
       prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON')
@@ -133,7 +133,7 @@
     });
     var buttonBar = isc.OBStatusBarIconButtonBar.create({});
     
-    buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer, this.maximizeButton, this.restoreButton, closeButton]);
+    buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer, this.maximizeButton, this.restoreButton, this.closeButton]);
     for (var i = 0; i < buttonBar.members.length; i++) {
       if (buttonBar.members[i].buttonType) {
         OB.TestRegistry.register('org.openbravo.client.application.statusbar.button.' + buttonBar.members[i].buttonType + '.' + this.view.tabId, buttonBar.members[i]);        
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js	Thu Mar 03 15:01:36 2011 +0100
@@ -45,12 +45,37 @@
           this.setDisabled(!form.isNew && !hasErrors && (form.isSaving || form.readOnly || 
                 !view.hasValidState() || !form.hasChanged));
       } else {
-        // enable when supporting grid editing
         this.setDisabled(true);
       }
     },
     keyboardShortcutId: 'ToolBar_Save'
   },
+  SAVECLOSE_BUTTON_PROPERTIES: {
+    action: function(){
+      this.view.statusBar.closeButton.action();
+    },
+    buttonType: 'savecloseX',
+    prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON'),
+    updateState: function() {
+      var view = this.view, form = view.viewForm;      
+      if (view.isShowingForm) {
+        this.setDisabled(false);
+        var saveDisabled = (!form.isNew && (form.isSaving || form.readOnly || 
+              !view.hasValidState() || !form.hasChanged));
+        if (saveDisabled) {
+          this.buttonType = 'savecloseX';
+          this.prompt = OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON');
+        } else {
+          this.buttonType = 'saveclose';          
+          this.prompt = OB.I18N.getLabel('OBUIAPP_SaveClose');
+        }
+      } else {
+        this.setDisabled(true);
+      }
+      this.resetBaseStyle();
+    },
+    keyboardShortcutId: 'ToolBar_SaveClose'
+  },
   NEW_ROW_BUTTON_PROPERTIES: {
     action: function(){
       this.view.newRow();
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Thu Mar 03 15:01:36 2011 +0100
@@ -332,6 +332,15 @@
     return this.Super('headerClick', arguments);
   },
 
+  // handle the del key when rows have been selected
+  bodyKeyPress : function (event, eventInfo) {
+    if (event.keyName === 'Delete' && this.getSelectedRecords().length > 0) {
+      this.view.deleteSelectedRows();
+      return;      
+    }
+    return this.Super('bodyKeyPress', arguments);
+  },
+
   // overridden to set the enterkeyaction to nextrowstart in cases the current row
   // is the last being edited  
   getNextEditCell : function (rowNum, colNum, editCompletionEvent) {
Binary file modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/images/toolbar/iconButton-saveclose.png has changed
Binary file modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/images/toolbar/iconButton-savecloseX.png has changed
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.css	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.css	Thu Mar 03 15:01:36 2011 +0100
@@ -118,6 +118,18 @@
   background-image: url(./images/toolbar/iconButton-save.png);
 }
 
+.OBToolbarIconButton_icon_saveclose {
+  background-repeat: no-repeat;
+  background-position: center center;
+  background-image: url(./images/toolbar/iconButton-saveclose.png);
+}
+
+.OBToolbarIconButton_icon_savecloseX {
+  background-repeat: no-repeat;
+  background-position: center center;
+  background-image: url(./images/toolbar/iconButton-savecloseX.png);
+}
+
 .OBToolbarIconButton_icon_createCopy {
   background-repeat: no-repeat;
   background-position: center center;
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.js	Thu Mar 03 13:49:09 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.js	Thu Mar 03 15:01:36 2011 +0100
@@ -21,7 +21,7 @@
 isc.OBToolbar.addProperties({
   width: '100%',
   height: 45,
-  leftMargin: 30,
+  leftMargin: 6,
   rightMargin: 4,
   leftMembersMargin: 4,
   rightMembersMargin: 12