diff --git a/package.xml b/package.xml new file mode 100755 index 0000000..22a8576 --- /dev/null +++ b/package.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tabjumper/tabjumper.xml b/tabjumper/tabjumper.xml new file mode 100755 index 0000000..918eaeb --- /dev/null +++ b/tabjumper/tabjumper.xml @@ -0,0 +1,57 @@ + + + Tab Jumper + Tab Jumper. + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA7wAOAA6+4et8AAAACXBIWXMAAAG7AAABuwE67OPiAAAAB3RJTUUH3gIHDy8NZAa/ywAAAVdJREFUOMu9k7FqAkEQhr+R2xy6cCgIsUsTGwNiY5EqVSAEAyGSN0iZMo+S10iTFLFNWrnmwE4ErRSFwIZw3iFsCtF45rxY5S9nZr+d+XdHrLWkSUTyQBMob6VmQNdaGwI47FZzPB6/uK7rbQajKDKVSuUKeAdwROQYqKcADl3X9bTWfJV/mnCHQ2+zKweoh2H4FEXRL8J8PkdrjZ7NAJago6NEjQMQxzGFQmHbA7TW/CUBbowxT/l8PrUgDEN832c6nQJwfncHQMmYM6DrAORyuZ03+L5PrVbjoFpNxD887209gogwGAwIguAXYDKZ0Gg06PQeuTi5T+RKxrTXgCAIaLVa7DITSEBkNIJicdmBUorFYkEcx7x+Pmea1uk9AnApsn6FQCnVBk6NMQ/sqZVvjrW2D/RFJNPMlK++BKUF/xWQWCalFNfl270AjrM8Kqt1zliqLAXfTGtwCelLETIAAAAASUVORK5CYII= + + + + Tab class + Behavior + The class assigned to the tab container on which this widget should act. + + + Jump to + Behavior + Select the jump action destination. + + First Tab + Previous Tab + Next Tab + Last Tab + Tab title + Tab number + + + + Tab Title + Behavior + The title of the tab to activate. (required when Jump to = Tab title) + + + Tab Number + Behavior + The number of the the tab to activate. (required when Jump To = Tab number) + + + Button title + Appearance + The title. + + + Render as + Appearance + Show as a string or as a button. + + Button + Link + + + + Image + Appearance + The button image. + + + \ No newline at end of file diff --git a/tabjumper/widget/tabjumper.js b/tabjumper/widget/tabjumper.js new file mode 100755 index 0000000..909162a --- /dev/null +++ b/tabjumper/widget/tabjumper.js @@ -0,0 +1,80 @@ +/* +* Created by Matthijs Dekker (Trivento) +* February 2014 +* +* V1.0 +*/ + +dojo.provide("tabjumper.widget.tabjumper"); + +mendix.widget.declare('tabjumper.widget.tabjumper', { + inputargs: { + // styling + btnTitle : '', + showAsButton : '', + btnIcon : '', + // behaviour + tabclass : '', + jumpTo: '', + tabName : '', + tabNumber: 0 + }, + + parent : null, + btn : null, + + postCreate : function() { + this.buildJumper(); + this.actRendered(); + }, + + buildJumper : function () { + this.btn = new mendix.widget._Button({ + caption : this.btnTitle, + iconUrl : this.btnIcon, + onClick : dojo.hitch(this, this.performTabJump), + type : this.showAsButton, + cssclass : "" + }); + this.domNode.appendChild(this.btn.domNode); + }, + + getNewActiveTab : function () { + var tabWidgetCssSelected = dojo.query("."+this.tabclass)[0]; + this.parent = dijit.byNode(tabWidgetCssSelected); + var tabList = this.parent.getChildren(); + if (this.jumpTo === 'First') { + return tabList[0]; + } + if (this.jumpTo === 'Last') { + return tabList[tabList.length-1]; + } + if (this.jumpTo === 'Numbered') { + return tabList[this.tabNumber -1]; + } + for(var i=0; tabList.length; i++) { + if (this.jumpTo === 'Titled' && tabList[i].title == this.tabName) { + return tabList[i]; + } + if (tabList[i].button.className == "active") { + if (this.jumpTo === 'Next') { + return tabList[i+1]; + } + if (this.jumpTo === 'Previous') { + return tabList[i-1]; + } + } + } + return null; + }, + + performTabJump : function () { + var tab = this.getNewActiveTab(); + if (tab) { + this.parent.show(tab); + } + }, + + uninitialize : function(){ + } +});