IDEMPIERE-3426:improve tab behavior
close by selected sequence confilix with close other tab menu
This commit is contained in:
parent
dc79304418
commit
4c9c52bca7
|
@ -180,7 +180,7 @@ public class Tab extends org.zkoss.zul.Tab
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idTabbox != null && idTabbox.isActiveBySeq()) {
|
if (idTabbox != null && idTabbox.isActiveBySeq()) {
|
||||||
org.zkoss.zul.Tab nextActiveTab = idTabbox.getNextActiveBySeq();
|
org.zkoss.zul.Tab nextActiveTab = idTabbox.getNextActiveBySeq(this);
|
||||||
if (nextActiveTab != null) {
|
if (nextActiveTab != null) {
|
||||||
nextActiveTab.setSelected(true);
|
nextActiveTab.setSelected(true);
|
||||||
return nextActiveTab;
|
return nextActiveTab;
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSelectedTab(Tab tab) {
|
public void setSelectedTab(Tab tab) {
|
||||||
if (getSelectedTab() != null) {
|
if (getSelectedTab() != null && getSelectedTab() != tab && isActiveBySeq()) {//DEFER SET SELECTED TAB
|
||||||
activeTabSeq.push(getSelectedTab());
|
activeTabSeq.push(getSelectedTab());
|
||||||
}
|
}
|
||||||
super.setSelectedTab(tab);
|
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
|
* select next active tab by order store on stack folow FILO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Tab getNextActiveBySeq () {
|
public Tab getNextActiveBySeq (Tab currentTab) {
|
||||||
Tab cadidateTabActive = null;
|
Tab cadidateTabActive = null;
|
||||||
while ((cadidateTabActive = activeTabSeq.peek()) != null) {
|
while ((cadidateTabActive = activeTabSeq.peek()) != null) {
|
||||||
boolean canNotActive = cadidateTabActive.isDisabled() || !cadidateTabActive.isVisible();
|
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
|
// move disable item to last stack it can be active late
|
||||||
cadidateTabActive = activeTabSeq.pop();
|
cadidateTabActive = activeTabSeq.pop();
|
||||||
activeTabSeq.addLast(cadidateTabActive);
|
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
|
activeTabSeq.pop();// this tab is close by code or by close at unselected state so just remove it from stack
|
||||||
}else {
|
}else {
|
||||||
return activeTabSeq.pop();
|
return activeTabSeq.pop();
|
||||||
|
|
Loading…
Reference in New Issue