Skip to content

Commit 19a2a9e

Browse files
committed
added previousTab to tabPane
1 parent f210e29 commit 19a2a9e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Tutorial-o-Matic/src/main/groovy/TabPane.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class TabPane{
1212
//eliminar
1313
if (index >= 0) {
1414
tabPane.removeTabAt(index)
15+
def previousTab = tabPane.hasProperty('previousTab')? tabPane.previousTab : 0
16+
previousTab = previousTab >= tabPane.tabCount? 0 : previousTab
17+
tabPane.setSelectedIndex(previousTab)
1518
if(hideTabPane && tabPane.isShowing()) {
1619
menuUtils.executeMenuItems(['ShowFormatPanel'])
1720
}
@@ -24,6 +27,13 @@ class TabPane{
2427
if(!tabPane.isShowing()) {
2528
menuUtils.executeMenuItems(['ShowFormatPanel'])
2629
}
30+
// remembers selected tab number
31+
def previousTab = tabPane.selectedIndex
32+
if (tabPane.hasProperty('previousTab')){
33+
tabPane.previousTab = previousTab
34+
} else {
35+
tabPane.metaClass.previousTab = previousTab
36+
}
2737
// look if tab exists
2838
def index = tabPane.indexOfTab(tabName)
2939
if (index>=0) {

0 commit comments

Comments
 (0)