[calendar] Added changes in OBStatusBar to be able to reuse it
authorDavid Baz Fayos <david.baz@openbravo.com>
Mon, 14 Jan 2013 17:14:16 +0100
changeset 19507 6b36d3051829
parent 19506 3c91850c93e5
child 19508 20a19da0ce17
[calendar] Added changes in OBStatusBar to be able to reuse it
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-personalization-styles.js
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-statusbar-styles.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js	Fri Jan 11 00:59:06 2013 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js	Mon Jan 14 17:14:16 2013 +0100
@@ -155,10 +155,14 @@
   // Set in the skin
   previousButton: null,
   nextButton: null,
+  showPreviousNextButton: true,
   closeButton: null,
+  showCloseButton: true,
   maximizeButton: null,
   restoreButton: null,
   maximizeRestoreButton: null,
+  showMaximizeRestoreButton: true,
+  customButtons: null,
 
   newIcon: null,
   editIcon: null,
@@ -166,7 +170,6 @@
   mode: '',
   isActive: true,
   buttonBar: null,
-  buttonBarProperties: {},
 
   initWidget: function () {
     this.content = isc.HLayout.create({
@@ -178,7 +181,9 @@
     this.leftStatusBar = isc.OBStatusBarLeftBar.create({});
     this.leftStatusBar.addMember(this.content);
 
-    this.buttonBar = isc.OBStatusBarIconButtonBar.create(this.buttonBarProperties);
+    this.buttonBar = isc.OBStatusBarIconButtonBar.create({
+      width: this.buttonBarWidth
+    });
     this.addCreateButtons();
 
     this.savedIcon = isc.Img.create(this.savedIconDefaults);
@@ -196,56 +201,71 @@
   addCreateButtons: function () {
     var i, length, buttonSpacer;
 
-    buttonSpacer = isc.HLayout.create({
-      width: this.iconButtonGroupSpacerWidth
-    });
+    if (this.customButtons) {
+      this.buttonBar.addMembers(this.customButtons);
+    }
 
-    this.previousButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'previous',
-      keyboardShortcutId: 'StatusBar_Previous',
-      prompt: OB.I18N.getLabel('OBUIAPP_PREVIOUSBUTTON')
-    });
+    if (this.showPreviousNextButton) {
+      buttonSpacer = isc.HLayout.create({
+        width: this.iconButtonGroupSpacerWidth
+      });
 
-    this.nextButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'next',
-      keyboardShortcutId: 'StatusBar_Next',
-      prompt: OB.I18N.getLabel('OBUIAPP_NEXTBUTTON')
-    });
+      this.previousButton = isc.OBStatusBarIconButton.create({
+        view: this.view,
+        buttonType: 'previous',
+        keyboardShortcutId: 'StatusBar_Previous',
+        prompt: OB.I18N.getLabel('OBUIAPP_PREVIOUSBUTTON')
+      });
 
-    this.closeButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'close',
-      keyboardShortcutId: 'StatusBar_Close',
-      prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON')
-    });
+      this.nextButton = isc.OBStatusBarIconButton.create({
+        view: this.view,
+        buttonType: 'next',
+        keyboardShortcutId: 'StatusBar_Next',
+        prompt: OB.I18N.getLabel('OBUIAPP_NEXTBUTTON')
+      });
 
-    this.maximizeButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'maximize',
-      prompt: OB.I18N.getLabel('OBUIAPP_MAXIMIZEBUTTON')
-    });
+      this.buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer]);
+    }
 
