Autoformatter applied on all js files

This commit is contained in:
Luis Fernando Molina committed 2019-02-23 10:32:06 +01:00
1 parent 72c1017b20
commit c627aedcf6
59 files changed
+9087 -10892

No files matched your search

+72 -82
View File
@@ -1,105 +1,95 @@
function newBottomSpace() {

function newBottomSpace () {
var thisObject = {
deleteTradingHistory: undefined,
chartAspectRatio: undefined,
playStopButton: undefined,
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
var thisObject = {
deleteTradingHistory: undefined,
chartAspectRatio: undefined,
playStopButton: undefined,
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
var container = newContainer();
container.initialize();
thisObject.container = container;
container.isDraggeable = false
container.isDraggeable = false;
resize()
resize();
return thisObject
return thisObject;
function initialize () {
thisObject.deleteTradingHistory = newDeleteTradingHistory()
thisObject.deleteTradingHistory.initialize()
function initialize() {
thisObject.chartAspectRatio = newChartAspectRatio()
thisObject.chartAspectRatio.initialize()
thisObject.deleteTradingHistory = newDeleteTradingHistory();
thisObject.deleteTradingHistory.initialize();
thisObject.playStopButton = newPlayStopButton()
thisObject.playStopButton.initialize()
thisObject.chartAspectRatio = newChartAspectRatio();
thisObject.chartAspectRatio.initialize();
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
}
thisObject.playStopButton = newPlayStopButton();
thisObject.playStopButton.initialize();
function resize () {
container.frame.position.x = 0
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
}
}
function getContainer (point) {
let container
function resize() {
container = thisObject.deleteTradingHistory.getContainer(point)
if (container !== undefined) { return container }
container.frame.position.x = 0;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
container = thisObject.chartAspectRatio.getContainer(point)
if (container !== undefined) { return container }
thisObject.container.frame.width = browserCanvas.width;
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT;
}
function getContainer(point) {
let container;
container = thisObject.deleteTradingHistory.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.chartAspectRatio.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.playStopButton.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.playStopButton.getContainer(point)
if (container !== undefined) { return container }
/* The point does not belong to any inner container, so we return the current container. */
return thisObject.container;
return thisObject.container
}
function draw () {
thisObject.container.frame.draw(false, false)
drawBackground()
thisObject.deleteTradingHistory.draw()
thisObject.chartAspectRatio.draw()
thisObject.playStopButton.draw()
}
function drawBackground () {
let opacity = 1
let zeroPoint = {
x: 0,
y: 0
}
function draw() {
zeroPoint = thisObject.container.frame.frameThisPoint(zeroPoint)
thisObject.container.frame.draw(false, false);
let breakpointsHeight = 15
const RED_LINE_HIGHT = 5
drawBackground();
thisObject.deleteTradingHistory.draw();
thisObject.chartAspectRatio.draw();
thisObject.playStopButton.draw();
browserCanvasContext.beginPath()
browserCanvasContext.rect(zeroPoint.x, zeroPoint.y + breakpointsHeight, thisObject.container.frame.width, thisObject.container.frame.height)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'
browserCanvasContext.closePath()
browserCanvasContext.fill()
}
function drawBackground() {
let opacity = 1;
let zeroPoint = {
x: 0,
y: 0
};
zeroPoint = thisObject.container.frame.frameThisPoint(zeroPoint);
let breakpointsHeight = 15;
const RED_LINE_HIGHT = 5;
browserCanvasContext.beginPath();
browserCanvasContext.rect(zeroPoint.x, zeroPoint.y + breakpointsHeight, thisObject.container.frame.width, thisObject.container.frame.height );
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')';
browserCanvasContext.closePath();
browserCanvasContext.fill();
browserCanvasContext.beginPath();
browserCanvasContext.rect(zeroPoint.x, zeroPoint.y + breakpointsHeight, thisObject.container.frame.width,RED_LINE_HIGHT);
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')';
browserCanvasContext.closePath();
browserCanvasContext.fill();
}
}
browserCanvasContext.beginPath()
browserCanvasContext.rect(zeroPoint.x, zeroPoint.y + breakpointsHeight, thisObject.container.frame.width, RED_LINE_HIGHT)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')'
browserCanvasContext.closePath()
browserCanvasContext.fill()
}
}
+69 -84
View File
@@ -1,132 +1,117 @@
/*
/*
The chart space is where all the charts live. What this space contains is a type of object we call Time Machine. A Time Machine is a cointainer of
charts objects. The idea is simple, all the chart objects are ploted according to the time of the Time Machine object. When the time of the Time Machine
charts objects. The idea is simple, all the chart objects are ploted according to the time of the Time Machine object. When the time of the Time Machine
changes, then all charts in it are replotted with the corresponging data.
*/
function newChartSpace() {
function newChartSpace () {
const MODULE_NAME = 'Chart Space'
const INFO_LOG = false
const logger = newWebDebugLog()
logger.fileName = MODULE_NAME
const MODULE_NAME = "Chart Space";
const INFO_LOG = false;
const logger = newWebDebugLog();
logger.fileName = MODULE_NAME;
var thisObject = {
container: undefined,
draw: draw,
timeMachines: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
var thisObject = {
container: undefined,
draw: draw,
timeMachines: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.frame.width = CHART_SPACE_WIDTH
thisObject.container.frame.height = CHART_SPACE_HEIGHT
var container = newContainer();
container.initialize();
thisObject.container = container;
container.displacement.containerName = 'Chart Space'
container.frame.containerName = 'Chart Space'
thisObject.container.frame.width = CHART_SPACE_WIDTH;
thisObject.container.frame.height = CHART_SPACE_HEIGHT;
container.frame.position.x = browserCanvas.width / 2 - thisObject.container.frame.width / 2
container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
container.displacement.containerName = "Chart Space";
container.frame.containerName = "Chart Space";
container.isDraggeable = false
container.frame.position.x = browserCanvas.width / 2 - thisObject.container.frame.width / 2;
container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2;
return thisObject
container.isDraggeable = false;
function initialize (callBackFunction) {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
return thisObject;
function initialize(callBackFunction) {
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
let initializedCounter = 0;
let toInitialize = 1;
let initializedCounter = 0
let toInitialize = 1
/* We create the first of many possible time machines that could live at the Chart Space. */
var timeMachine = newTimeMachine();
var timeMachine = newTimeMachine()
timeMachine.container.displacement.parentDisplacement = this.container.displacement;
timeMachine.container.frame.parentFrame = this.container.frame;
timeMachine.container.displacement.parentDisplacement = this.container.displacement
timeMachine.container.frame.parentFrame = this.container.frame
timeMachine.container.parentContainer = this.container;
timeMachine.container.parentContainer = this.container
/* We make the time machine a little bit smaller than the current space. */
timeMachine.container.frame.width = this.container.frame.width * 1;
timeMachine.container.frame.height = this.container.frame.height * 1;
timeMachine.container.frame.width = this.container.frame.width * 1
timeMachine.container.frame.height = this.container.frame.height * 1
timeMachine.container.frame.position.x = this.container.frame.width / 2 - timeMachine.container.frame.width / 2;
timeMachine.container.frame.position.y = this.container.frame.height / 2 - timeMachine.container.frame.height / 2;
timeMachine.container.frame.position.x = this.container.frame.width / 2 - timeMachine.container.frame.width / 2
timeMachine.container.frame.position.y = this.container.frame.height / 2 - timeMachine.container.frame.height / 2
timeMachine.initialize(onTimeMachineInitialized);
timeMachine.initialize(onTimeMachineInitialized)
function onTimeMachineInitialized(err) {
function onTimeMachineInitialized (err) {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> onTimeMachineInitialized -> Entering function.') }
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onTimeMachineInitialized -> Entering function."); }
initializedCounter++
initializedCounter++;
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> onTimeMachineInitialized -> Initialization of a Time Machine failed.') }
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
callBackFunction(err)
return
}
if (INFO_LOG === true) { logger.write("[INFO] initialize -> onTimeMachineInitialized -> Initialization of a Time Machine failed."); }
thisObject.timeMachines.push(timeMachine)
callBackFunction(err);
return;
}
thisObject.timeMachines.push(timeMachine);
if (initializedCounter === toInitialize) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE);
}
}
if (initializedCounter === toInitialize) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
}
}
}
function draw() {
thisObject.container.frame.draw(false, false);
function draw () {
thisObject.container.frame.draw(false, false)
/* When we draw the chart space, that means we draw all the time machines in it. */
for (var i = 0; i < thisObject.timeMachines.length; i++ ) {
var timeMachine = thisObject.timeMachines[i];
timeMachine.draw();
}
for (var i = 0; i < thisObject.timeMachines.length; i++) {
var timeMachine = thisObject.timeMachines[i]
timeMachine.draw()
}
}
function getContainer(point) {
function getContainer (point) {
if (INFO_LOG === true) { logger.write('[INFO] getContainer -> Entering function.') }
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
let container;
let container
/* Now we see which is the inner most container that has it */
for (var i = 0; i < this.timeMachines.length; i++) {
container = this.timeMachines[i].getContainer(point);
if (container !== undefined) {
for (var i = 0; i < this.timeMachines.length; i++) {
container = this.timeMachines[i].getContainer(point)
if (container !== undefined) {
/* We found an inner container which has the point. We return it. */
return container;
}
}
return container
}
}
/* The point does not belong to any inner container, so we return the current container. */
return this.container;
}
}
return this.container
}
}
+21 -29
View File
@@ -1,44 +1,36 @@
function newFloatingSpace() {

function newFloatingSpace () {
/*
The Floating Space is the place where floating elements like floatingObjects, live and are rendered.
This space has its own physics which helps with the animation of these objects and also preventing them to overlap.
*/
let thisObject = {
floatingLayer: undefined, // This is the array of floatingObjects being displayed
profileBalls: undefined,
noteSets: undefined,
initialize: initialize
};
let thisObject = {
floatingLayer: undefined, // This is the array of floatingObjects being displayed
profileBalls: undefined,
noteSets: undefined,
initialize: initialize
}
return thisObject;
return thisObject
function initialize(callBackFunction) {
function initialize (callBackFunction) {
thisObject.floatingLayer = newFloatingLayer()
thisObject.floatingLayer.initialize(onFloatingLayerInitialized)
thisObject.floatingLayer = newFloatingLayer();
thisObject.floatingLayer.initialize(onFloatingLayerInitialized);
function onFloatingLayerInitialized (err) {
thisObject.profileBalls = newProfileBalls()
thisObject.profileBalls.initialize(thisObject.floatingLayer, onProfileBallsInitialized)
function onFloatingLayerInitialized(err) {
function onProfileBallsInitialized (err) {
thisObject.noteSets = newNoteSets()
thisObject.noteSets.initialize(thisObject.floatingLayer, onNoteSetsInitialized)
thisObject.profileBalls = newProfileBalls();
thisObject.profileBalls.initialize(thisObject.floatingLayer, onProfileBallsInitialized);
function onNoteSetsInitialized (err) {
function onProfileBallsInitialized(err) {
thisObject.noteSets = newNoteSets();
thisObject.noteSets.initialize(thisObject.floatingLayer, onNoteSetsInitialized);
function onNoteSetsInitialized(err) {
}
}
}
}
}
}
}
+80 -93
View File
@@ -1,114 +1,104 @@
/*
/*
The Panel Space y the place wehre all panels live, no matter who create them.
The Panel Space y the place wehre all panels live, no matter who create them.
*/
function newPanelsSpace() {
function newPanelsSpace () {
var thisObject = {
container: undefined,
createNewPanel: createNewPanel,
destroyPanel: destroyPanel,
getPanel: getPanel,
draw: draw,
panels: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
}
var thisObject = {
container: undefined,
createNewPanel: createNewPanel,
destroyPanel: destroyPanel,
getPanel: getPanel,
draw: draw,
panels: [],
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
thisObject.container.isDraggeable = false
var container = newContainer();
container.initialize();
thisObject.container = container;
thisObject.container.isDraggeable = false;
container.displacement.containerName = 'Panels Space'
container.frame.containerName = 'Panels Space'
container.displacement.containerName = "Panels Space";
container.frame.containerName = "Panels Space";
return thisObject
return thisObject;
function initialize() {
function initialize () {
/* The space does not create any Panels for itself, it just sits and waits others need panels. */
}
}
function createNewPanel(pType, pParameters) {
function createNewPanel (pType, pParameters) {
let panel
let panel;
switch (pType) {
switch (pType) {
case "Time Control Panel":
{
panel = newTimeControlPanel();
panel.initialize();
break;
}
case "Products Panel":
{
panel = newProductsPanel();
panel.initialize();
break;
}
case "Plotter Panel":
{
panel = getNewPlotterPanel(pParameters.devTeam, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelCodeName);
panel.initialize();
break;
}
case 'Time Control Panel':
{
panel = newTimeControlPanel()
panel.initialize()
break
}
thisObject.panels.push(panel);
panel.handle = Math.floor((Math.random() * 10000000) + 1);
return panel.handle;
}
function destroyPanel(pPanelHandle) {
for (let i = 0; i < thisObject.panels.length; i++) {
let panel = thisObject.panels[i];
if (panel.handle === pPanelHandle) {
thisObject.panels.splice(i, 1); // Delete item from array.
return;
}
case 'Products Panel':
{
panel = newProductsPanel()
panel.initialize()
break
}
case 'Plotter Panel':
{
panel = getNewPlotterPanel(pParameters.devTeam, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelCodeName)
panel.initialize()
break
}
}
function getPanel(pPanelHandle) {
thisObject.panels.push(panel)
for (let i = 0; i < thisObject.panels.length; i++) {
panel.handle = Math.floor((Math.random() * 10000000) + 1)
let panel = thisObject.panels[i];
return panel.handle
}
if (panel.handle === pPanelHandle) {
return panel;
}
}
function destroyPanel (pPanelHandle) {
for (let i = 0; i < thisObject.panels.length; i++) {
let panel = thisObject.panels[i]
if (panel.handle === pPanelHandle) {
thisObject.panels.splice(i, 1) // Delete item from array.
return
}
}
}
function draw() {
function getPanel (pPanelHandle) {
for (let i = 0; i < thisObject.panels.length; i++) {
let panel = thisObject.panels[i]
thisObject.container.frame.draw(false, false);
if (panel.handle === pPanelHandle) {
return panel
}
}
}
function draw () {
thisObject.container.frame.draw(false, false)
/* When we draw a time machine, that means also to draw all the charts in it. */
for (var i = 0; i < thisObject.panels.length; i++) {
let panel = thisObject.panels[i];
panel.draw();
}
for (var i = 0; i < thisObject.panels.length; i++) {
let panel = thisObject.panels[i]
panel.draw()
}
}
function getContainer(point) {
let container;
function getContainer (point) {
let container
/*
@@ -117,21 +107,18 @@ function newPanelsSpace() {
*/
for (var i = thisObject.panels.length - 1; i >= 0; i--) {
container = thisObject.panels[i].getContainer(point);
if (container !== undefined) {
for (var i = thisObject.panels.length - 1; i >= 0; i--) {
container = thisObject.panels[i].getContainer(point)
if (container !== undefined) {
/* We found an inner container which has the point. We return it. */
return container;
}
}
return container
}
}
/* The point does not belong to any inner container, so we return the current container. */
return thisObject.container;
}
}
return thisObject.container
}
}
+90 -102
View File
@@ -1,132 +1,120 @@
function newTopSpace() {

function newTopSpace () {
var thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
companyLogo: undefined,
endUser: undefined,
devTeam: undefined,
currentBot: undefined,
currentProcess: undefined,
currentStartMode: undefined,
login: undefined,
initialize: initialize
}
var thisObject = {
container: undefined,
draw: draw,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
companyLogo: undefined,
endUser: undefined,
devTeam: undefined,
currentBot: undefined,
currentProcess: undefined,
currentStartMode: undefined,
login: undefined,
initialize: initialize
};
var container = newContainer()
container.initialize()
thisObject.container = container
var container = newContainer();
container.initialize();
thisObject.container = container;
resize()
resize();
container.isDraggeable = false
container.isDraggeable = false;
return thisObject
return thisObject;
function initialize() {
let sharedStatus = {
currentDevTeamIndex: 0,
currentUserBotIndex: 0,
currentProcessIndex: 0,
currentBotType: "",
eventHandler: newEventHandler()
};
thisObject.login = newLogin();
thisObject.login.initialize(onLoginInitialized);
thisObject.companyLogo = newCompanyLogo();
thisObject.endUser = newEndUser();
thisObject.currentBot = newCurrentBot();
thisObject.currentProcess = newCurrentProcess();
thisObject.currentStartMode = newCurrentStartMode();
thisObject.devTeam = newDevTeam();
window.canvasApp.eventHandler.listenToEvent("Browser Resized", resize);
function onLoginInitialized() {
thisObject.companyLogo.initialize();
thisObject.endUser.initialize();
thisObject.currentBot.initialize(sharedStatus);
thisObject.currentProcess.initialize(sharedStatus);
thisObject.currentStartMode.initialize(sharedStatus);
thisObject.devTeam.initialize(sharedStatus);
}
function initialize () {
let sharedStatus = {
currentDevTeamIndex: 0,
currentUserBotIndex: 0,
currentProcessIndex: 0,
currentBotType: '',
eventHandler: newEventHandler()
}
function resize() {
thisObject.login = newLogin()
thisObject.login.initialize(onLoginInitialized)
thisObject.container.frame.width = browserCanvas.width;
thisObject.container.frame.height = TOP_SPACE_HEIGHT;
thisObject.companyLogo = newCompanyLogo()
thisObject.endUser = newEndUser()
thisObject.currentBot = newCurrentBot()
thisObject.currentProcess = newCurrentProcess()
thisObject.currentStartMode = newCurrentStartMode()
thisObject.devTeam = newDevTeam()
container.frame.position.x = 0;
container.frame.position.y = viewPort.visibleArea.bottomLeft.y;
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
function onLoginInitialized () {
thisObject.companyLogo.initialize()
thisObject.endUser.initialize()
thisObject.currentBot.initialize(sharedStatus)
thisObject.currentProcess.initialize(sharedStatus)
thisObject.currentStartMode.initialize(sharedStatus)
thisObject.devTeam.initialize(sharedStatus)
}
}
function getContainer(point) {
function resize () {
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = TOP_SPACE_HEIGHT
let container;
container.frame.position.x = 0
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
}
container = thisObject.companyLogo.getContainer(point);
if (container !== undefined) { return container; }
function getContainer (point) {
let container
container = thisObject.endUser.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.companyLogo.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.devTeam.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.endUser.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentBot.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.devTeam.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentProcess.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.currentBot.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.currentStartMode.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.currentProcess.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.login.getContainer(point);
if (container !== undefined) { return container; }
container = thisObject.currentStartMode.getContainer(point)
if (container !== undefined) { return container }
container = thisObject.login.getContainer(point)
if (container !== undefined) { return container }
/* The point does not belong to any inner container, so we return the current container. */
return thisObject.container;
return thisObject.container
}
}
function draw () {
thisObject.container.frame.draw(false, false)
function draw() {
drawBackground()
thisObject.companyLogo.draw()
thisObject.endUser.draw()
thisObject.devTeam.draw()
thisObject.currentBot.draw()
thisObject.currentProcess.draw()
thisObject.currentStartMode.draw()
thisObject.login.draw()
}
thisObject.container.frame.draw(false, false);
function drawBackground () {
let opacity = 1
drawBackground();
thisObject.companyLogo.draw();
thisObject.endUser.draw();
thisObject.devTeam.draw();
thisObject.currentBot.draw();
thisObject.currentProcess.draw();
thisObject.currentStartMode.draw();
thisObject.login.draw();
browserCanvasContext.beginPath()
}
browserCanvasContext.rect(0, 0, thisObject.container.frame.width, thisObject.container.frame.height)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')'
function drawBackground() {
browserCanvasContext.closePath()
let opacity = 1;
browserCanvasContext.beginPath();
browserCanvasContext.rect(0, 0, thisObject.container.frame.width, thisObject.container.frame.height);
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')';
browserCanvasContext.closePath();
browserCanvasContext.fill();
}
}
browserCanvasContext.fill()
}
}