diff --git a/.vs/AAWebPlatform/v15/.suo b/.vs/AAWebPlatform/v15/.suo index be46c6602..9d5e7f592 100644 Binary files a/.vs/AAWebPlatform/v15/.suo and b/.vs/AAWebPlatform/v15/.suo differ diff --git a/ChartLayers/AccumulatedVolumeChartLayer.js b/ChartLayers/AccumulatedVolumeChartLayer.js index 4f8403cf5..21817ed52 100644 --- a/ChartLayers/AccumulatedVolumeChartLayer.js +++ b/ChartLayers/AccumulatedVolumeChartLayer.js @@ -58,8 +58,8 @@ function newAccumulatedVolumeChartLayer() { viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.BUY_SELL_BALANCE); - parentLayerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.VOLUME); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.BUY_SELL_BALANCE); + parentLayerStatus = botsPanel.getProductStatus(botsPanel.layerNames.VOLUME); } diff --git a/ChartLayers/AllTimeChartlayer.js b/ChartLayers/AllTimeChartlayer.js index fd4f51e22..66240eed2 100644 --- a/ChartLayers/AllTimeChartlayer.js +++ b/ChartLayers/AllTimeChartlayer.js @@ -74,7 +74,7 @@ function newAllTimeChartLayer() { } - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.ATH); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.ATH); } diff --git a/ChartLayers/CandeStickChartLayer.js b/ChartLayers/CandeStickChartLayer.js index 1596602b6..05dd407bb 100644 --- a/ChartLayers/CandeStickChartLayer.js +++ b/ChartLayers/CandeStickChartLayer.js @@ -61,7 +61,7 @@ function newCandleStickChartLayer() { viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.CANDLESTICKS); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.CANDLESTICKS); } diff --git a/ChartLayers/CandleTechnicalAnalisysChartLayer.js b/ChartLayers/CandleTechnicalAnalisysChartLayer.js index 25700bd2c..a4d50faa9 100644 --- a/ChartLayers/CandleTechnicalAnalisysChartLayer.js +++ b/ChartLayers/CandleTechnicalAnalisysChartLayer.js @@ -51,8 +51,8 @@ function newCandleTechnicalAnalisysChartLayer() { recalculateScale(); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.CANDLE_STAIRS); - parentLayerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.CANDLESTICKS); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.CANDLE_STAIRS); + parentLayerStatus = botsPanel.getProductStatus(botsPanel.layerNames.CANDLESTICKS); } diff --git a/ChartLayers/ForecastChartLayer.js b/ChartLayers/ForecastChartLayer.js index 8e2434afd..d45281bd5 100644 --- a/ChartLayers/ForecastChartLayer.js +++ b/ChartLayers/ForecastChartLayer.js @@ -54,8 +54,8 @@ function newForecastChartLayer() { viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.FORECAST); - parentLayerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.CANDLESTICKS); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.FORECAST); + parentLayerStatus = botsPanel.getProductStatus(botsPanel.layerNames.CANDLESTICKS); } diff --git a/ChartLayers/HighLowChartLayer.js b/ChartLayers/HighLowChartLayer.js index 3cc3991de..5105d065d 100644 --- a/ChartLayers/HighLowChartLayer.js +++ b/ChartLayers/HighLowChartLayer.js @@ -51,8 +51,8 @@ function newHighLowChartLayer() { recalculateScale(); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.HIGH_LOWS); - parentLayerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.CANDLESTICKS); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.HIGH_LOWS); + parentLayerStatus = botsPanel.getProductStatus(botsPanel.layerNames.CANDLESTICKS); } diff --git a/ChartLayers/LinearRegressionCurve.js b/ChartLayers/LinearRegressionCurve.js index a04d20f60..57f93e94c 100644 --- a/ChartLayers/LinearRegressionCurve.js +++ b/ChartLayers/LinearRegressionCurve.js @@ -49,7 +49,7 @@ function newLinearRegressionCurve() { recalculateScale(); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.LINEAR_REGRESION_CURVE); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.LINEAR_REGRESION_CURVE); } function getContainer(point) { diff --git a/ChartLayers/OrderBooksChartLayer.js b/ChartLayers/OrderBooksChartLayer.js index d6155bbfe..062b7b0f9 100644 --- a/ChartLayers/OrderBooksChartLayer.js +++ b/ChartLayers/OrderBooksChartLayer.js @@ -68,7 +68,7 @@ function newOrderBooksChartLayer() { canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); canvas.eventHandler.listenToEvent("Dragging", onDragging); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.ORDER_BOOKS); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.ORDER_BOOKS); } diff --git a/ChartLayers/SupportResistanceChartLayer.js b/ChartLayers/SupportResistanceChartLayer.js index 5715f3ffa..0c5e07703 100644 --- a/ChartLayers/SupportResistanceChartLayer.js +++ b/ChartLayers/SupportResistanceChartLayer.js @@ -47,7 +47,7 @@ function newSupportResistanceChartLayer() { recalculateScale(); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.CANDLESTICKS); // TODO : Put the right layer name here when it exists. + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.CANDLESTICKS); // TODO : Put the right layer name here when it exists. } diff --git a/ChartLayers/VolumeChartLayer.js b/ChartLayers/VolumeChartLayer.js index 8906f4f58..bee20648a 100644 --- a/ChartLayers/VolumeChartLayer.js +++ b/ChartLayers/VolumeChartLayer.js @@ -56,7 +56,7 @@ function newVolumeChartLayer() { viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.VOLUME); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.VOLUME); } diff --git a/ChartLayers/VolumeTechnicalAnalisysChartLayer.js b/ChartLayers/VolumeTechnicalAnalisysChartLayer.js index bd21c4890..7ff82b447 100644 --- a/ChartLayers/VolumeTechnicalAnalisysChartLayer.js +++ b/ChartLayers/VolumeTechnicalAnalisysChartLayer.js @@ -50,8 +50,8 @@ function newVolumeTechnicalAnalisysChartLayer() { marketIndex = index; dailyFilesCursor = dailyFiles; - layerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.VOLUME_STAIRS); - parentLayerStatus = botsPanel.getLayerStatus(botsPanel.layerNames.VOLUME); + layerStatus = botsPanel.getProductStatus(botsPanel.layerNames.VOLUME_STAIRS); + parentLayerStatus = botsPanel.getProductStatus(botsPanel.layerNames.VOLUME); } diff --git a/Ecosystem.js b/Ecosystem.js index ee488e027..06989c457 100644 --- a/Ecosystem.js +++ b/Ecosystem.js @@ -6,8 +6,6 @@ function newEcosystem() { getTeams: getTeams, getBot: getBot, getProduct: getProduct, - getLayer: getLayer, - getLayers: getLayers, getExchange: getExchange, initialize: initialize } @@ -62,17 +60,6 @@ function newEcosystem() { } } - function getLayer(pProduct, pLayerCodeName) { - - for (let i = 0; i < pProduct.layers.length; i++) { - - if (pProduct.layers[i].codeName === pLayerCodeName) { - - return pProduct.layers[i]; - } - } - } - function getExchange(pProduct, pName) { for (let i = 0; i < pProduct.exchangeList.exchange.length; i++) { @@ -83,34 +70,5 @@ function newEcosystem() { } } } - - function getLayers() { - - let allLayers = []; - - for (let i = 0; i < ECOSYSTEM.devTeams.length; i++) { - - let devTeam = ecosystem.devTeams[i]; - - for (let j = 0; j < devTeam.bots.length; j++) { - - let bot = devTeam.bots[j]; - - for (let k = 0; k < bot.products.length; k++) { - - let product = bot.products[k]; - - for (let l = 0; l < product.layers.length; l++) { - - let layer = product.layers[l]; - - allLayers.push(layer); - } - } - } - } - - return allLayers; - } } diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 10d549279..d5e99607f 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -10,8 +10,8 @@ function newProductsPanel() { var thisObject = { container: undefined, - gerOnProducts: gerOnProducts, - getLayerStatus: getLayerStatus, + getOnProducts: getOnProducts, + getProductStatus: getProductStatus, draw: draw, getContainer: getContainer, // returns the inner most container that holds the point received by parameter. initialize: initialize @@ -27,8 +27,6 @@ function newProductsPanel() { let isInitialized = false; let products; - let layers = []; - return thisObject; function initialize() { @@ -43,7 +41,11 @@ function newProductsPanel() { this.container.frame.position = position; - /* First thing is to build the layers array */ + /* Needed Variables */ + + var lastY = 5; + + /* First thing is to build the products array */ let devTeams = ecosystem.getTeams(); @@ -59,89 +61,69 @@ function newProductsPanel() { let product = bot.products[k]; - for (let l = 0; l < product.layers.length; l++) { + /* Now we create Product objects */ - let layer = product.layers[l]; + var product = newProduct(); - let panelLayer = { - devTeam: devTeam, - bot: bot, - product: product, - layer: layer - }; + product.devTeam = devTeam; + product.bot = bot; + product.product = product; + + product.code = devTeam.codeName + '-' + bot.codeName + '-' + product.codeName; + + /* Container Stuff */ + + product.container.displacement.parentDisplacement = this.container.displacement; + product.container.zoom.parentZoom = this.container.zoom; + product.container.frame.parentFrame = this.container.frame; + product.container.parentContainer = this.container; + + /* Initialize it */ + + product.initialize(); + + /* Positioning within this Panel */ + + let position = { + x: 10, + y: thisObject.container.frame.height - thisObject.container.frame.getBodyHeight() + }; + product.container.frame.position.x = position.x; + product.container.frame.position.y = position.y + lastY; + + lastY = lastY + product.container.frame.height; + + /* We start listening to the products click event, so as to know when one was pressed. */ + + product.container.eventHandler.listenToEvent('onMouseClick', buttonPressed, i); + + /* We retrieve the locally stored status of the Product */ + + let storedValue = window.localStorage.getItem(product.code); + + if (storedValue !== null) { + + product.status = storedValue; + + } else { + + product.status = PRODUCT_STATUS.ON; - layers.push(panelLayer); } + + /* Add to the Product Array */ + + products.push(product); + } } } - var cardPosition; - - var lastY = 5; - products = []; - - for (var i = 0; i < layers.length; i++) { - - let fullCodeName = layers[i].devTeam.codeName + '-' + layers[i].bot.codeName + '-' + layers[i].product.codeName + '-' + layers[i].layer.codeName; - - /* Products are going to be one at the right of the other. */ - - var card = newProduct(); - card.devTeam = layers[i].devTeam.displayName; - card.bot = layers[i].bot.displayName; - card.product = layers[i].product.displayName; - card.layer = layers[i].layer.displayName; - card.code = fullCodeName; - - card.container.displacement.parentDisplacement = this.container.displacement; - card.container.zoom.parentZoom = this.container.zoom; - card.container.frame.parentFrame = this.container.frame; - - card.container.parentContainer = this.container; - - card.initialize(); - - cardPosition = { // The first card - x: 10, - y: thisObject.container.frame.height - thisObject.container.frame.getBodyHeight() - }; - card.container.frame.position.x = cardPosition.x; - card.container.frame.position.y = cardPosition.y + lastY; - - lastY = lastY + card.container.frame.height; - - /* We start listening to the products click event, so as to know when one was pressed. */ - - card.container.eventHandler.listenToEvent('onMouseClick', buttonPressed, i); - - let storedValue = window.localStorage.getItem(card.code); - - if (storedValue !== null) { - - card.status = storedValue; - - } else { - - card.status = PRODUCT_STATUS.ON; - - } - - products.push(card); - - let eventData = { - layer: card.code, - status: card.status - } - - thisObject.container.eventHandler.raiseEvent('Layer Status Changed', eventData); - } - isInitialized = true; } - function gerOnProducts() { + function getOnProducts() { /* Returns all products which status is ON */ @@ -158,14 +140,13 @@ function newProductsPanel() { return onProducts; } - - function getLayerStatus(layerName) { + function getProductStatus(pProductCode) { for (let i = 0; i < products.length; i++) { let button = products[i]; - if (button.code === layerName) { + if (button.code === pProductCode) { return button.status; @@ -226,13 +207,12 @@ function newProductsPanel() { } - let eventData = { - layer: products[index].code, + productCode: products[index].code, status: products[index].status } - thisObject.container.eventHandler.raiseEvent('Layer Status Changed', eventData); + thisObject.container.eventHandler.raiseEvent('Product Status Changed', eventData); window.localStorage.setItem(products[index].code, products[index].status); @@ -244,7 +224,7 @@ function newProductsPanel() { thisObject.container.frame.draw(false, false, true); - for (var i = 0; i < products.length; i++) { + for (let i = 0; i < products.length; i++) { products[i].draw(); } diff --git a/Product.js b/Product.js index 2aaec1b73..d18523d46 100644 --- a/Product.js +++ b/Product.js @@ -35,9 +35,6 @@ this.container.frame.width = 280; this.container.frame.height = 28; - /* Now we start listening to the onClick event from the mouse, so that we can allow users operate this thisObject. */ - - } function getContainer(point) { diff --git a/TimelineChart.js b/TimelineChart.js index a8e1c942c..3b80757eb 100644 --- a/TimelineChart.js +++ b/TimelineChart.js @@ -100,13 +100,13 @@ function newTimelineChart() { /* Lets get all the cards that are turned on. */ - let onCards = botsPanel.gerOnCards(); + let onProducts = botsPanel.getOnProducts(); - for (let i = 0; i < onCards.length; i++) { + for (let i = 0; i < onProducts.length; i++) { /* For each one, we will initialize the associated plotter. */ - let onCard = onCards[i]; + let onCard = onProducts[i]; let plotter = getNewPlotter(onCard.plotter.devTeam, onCard.plotter.repo, onCard.plotter.moduleName);