-    this.restoreButton = isc.OBStatusBarIconButton.create({
-      visibility: 'hidden',
-      view: this.view,
-      buttonType: 'restore',
-      prompt: OB.I18N.getLabel('OBUIAPP_RESTOREBUTTON')
-    });
+    if (this.showMaximizeRestoreButton) {
+      this.maximizeButton = isc.OBStatusBarIconButton.create({
+        view: this.view,
+        buttonType: 'maximize',
+        prompt: OB.I18N.getLabel('OBUIAPP_MAXIMIZEBUTTON')
+      });
 
-    this.maximizeRestoreButton = isc.OBStatusBarIconButton.create({ // Only for implement 'StatusBar_Maximize-Restore' keyboard shortcut
-      visibility: 'hidden',
-      view: this.view,
-      buttonType: 'maximizeRestore',
-      forceKeyboardShortcut: true,
-      keyboardShortcutId: 'StatusBar_Maximize-Restore'
-    });
+      this.restoreButton = isc.OBStatusBarIconButton.create({
+        visibility: 'hidden',
+        view: this.view,
+        buttonType: 'restore',
+        prompt: OB.I18N.getLabel('OBUIAPP_RESTOREBUTTON')
+      });
 
-    this.buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer, this.maximizeButton, this.restoreButton, this.closeButton, this.maximizeRestoreButton]);
+      this.maximizeRestoreButton = isc.OBStatusBarIconButton.create({ // Only for implement 'StatusBar_Maximize-Restore' keyboard shortcut
+        visibility: 'hidden',
+        view: this.view,
+        buttonType: 'maximizeRestore',
+        forceKeyboardShortcut: true,
+        keyboardShortcutId: 'StatusBar_Maximize-Restore'
+      });
+
+      this.buttonBar.addMembers([this.maximizeButton, this.restoreButton, this.maximizeRestoreButton]);
+    }
+
+    if (this.showCloseButton) {
+      this.closeButton = isc.OBStatusBarIconButton.create({
+        view: this.view,
+        buttonType: 'close',
+        keyboardShortcutId: 'StatusBar_Close',
+        prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON')
+      });
+
+      this.buttonBar.addMembers([this.closeButton]);
+    }
+
     length = this.buttonBar.members.length;
     for (i = 0; i < length; i++) {
-      if (this.buttonBar.members[i].buttonType) {
+      if (this.buttonBar.members[i].buttonType && this.view) {
         OB.TestRegistry.register('org.openbravo.client.application.statusbar.button.' + this.buttonBar.members[i].buttonType + '.' + this.view.tabId, this.buttonBar.members[i]);
       }
     }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js	Fri Jan 11 00:59:06 2013 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js	Mon Jan 14 17:14:16 2013 +0100
@@ -445,7 +445,7 @@
     var owner = this;
     this.statusBar = isc.OBStatusBar.create({
       view: this,
-      buttonBarProperties: OB.Styles.Personalization.buttonBarProperties,
+      buttonBarWidth: OB.Styles.Personalization.buttonBarWidth,
 
       // add the close button
       addCreateButtons: function () {
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-personalization-styles.js	Fri Jan 11 00:59:06 2013 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-personalization-styles.js	Mon Jan 14 17:14:16 2013 +0100
@@ -75,9 +75,7 @@
   height: 150
 };
 
-OB.Styles.Personalization.buttonBarProperties = {
-  width: 30
-};
+OB.Styles.Personalization.buttonBarWidth = 30;
 
 OB.Styles.Personalization.Icons = {
   fieldGroup: OB.Styles.skinsPath + 'Default/org.openbravo.client.application/images/personalization/iconFolder.png',
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-statusbar-styles.js	Fri Jan 11 00:59:06 2013 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-statusbar-styles.js	Mon Jan 14 17:14:16 2013 +0100
@@ -22,6 +22,7 @@
   styleName: "OBStatusBar",
   width: '100%',
   height: 30,
+  buttonBarWidth: 130,
   leaveScrollbarGap: false,
   overflow: 'hidden',
 
@@ -76,8 +77,8 @@
 
 isc.OBStatusBarIconButtonBar.addProperties({
   styleName: "OBStatusBarIconButtonBar",
-  width: 130,
   align: 'right',
+  defaultLayoutAlign: 'center',
   overflow: 'visible',
   membersMargin: 4,
   layoutLeftMargin: 3