Skip to content

Commit

Permalink
Merge pull request #1 from mig82/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mig82 authored Jul 8, 2019
2 parents bdd5cac + 7242e0b commit 7668ba4
Show file tree
Hide file tree
Showing 34 changed files with 444 additions and 222 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# TabsMenu

This project showcases an example of how to build a *Reusable Tabs Menu
Component* using *Kony Visualizer*. The Visualizer project just serves as a
wrapper to demo the component. The component -called
`com.mig82.TabsMenu` is the real focus of this exercise.

## External Dependencies

This project uses AmplifyJs's core module. This is bundled within the component
so once the component is imported this Javascript module will be added to the
project's global `modules` directory.

## Implementation Notes

This project was built using Kony Visualizer Visualizer 8.4.22.

## Other Considerations

This tabs menu is designed to create the illusion that when navigating between
two forms that have it, the header is fixed and only the content of the rest of
the screen changes. For this to work, make sure that both `IN` and `OUT`
transitions of all your forms are set to `None`.
6 changes: 3 additions & 3 deletions controllers/mobile/Form1Controller/Form1Controller.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
define(function(){

function onTabSelected(friendlyName, context){
alert(`Form1\nPrior: ${context.priorTab}\nNew2:${friendlyName}`);
$router.goto(friendlyName, context);
/*globals $router, amplify*/
function onTabSelected(selectedTab, context){
$router.goto(selectedTab, context);
}

return {
Expand Down
2 changes: 1 addition & 1 deletion controllers/mobile/Form2Controller/Form2Controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(function(){

/*globals $router, amplify*/
function onTabSelected(friendlyName, context){
alert(`Form2\nPrior: ${context.priorTab}\nNew2:${friendlyName}`);
$router.goto(friendlyName, context);
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/mobile/Form3Controller/Form3Controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(function(){

/*globals $router, amplify*/
function onTabSelected(friendlyName, context){
alert(`Form3\nPrior: ${context.priorTab}\nNew2:${friendlyName}`);
$router.goto(friendlyName, context);
}

Expand Down
38 changes: 36 additions & 2 deletions forms/mobile/Form1.sm/Form1.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
"addWidgetsdone": false,
"allboxes": [],
"android": {
"inTransitionConfig": {
"formAnimation": 0
},
"needAppMenu": false,
"outTransitionConfig": {
"formAnimation": 0
},
"psp": {
"windowSoftInputMode": 2
}
Expand All @@ -45,7 +51,7 @@
},
"displayorientation": 1,
"enabledforidletimeout": false,
"friendlyName": "Form1",
"friendlyName": "f1",
"id": "Form1",
"info": null,
"initdone": false,
Expand All @@ -58,7 +64,17 @@
"titleBar": false
},
"iphone": {
"inTransitionConfig": {
"transitionDirection": "none",
"transitionDuration": 0.3,
"transitionEffect": "transitionFade"
},
"needAppMenu": false,
"outTransitionConfig": {
"transitionDirection": "none",
"transitionDuration": 0.3,
"transitionEffect": "transitionFade"
},
"psp": {
"inputAccessoryViewType": 4,
"titleBarAttributes": {
Expand Down Expand Up @@ -102,6 +118,14 @@
"retainscrollposition": false,
"snapgridsize": 10,
"snaptogrid": true,
"spa": {
"inTransitionConfig": {
"formTransition": "none"
},
"outTransitionConfig": {
"formTransition": "none"
}
},
"spaan": {
"needAppMenu": false
},
Expand Down Expand Up @@ -131,6 +155,16 @@
"needAppMenu": false
},
"winphone8": {
"needAppMenu": false
"inTransitionConfig": {
"inTransition": "none",
"transitionMode": "none",
"transitionSpeed": 0
},
"needAppMenu": false,
"outTransitionConfig": {
"outTransition": "none",
"transitionMode": "none",
"transitionSpeed": 0
}
}
}
6 changes: 3 additions & 3 deletions forms/mobile/Form1.sm/TabsMenu.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"clipbounds": false,
"containerweight": 0,
"data": {
"centerTabTarget": "Form2",
"centerSignal": "f2",
"centerTabText": "title.centre_tab",
"leftTabTarget": "Form1",
"leftSignal": "f1",
"leftTabText": "title.left_tab",
"rightTabTarget": "Form3",
"rightSignal": "f3",
"rightTabText": "title.right_tab",
"selectedTab": "left"
},
Expand Down
38 changes: 36 additions & 2 deletions forms/mobile/Form2.sm/Form2.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
"addWidgetsdone": false,
"allboxes": [],
"android": {
"inTransitionConfig": {
"formAnimation": 0
},
"needAppMenu": false,
"outTransitionConfig": {
"formAnimation": 0
},
"psp": {
"windowSoftInputMode": 2
}
Expand All @@ -45,7 +51,7 @@
},
"displayorientation": 1,
"enabledforidletimeout": false,
"friendlyName": "Form2",
"friendlyName": "f2",
"id": "Form2",
"info": null,
"initdone": false,
Expand All @@ -58,7 +64,17 @@
"titleBar": false
},
"iphone": {
"inTransitionConfig": {
"transitionDirection": "none",
"transitionDuration": 0.3,
"transitionEffect": "transitionFade"
},
"needAppMenu": false,
"outTransitionConfig": {
"transitionDirection": "none",
"transitionDuration": 0.3,
"transitionEffect": "transitionFade"
},
"psp": {
"inputAccessoryViewType": 4,
"titleBarAttributes": {
Expand Down Expand Up @@ -102,6 +118,14 @@
"retainscrollposition": false,
"snapgridsize": 10,
"snaptogrid": true,
"spa": {
"inTransitionConfig": {
"formTransition": "none"
},
"outTransitionConfig": {
"formTransition": "none"
}
},
"spaan": {
"needAppMenu": false
},
Expand Down Expand Up @@ -131,6 +155,16 @@
"needAppMenu": false
},
"winphone8": {
"needAppMenu": false
"inTransitionConfig": {
"inTransition": "none",
"transitionMode": "none",
"transitionSpeed": 0
},
"needAppMenu": false,
"outTransitionConfig": {
"outTransition": "none",
"transitionMode": "none",
"transitionSpeed": 0
}
}
}
6 changes: 3 additions & 3 deletions forms/mobile/Form2.sm/TabsMenu.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"clipbounds": false,
"containerweight": 0,
"data": {
"centerTabTarget": "Form2",
"centerSignal": "f2",
"centerTabText": "title.centre_tab",
"leftTabTarget": "Form1",
"leftSignal": "f1",
"leftTabText": "title.left_tab",
"rightTabTarget": "Form3",
"rightSignal": "f3",
"rightTabText": "title.right_tab",
"selectedTab": "center"
},
Expand Down
38 changes: 36 additions & 2 deletions forms/mobile/Form3.sm/Form3.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
"addWidgetsdone": false,
"allboxes": [],
"android": {
"inTransitionConfig": {
"formAnimation": 0
},
"needAppMenu": false,
"outTransitionConfig": {
"formAnimation": 0
},
"psp": {
"windowSoftInputMode": 2
}
Expand All @@ -45,7 +51,7 @@
},
"displayorientation": 1,
"enabledforidletimeout": false,
"friendlyName": "Form3",
"friendlyName": "f3",
"id": "Form3",
"info": null,
"initdone": false,
Expand All @@ -58,7 +64,17 @@
"titleBar": false
},
"iphone": {
"inTransitionConfig": {
"transitionDirection": "none",
"transitionDuration": 0.3,
"transitionEffect": "transitionFade"
},
"needAppMenu": false,
"outTransitionConfig": {
"transitionDirection": "none",
"transitionDuration": 0.3,
"transitionEffect": "transitionFade"
},
"psp": {
"inputAccessoryViewType": 4,
"titleBarAttributes": {
Expand Down Expand Up @@ -102,6 +118,14 @@
"retainscrollposition": false,
"snapgridsize": 10,
"snaptogrid": true,
"spa": {
"inTransitionConfig": {
"formTransition": "none"
},
"outTransitionConfig": {
"formTransition": "none"
}
},
"spaan": {
"needAppMenu": false
},
Expand Down Expand Up @@ -131,6 +155,16 @@
"needAppMenu": false
},
"winphone8": {
"needAppMenu": false
"inTransitionConfig": {
"inTransition": "none",
"transitionMode": "none",
"transitionSpeed": 0
},
"needAppMenu": false,
"outTransitionConfig": {
"outTransition": "none",
"transitionMode": "none",
"transitionSpeed": 0
}
}
}
6 changes: 3 additions & 3 deletions forms/mobile/Form3.sm/TabsMenu.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"clipbounds": false,
"containerweight": 0,
"data": {
"centerTabTarget": "Form2",
"centerSignal": "f2",
"centerTabText": "title.centre_tab",
"leftTabTarget": "Form1",
"leftSignal": "f1",
"leftTabText": "title.left_tab",
"rightTabTarget": "Form3",
"rightSignal": "f3",
"rightTabText": "title.right_tab",
"selectedTab": "right"
},
Expand Down
1 change: 1 addition & 0 deletions modules/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
function bootstrap(){
/*glogals amplify*/
amplify.allowDuplicates(false);
}
2 changes: 1 addition & 1 deletion modules/core/amplify-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var amplify = global.amplify = {
if ( !added ) {
subscriptions[ topic ].unshift( subscriptionInfo );
}
alert(`Topic: ${topic}\nCount: ${subscriptions[ topic ].length}`);
//alert(`Topic: ${topic}\nCount: ${subscriptions[ topic ].length}`);
}
}

Expand Down
20 changes: 12 additions & 8 deletions modules/core/router.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
/*exported $router*/
var $router = (function(){

function _goto(friendlyName, context){
Logger.info("Routing to '" + friendlyName + "'");

try{
(new kony.mvc.Navigation(friendlyName)).navigate(context);
}
catch(e){
let message = "Can't navigate to form ";
message += `by friendly name '${friendlyName}'\nError: ${e}`;

//alert(message);
var toast = new kony.ui.Toast({
text:message,
duration: constants.TOAST_LENGTH_LONG
});
toast.show();
if(typeof kony.ui.Toast === "undefined"){
alert(message);
}
else{
var toast = new kony.ui.Toast({
text:message,
duration: constants.TOAST_LENGTH_LONG
});
toast.show();
}
}
}

Expand Down
19 changes: 19 additions & 0 deletions modules/extensions/mvc_genAncestors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Define a component's setters and getters in one line by just listing the fields -e.g.:
* initGettersSetters: function() {kony.mvc.genAccessors(this, ["foo","bar"]);}
*/
((definition) => {
kony.mvc.genAccessors = definition;
})((compCtrl, fields) => {

fields.forEach((fieldName) => {
//The internal field name is prefixed with underscore -e.g.: "_foo" for field "foo"
var internalFieldName = "_" + fieldName;
defineGetter(compCtrl, fieldName, function () {
return compCtrl[internalFieldName];
});
defineSetter(compCtrl, fieldName, function (message) {
compCtrl[internalFieldName] = message;
});
});
});
File renamed without changes.
Loading

0 comments on commit 7668ba4

Please sign in to comment.