diff --git a/.vs/AAWeb/v15/.suo b/.vs/AAWeb/v15/.suo
index 9b74c487a..cf5017af6 100644
Binary files a/.vs/AAWeb/v15/.suo and b/.vs/AAWeb/v15/.suo differ
diff --git a/ImageButton.js b/ImageButton.js
new file mode 100644
index 000000000..53f121454
--- /dev/null
+++ b/ImageButton.js
@@ -0,0 +1,128 @@
+function newImageButton() {
+
+ var thisObject = {
+ container: undefined,
+ draw: draw,
+ status: 'neutral',
+ type: undefined,
+ getContainer: getContainer,
+ initialize: initialize
+ };
+
+ var container = newContainer();
+ container.initialize();
+ container.isDraggeable = false;
+ container.isZoomeable = false;
+ container.isClickeable = true;
+ thisObject.container = container;
+
+ let idNeutralImage;
+ let idOnImage;
+ let idOffImage;
+ let idDisabledImage;
+
+ return thisObject;
+
+ function initialize(pX, pY, pWidth, pHeight, pIdNeutralImage, pIdOnImage, pIdOffImage, pIdDisabledImage) {
+
+ idNeutralImage = pIdNeutralImage;
+ idOnImage = pIdOnImage;
+ idOffImage = pIdOffImage;
+ idDisabledImage = pIdDisabledImage;
+
+ /* Lets set the basic dimensions of this thisObject. */
+
+ var position = {
+ x: pX,
+ y: pY
+ };
+
+ thisObject.container.frame.position = position;
+ thisObject.container.frame.width = pWidth;
+ thisObject.container.frame.height = pHeight;
+
+ /* Now we start listening to the onClick event from the mouse, so that we can allow users operate this thisObject. */
+
+ thisObject.container.eventHandler.listenToEvent('onMouseClick', buttonPressed, undefined);
+
+ }
+
+ function getContainer(point) {
+
+ var container;
+
+ /* First we check if this point is inside this space. */
+
+ if (this.container.frame.isThisPointHere(point, true) === true) {
+
+ return this.container;
+
+ } else {
+
+ /* This point does not belong to this space. */
+
+ return undefined;
+ }
+
+ }
+
+ function buttonPressed(event, extraData) {
+
+ switch (thisObject.status) {
+
+ case 'neutral':
+ browserCanvasContext.fillStyle = onFillStyle;
+ return;
+
+ case 'on':
+ thisObject.status = 'off';
+ break;
+
+ case 'off':
+ thisObject.status = 'on';
+ break;
+
+ case 'disabled':
+ return;
+ }
+ }
+
+ function draw() {
+
+ drawImage();
+
+ }
+
+ function drawImage() {
+
+ let image;
+
+ let imagePoint = {
+ x: 0,
+ y: 0
+ };
+
+ imagePoint = thisObject.container.frame.frameThisPoint(imagePoint);
+
+ switch (thisObject.status) {
+
+ case 'neutral':
+ image = document.getElementById(idNeutralImage);
+ break;
+
+ case 'on':
+ image = document.getElementById(idOnImage);
+ break;
+
+ case 'off':
+ image = document.getElementById(idOffImage);
+ break;
+
+ case 'disabled':
+ image = document.getElementById(idDisabledImage);
+ break;
+
+ }
+ browserCanvasContext.drawImage(image, imagePoint.x, imagePoint.y, thisObject.container.frame.width, thisObject.container.frame.height);
+ }
+}
\ No newline at end of file
diff --git a/Plotters.js b/Plotter.js
similarity index 69%
rename from Plotters.js
rename to Plotter.js
index a481a565a..b1d992d56 100644
--- a/Plotters.js
+++ b/Plotter.js
@@ -1,9 +1,9 @@
-function getNewPlotter(pDevTeamOrHost, pRepo, pModule) {
+function getNewPlotter(pDevTeamOrHost, pPlotter, pModule) {
let plotter;
- let fullCode = pDevTeamOrHost + pRepo + pModule;
+ let fullCode = pDevTeamOrHost + pPlotter + pModule;
fullCode = fullCode.replace(/-/g, "");
switch (fullCode) {
diff --git a/PlotterPanel.js b/PlotterPanel.js
new file mode 100644
index 000000000..78c9fb92a
--- /dev/null
+++ b/PlotterPanel.js
@@ -0,0 +1,19 @@
+
+function getNewPlotterPanel(pDevTeamOrHost, pPlotter, pModule, pPanel) {
+
+ let plotterPanel;
+ let fullCode = pDevTeamOrHost + pPlotter + pModule + pPanel;
+ fullCode = fullCode.replace(/-/g, "");
+
+ switch (fullCode) {
+
+// Cases
+
+ default:
+ {
+ throw ("getNewPlotterPanel: " + fullCode + " not found.")
+ }
+ }
+
+ return plotterPanel;
+}
diff --git a/Project.njsproj b/Project.njsproj
index 3868188aa..78ae6fc7c 100644
--- a/Project.njsproj
+++ b/Project.njsproj
@@ -38,6 +38,12 @@
Code
+
+ Code
+
+
+ Code
+
Code
@@ -68,7 +74,7 @@
Code
-
+
Code
diff --git a/index.html b/index.html
index b1baf360a..798f66039 100644
--- a/index.html
+++ b/index.html
@@ -4,9 +4,16 @@
Advanced Algos
+
-
+
+
+
+
+
+
+
@@ -21,6 +28,7 @@
+
diff --git a/server.js b/server.js
index 312d44aca..1b4f9ade0 100644
--- a/server.js
+++ b/server.js
@@ -542,7 +542,7 @@ function onBrowserRequest(request, response) {
}
break;
- case "Plotters.js":
+ case "Plotter.js":
{
/*
@@ -554,7 +554,7 @@ function onBrowserRequest(request, response) {
let fs = require('fs');
try {
- let fileName = 'Plotters.js';
+ let fileName = 'Plotter.js';
fs.readFile(fileName, onFileRead);
function onFileRead(err, file) {
@@ -626,6 +626,95 @@ function onBrowserRequest(request, response) {
}
break;
+ case "PlotterPanel.js":
+ {
+ /*
+
+ This file is build dinamically because it has the code to instantiate the different configured Plotter Panels. The instantiation code
+ will be generated using a pre-defined string with replacement points. We will go through the configuration file to learn
+ about all the possible plotters panels the system can load.
+
+ */
+
+ let fs = require('fs');
+ try {
+ let fileName = 'PlotterPanel.js';
+ fs.readFile(fileName, onFileRead);
+
+ function onFileRead(err, file) {
+
+ try {
+
+ let fileContent = file.toString();
+
+ /* This is the string we will use to insert into the Plotters.js script. */
+
+ let caseString = '' +
+ ' case "@newFunctionName@":' + '\n' +
+ ' {' + '\n' +
+ ' plotterPanel = newPlotterPanelName();' + '\n' +
+ ' }' + '\n' +
+ ' break;' + '\n' + '\n'
+
+ let devTeams = ecosystemObject.devTeams;
+ let hosts = ecosystemObject.hosts;
+
+ addToFileContent(devTeams);
+ addToFileContent(hosts);
+
+ function addToFileContent(pDevTeamsOrHosts) {
+
+ for (let i = 0; i < pDevTeamsOrHosts.length; i++) {
+
+ let devTeam = pDevTeamsOrHosts[i];
+
+ for (let j = 0; j < devTeam.plotters.length; j++) {
+
+ let plotter = devTeam.plotters[j];
+
+ for (let k = 0; k < plotter.modules.length; k++) {
+
+ let module = plotter.modules[k];
+
+ for (let l = 0; l < module.panels.length; l++) {
+
+ let panel = module.panels[l];
+
+ let caseStringCopy = caseString;
+
+ let newFunctionName = devTeam.codeName + plotter.codeName + module.codeName + panel.codeName;
+ newFunctionName = newFunctionName.replace(/-/g, "");
+
+ let stringToInsert;
+ stringToInsert = caseStringCopy.replace('@newFunctionName@', newFunctionName);
+ stringToInsert = stringToInsert.replace('newPlotterPanelName', 'new' + newFunctionName);
+
+ let firstPart = fileContent.substring(0, fileContent.indexOf('// Cases'));
+ let secondPart = fileContent.substring(fileContent.indexOf('// Cases'));
+
+ fileContent = firstPart + stringToInsert + secondPart;
+ }
+ }
+ }
+ }
+ }
+
+ respondWithContent(fileContent, response);
+
+ }
+ catch (err) {
+ console.log("File Not Found: " + fileName + " or Error = " + err);
+ }
+
+ }
+ }
+ catch (err) {
+ console.log(err);
+ }
+
+ }
+ break;
+
case "Ecosystem.js":
{
/*
@@ -685,6 +774,25 @@ function onBrowserRequest(request, response) {
}
break;
+ case "PlotterPanels": // This means the PlotterPanels folder, not to be confused with the Plotter Panels scripts!
+ {
+
+ if (DEBUG_MODE === true) {
+
+ respondWithFile('../Plotters/' + requestParameters[2] + '/' + requestParameters[3] + '/' + requestParameters[4], response);
+
+ } else {
+
+ getGithubData(requestParameters[2], requestParameters[3], requestParameters[4], onDataArrived)
+
+ function onDataArrived(pData) {
+
+ respondWithContent(pData, response);
+
+ }
+ }
+ }
+ break;
case "Panels":
{
respondWithFile('./' + requestParameters[1] + '/' + requestParameters[2], response);
@@ -724,9 +832,12 @@ function onBrowserRequest(request, response) {
function addPlotters() {
- let htmlLine = '' + '\n' +
+ let htmlLinePlotter = '' + '\n' +
' '
+ let htmlLinePlotterPanel = '' + '\n' +
+ ' '
+
let devTeams = ecosystemObject.devTeams;
let hosts = ecosystemObject.hosts;
@@ -747,7 +858,7 @@ function onBrowserRequest(request, response) {
let module = plotter.modules[k];
- let htmlLineCopy = htmlLine;
+ let htmlLineCopy = htmlLinePlotter;
let stringToInsert;
stringToInsert = htmlLineCopy.replace('@devTeam@', devTeam.codeName);
@@ -759,6 +870,22 @@ function onBrowserRequest(request, response) {
fileContent = firstPart + stringToInsert + secondPart;
+ for (let l = 0; l < module.panels.length; l++) {
+
+ let panel = module.panels[l];
+
+ let htmlLineCopy = htmlLinePlotterPanel;
+
+ let stringToInsert;
+ stringToInsert = htmlLineCopy.replace('@devTeam@', devTeam.codeName);
+ stringToInsert = stringToInsert.replace('@repo@', plotter.repo);
+ stringToInsert = stringToInsert.replace('@module@', panel.moduleName);
+
+ let firstPart = fileContent.substring(0, fileContent.indexOf('') + 20);
+ let secondPart = fileContent.substring(fileContent.indexOf('') + 20);
+
+ fileContent = firstPart + stringToInsert + secondPart;
+ }
}
}
}