@@ -325,6 +325,21 @@ javaxt.express.app.Horizon = function(parent, config) {
325
325
} ;
326
326
327
327
328
+ //**************************************************************************
329
+ //** beforeTabChange
330
+ //**************************************************************************
331
+ /** Called immediately before a tab is raised in the tab bar.
332
+ * @param currTab Object representing the current tab. Example:
333
+ * <ul>
334
+ * <li>name: Name/label of the tab (String)</li>
335
+ * <li>tab: Tab in the tab bar (DOM Object)</li>
336
+ * <li>panel: The panel that is rendered in the body (Object)</li>
337
+ * </ul>
338
+ * @param nextTab Object representing the tab that will be raised.
339
+ */
340
+ this . beforeTabChange = function ( currTab , nextTab ) { } ;
341
+
342
+
328
343
//**************************************************************************
329
344
//** onTabChange
330
345
//**************************************************************************
@@ -463,7 +478,7 @@ javaxt.express.app.Horizon = function(parent, config) {
463
478
464
479
465
480
//Update history
466
- updateHistory ( {
481
+ me . updateHistory ( {
467
482
title : config . name + " - " + requestedTab ,
468
483
tab : requestedTab ,
469
484
url : url
@@ -480,7 +495,7 @@ javaxt.express.app.Horizon = function(parent, config) {
480
495
if ( ! currTab ) currTab = user . preferences . get ( "Tab" ) ;
481
496
if ( currTab && tabs [ currTab ] ) {
482
497
483
- updateHistory ( {
498
+ me . updateHistory ( {
484
499
title : config . name + " - " + currTab ,
485
500
tab : currTab
486
501
} ) ;
@@ -492,7 +507,7 @@ javaxt.express.app.Horizon = function(parent, config) {
492
507
for ( var tabLabel in tabs ) {
493
508
if ( tabs . hasOwnProperty ( tabLabel ) ) {
494
509
495
- updateHistory ( {
510
+ me . updateHistory ( {
496
511
title : config . name + " - " + tabLabel ,
497
512
tab : tabLabel
498
513
} ) ;
@@ -740,9 +755,33 @@ javaxt.express.app.Horizon = function(parent, config) {
740
755
tab . onclick = function ( ) {
741
756
if ( this . className === "active" ) return ;
742
757
758
+
759
+ var currTab ;
760
+ for ( var i = 0 ; i < tabbar . childNodes . length ; i ++ ) {
761
+ var t = tabbar . childNodes [ i ] ;
762
+ if ( t . className === "active" ) {
763
+
764
+ var l = t . innerText ;
765
+ currTab = {
766
+ name : l ,
767
+ tab : t ,
768
+ panel : panels [ l ]
769
+ } ;
770
+ break ;
771
+ }
772
+ }
773
+
774
+ me . beforeTabChange ( currTab , {
775
+ name : label ,
776
+ tab : this ,
777
+ panel : panels [ label ]
778
+ } ) ;
779
+
780
+
781
+
743
782
//Update history. Do this BEFORE raising the tab so that whatever
744
783
//history the tab panel wants to modify happens AFTER the tab change.
745
- addHistory ( {
784
+ me . addHistory ( {
746
785
title : config . name + " - " + label ,
747
786
tab : label
748
787
} ) ;
@@ -760,15 +799,15 @@ javaxt.express.app.Horizon = function(parent, config) {
760
799
//**************************************************************************
761
800
//** addHistory
762
801
//**************************************************************************
763
- var addHistory = function ( params ) {
802
+ this . addHistory = function ( params ) {
764
803
updateState ( params , false ) ;
765
804
} ;
766
805
767
806
768
807
//**************************************************************************
769
808
//** updateHistory
770
809
//**************************************************************************
771
- var updateHistory = function ( params ) {
810
+ this . updateHistory = function ( params ) {
772
811
updateState ( params , true ) ;
773
812
} ;
774
813
0 commit comments