IDEMPIERE-3426:improve tab behavior

close by selected sequence confilix with close other tab menu
This commit is contained in:
hieplq 2017-07-18 21:03:28 +07:00
parent dc79304418
commit 4c9c52bca7
2 changed files with 4 additions and 4 deletions

View File

@ -180,7 +180,7 @@ public class Tab extends org.zkoss.zul.Tab
}
if (idTabbox != null && idTabbox.isActiveBySeq()) {
org.zkoss.zul.Tab nextActiveTab = idTabbox.getNextActiveBySeq();
org.zkoss.zul.Tab nextActiveTab = idTabbox.getNextActiveBySeq(this);
if (nextActiveTab != null) {
nextActiveTab.setSelected(true);
return nextActiveTab;

View File

@ -119,7 +119,7 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
*/
@Override
public void setSelectedTab(Tab tab) {
if (getSelectedTab() != null) {
if (getSelectedTab() != null && getSelectedTab() != tab && isActiveBySeq()) {//DEFER SET SELECTED TAB
activeTabSeq.push(getSelectedTab());
}
super.setSelectedTab(tab);
@ -137,7 +137,7 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
* select next active tab by order store on stack folow FILO
* @return
*/
public Tab getNextActiveBySeq () {
public Tab getNextActiveBySeq (Tab currentTab) {
Tab cadidateTabActive = null;
while ((cadidateTabActive = activeTabSeq.peek()) != null) {
boolean canNotActive = cadidateTabActive.isDisabled() || !cadidateTabActive.isVisible();
@ -145,7 +145,7 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
// move disable item to last stack it can be active late
cadidateTabActive = activeTabSeq.pop();
activeTabSeq.addLast(cadidateTabActive);
}else if (cadidateTabActive.getParent() == null) {
}else if (cadidateTabActive.getParent() == null || currentTab == cadidateTabActive) {// when call close other tab menu, remain tab = first tab on stack, so have to ignore it when find next tab
activeTabSeq.pop();// this tab is close by code or by close at unselected state so just remove it from stack
}else {
return activeTabSeq.pop();