Process Button Implemented

This commit is contained in:
Luis Fernando Molina committed 2018-06-15 07:50:10 +02:00
1 parent 073045e20a
commit 5d470480de
4 files changed
+82 -20

No files matched your search

+11 -6
View File
@@ -1,14 +1,14 @@
function newCurrentBot() {
var thisObject = {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;
@@ -21,6 +21,8 @@ function newCurrentBot() {
container.isDraggeable = false;
container.isClickeable = true;
const NOT_FOUND = "You have no Bots";
let sharedStatus;
return thisObject;
@@ -30,11 +32,11 @@ function newCurrentBot() {
sharedStatus = pSharedStatus;
if (window.USER_PROFILE.devTeams.length === 0) {
window.CURRENT_BOT = "You have no Bots";
window.CURRENT_BOT = NOT_FOUND;
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length === 0) {
window.CURRENT_BOT = "You have no Bots";
window.CURRENT_BOT = NOT_FOUND;
} else {
window.CURRENT_BOT = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
}
@@ -50,10 +52,11 @@ function newCurrentBot() {
sharedStatus.currentUserBotIndex = 0;
window.CURRENT_BOT = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
sharedStatus.eventHandler.raiseEvent("userBot Changed");
} else {
window.CURRENT_BOT = "You have no Bots";
window.CURRENT_BOT = NOT_FOUND;
}
}
@@ -64,6 +67,7 @@ function newCurrentBot() {
sharedStatus.currentUserBotIndex = 0;
window.CURRENT_BOT = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
sharedStatus.eventHandler.raiseEvent("userBot Changed");
return;
}
@@ -71,6 +75,7 @@ function newCurrentBot() {
sharedStatus.currentUserBotIndex++;
window.CURRENT_BOT = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].displayName;
sharedStatus.eventHandler.raiseEvent("userBot Changed");
return;
}
}
+62 -7
View File
@@ -1,14 +1,14 @@
function newCurrentProcess() {
var thisObject = {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;
@@ -19,15 +19,70 @@ function newCurrentProcess() {
container.frame.position.y = 0;
container.isDraggeable = false;
container.isClickeable = true;
const NOT_FOUND = "No Process Found";
let sharedStatus;
return thisObject;
function initialize() {
function initialize(pSharedStatus) {
window.CURRENT_PROCESS = window.localStorage.getItem("currentProcess");
sharedStatus = pSharedStatus;
if (window.CURRENT_PROCESS === null) {
window.CURRENT_PROCESS = "";
if (window.USER_PROFILE.devTeams.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND;
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND;
} else {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length === 0) {
window.CURRENT_PROCESS = NOT_FOUND;
} else {
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
}
}
}
thisObject.container.eventHandler.listenToEvent("onMouseClick", onClick);
sharedStatus.eventHandler.listenToEvent("userBot Changed", onUserBotChanged);
}
function onUserBotChanged() {
if ( window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length > 0) {
if (window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes.length > 0) {
sharedStatus.currentProcessIndex = 0;
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
return;
}
}
window.CURRENT_PROCESS = NOT_FOUND;
}
function onClick() {
if (sharedStatus.currentProcessIndex + 1 === window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length) {
sharedStatus.currentProcessIndex = 0;
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
return;
}
if (sharedStatus.currentProcessIndex + 1 < window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots.length) {
sharedStatus.currentProcessIndex++;
window.CURRENT_PROCESS = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].userBots[sharedStatus.currentUserBotIndex].processes[sharedStatus.currentProcessIndex].name;
return;
}
}
+6 -4
View File
@@ -1,14 +1,14 @@
function newDevTeam() {
var thisObject = {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;
@@ -21,6 +21,8 @@ function newDevTeam() {
container.isDraggeable = false;
container.isClickeable = true;
const NOT_FOUND = "Not a devTeam Member";
let sharedStatus;
return thisObject;
@@ -30,7 +32,7 @@ function newDevTeam() {
sharedStatus = pSharedStatus;
if (window.USER_PROFILE.devTeams.length === 0) {
window.DEV_TEAM = "Not a devTeam Member";
window.DEV_TEAM = NOT_FOUND;
} else {
window.DEV_TEAM = window.USER_PROFILE.devTeams[sharedStatus.currentDevTeamIndex].displayName;
}
+3 -3
View File
@@ -1,14 +1,14 @@
function newEndUser() {
var thisObject = {
let thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;