details: /erp/devel/pi/rev/b8c177d2f73e
changeset: 9805:b8c177d2f73e
user: Martin Taal <martin.taal <at> openbravo.com>
date: Fri Jan 14 07:29:47 2011 +0100
summary: Added maximize/restore buttons
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
| 5 +
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 78 ++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
| 15 +-
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-statusbar-styles.js
| 6 +-
4 files changed, 91 insertions(+), 13 deletions(-)
diffs (242 lines):
diff -r 78b4051539de -r b8c177d2f73e
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
Fri Jan 14 07:24:51 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
Fri Jan 14 07:29:47 2011 +0100
@@ -248,6 +248,11 @@
}
this.previousState = tmpPreviousState;
+
+ for (i = 0; i < this.tabs.length; i++) {
+ tab = this.tabs[i];
+ tab.pane.setMaximizeRestoreButtonState();
+ }
},
makeTabVisible: function(tab){
diff -r 78b4051539de -r b8c177d2f73e
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
Fri Jan 14 07:24:51 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Fri Jan 14 07:29:47 2011 +0100
@@ -421,6 +421,10 @@
parentTabSet: this.parentTabSet
});
this.addMember(this.childTabSet);
+ } else if (this.isRootView) {
+ // hide the maximize button if this is the root without
+ // children
+ this.statusBar.maximizeButton.hide();
}
},
@@ -573,7 +577,7 @@
// don't open it again
this.allowDefaultEditMode = false;
- // open form in insert mode
+ // open form in edit mode
if (record) {
this.editRecord(record, preventFocus);
} else if (!this.viewGrid.data || this.viewGrid.data.getLength() === 0) {
@@ -611,9 +615,9 @@
if (!this.childTabSet) {
return;
}
- if (this.state !== isc.OBStandardView.STATE_BOTTOM_MAX) {
+ if (this.state !== isc.OBStandardView.STATE_MID) {
this.setHalfSplit();
- this.previousState = isc.OBStandardView.STATE_TOP_MAX;
+ this.previousState = this.state;
this.state = isc.OBStandardView.STATE_MID;
}
},
@@ -628,6 +632,8 @@
this.state = this.previousState;
if (this.previousState === isc.OBStandardView.STATE_BOTTOM_MAX) {
this.setBottomMaximum();
+ } else if (tempState === isc.OBStandardView.STATE_MID &&
this.previousState === isc.OBStandardView.STATE_MID) {
+ this.setTopMaximum();
} else if (this.previousState === isc.OBStandardView.STATE_MID) {
this.setHalfSplit();
} else if (this.previousState === isc.OBStandardView.STATE_TOP_MAX) {
@@ -662,6 +668,43 @@
isc.Page.setEvent(isc.EH.IDLE, this.viewForm, isc.Page.FIRE_ONCE, 'focus');
},
+ setMaximizeRestoreButtonState: function(){
+ // single view, no maximize or restore
+ if (!this.hasChildTabs && this.isRootView) {
+ return;
+ }
+ // different cases:
+ var theState = this.state;
+ if (this.parentTabSet) {
+ theState = this.parentTabSet.state;
+ }
+ if (theState === isc.OBStandardView.STATE_TOP_MAX) {
+ this.statusBar.maximizeButton.hide();
+ this.statusBar.restoreButton.show(true);
+ } else {
+ this.statusBar.maximizeButton.show(true);
+ this.statusBar.restoreButton.hide();
+ }
+ },
+
+ maximize: function(){
+ if (this.parentTabSet) {
+ this.parentTabSet.doHandleDoubleClick();
+ } else {
+ this.doHandleDoubleClick();
+ }
+ this.setMaximizeRestoreButtonState();
+ },
+
+ restore: function(){
+ if (this.parentTabSet) {
+ this.parentTabSet.doHandleDoubleClick();
+ } else {
+ this.doHandleDoubleClick();
+ }
+ this.setMaximizeRestoreButtonState();
+ },
+
// go to a next or previous record, if !next then the previous one is used
editNextPreviousRecord: function(next){
var rowNum, newRowNum, newRecord, currentSelectedRecord =
this.viewGrid.getSelectedRecord();
@@ -702,7 +745,12 @@
}
if (!this.viewForm.newRecordSavedEvent || !this.viewForm.isVisible()) {
var gridRecord = this.viewGrid.getSelectedRecord();
- this.editRecord(gridRecord);
+ if (!gridRecord) {
+ // not passing a record forces a new record
+ this.editRecord();
+ } else {
+ this.editRecord(gridRecord);
+ }
this.viewForm.newRecordSavedEvent = false;
}
this.recordSelected();
@@ -723,8 +771,13 @@
}
for (i = 0; i < tabInfos.length; i++) {
if (tabInfos[i].targetTabId === this.tabId) {
- // found it...
- this.viewGrid.targetRecordId = tabInfos[i].targetRecordId;
+ // found it..., check if a record needs to be edited
+ if (tabInfos[i].targetRecordId) {
+ this.viewGrid.targetRecordId = tabInfos[i].targetRecordId;
+ } else {
+ // signal open grid
+ this.viewGrid.targetOpenGrid = true;
+ }
if (this.parentTabSet && this.parentTabSet.getSelectedTab() !==
this.tab) {
this.parentTabSet.selectTab(this.tab);
@@ -938,7 +991,7 @@
},
// ++++++++++++++++++++ Button Actions ++++++++++++++++++++++++++
-
+
// make a special refresh:
// - refresh the current selected record without changing the selection
// - refresh the parent/grand-parent in the same way without changing the
selection
@@ -946,6 +999,7 @@
refresh: function(refreshCallback){
if (this.viewGrid.isVisible()) {
+ this.messageBar.hide();
this.viewGrid.filterData(this.viewGrid.getCriteria(), refreshCallback);
} else {
var view = this;
@@ -1076,6 +1130,8 @@
this.members[0].setHeight('100%');
this.members[0].show();
}
+ this.state = isc.OBStandardView.STATE_TOP_MAX;
+ this.setMaximizeRestoreButtonState();
},
setBottomMaximum: function(){
@@ -1089,6 +1145,8 @@
this.members[0].setHeight('100%');
this.members[0].show();
}
+ this.state = isc.OBStandardView.STATE_BOTTOM_MAX;
+ this.setMaximizeRestoreButtonState();
},
setHalfSplit: function(){
@@ -1118,16 +1176,18 @@
this.members[0].setHeight('100%');
this.members[0].show();
}
+ this.state = isc.OBStandardView.STATE_MID;
+ this.setMaximizeRestoreButtonState();
},
- getCurrentValues: function() {
+ getCurrentValues: function(){
if (this.isShowingForm) {
return this.viewForm.getValues();
} else {
return this.viewGrid.getSelectedRecord();
}
},
-
+
//++++++++++++++++++ Reading context ++++++++++++++++++++++++++++++
getContextInfo: function(onlySessionProperties, classicMode){
diff -r 78b4051539de -r b8c177d2f73e
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
Fri Jan 14 07:24:51 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
Fri Jan 14 07:29:47 2011 +0100
@@ -59,6 +59,10 @@
var rowNum, newRowNum, newRecord;
if (this.buttonType === 'previous') {
this.view.editNextPreviousRecord(false);
+ } else if (this.buttonType === 'maximize') {
+ this.view.maximize();
+ } else if (this.buttonType === 'restore') {
+ this.view.restore();
} else if (this.buttonType === 'next') {
this.view.editNextPreviousRecord(true);
} else if (this.buttonType === 'close') {
@@ -107,12 +111,21 @@
view: this.view,
buttonType: 'close'
});
+ this.maximizeButton = isc.OBStatusBarIconButton.create({
+ view: this.view,
+ buttonType: 'maximize'
+ });
+ this.restoreButton = isc.OBStatusBarIconButton.create({
+ visibility: 'hidden',
+ view: this.view,
+ buttonType: 'restore'
+ });
var buttonSpacer = isc.HLayout.create({
width: this.iconButtonGroupSpacerWidth
});
var buttonBar = isc.OBStatusBarIconButtonBar.create({});
- buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer,
closeButton]);
+ buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer,
this.maximizeButton, this.restoreButton, closeButton]);
this.addMembers([this.leftBar, buttonBar]);
},
diff -r 78b4051539de -r b8c177d2f73e
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-statusbar-styles.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-statusbar-styles.js
Fri Jan 14 07:24:51 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-statusbar-styles.js
Fri Jan 14 07:29:47 2011 +0100
@@ -51,9 +51,9 @@
isc.OBStatusBarIconButtonBar.addProperties({
styleName: "OBStatusBarIconButtonBar",
- width: 110,
- align: 'left',
-// overflow: 'visible',
+ width: 130,
+ align: 'right',
+ overflow: 'visible',
membersMargin: 4
});
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits