Skip to content

Commit

Permalink
move getControllers() to WidgetFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmartin authored and tarelli committed Mar 27, 2015
1 parent b2a780b commit b711bdc
Show file tree
Hide file tree
Showing 5 changed files with 464 additions and 462 deletions.
59 changes: 0 additions & 59 deletions src/main/webapp/js/GEPPETTO.Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ define(function(require) {
var $ = require('jquery'),
React = require('react'),
InfoModal = require('jsx!components/popups/InfoModal');
PlotsController = require('widgets/plot/controllers/PlotsController');
Scatter3dController = require('widgets/scatter3d/controllers/Scatter3dController');
ConnectivityController = require('widgets/connectivity/controllers/ConnectivityController');
PopupsController = require('widgets/popup/controllers/PopupController');
TreeVisualiserControllerD3 = require('widgets/treevisualiser/treevisualiserd3/controllers/TreeVisualiserControllerD3');
TreeVisualiserControllerDAT = require('widgets/treevisualiser/treevisualiserdat/controllers/TreeVisualiserControllerDAT');
VariableVisualizerController = require('widgets/variablevisualiser/controllers/VariableVisualiserController');


/**
* @class GEPPETTO.Main
Expand All @@ -68,13 +60,6 @@ define(function(require) {
disconnected: false,
status: 0,
simulationFileTemplate: "assets/resources/template.xml",
plotsController : null,
popupsController : null,
connectivityController : null,
scatter3dController : null,
variableVisController : null,
treeVisDatController : null,
treeVis3DController : null,

getVisitorStatus: function() {
return this.status;
Expand Down Expand Up @@ -156,50 +141,6 @@ define(function(require) {

//update the UI based on success of webgl
GEPPETTO.FE.update(webGLStarted);
},

getController : function(type){
if(type == GEPPETTO.Widgets.PLOT){
if(GEPPETTO.Main.plotsController == null || undefined){
GEPPETTO.Main.plotsController = new PlotsController();
}
return GEPPETTO.Main.plotsController;
}
else if(type == GEPPETTO.Widgets.SCATTER3D){
if(GEPPETTO.Main.scatter3dController == null || undefined){
GEPPETTO.Main.scatter3dController = new Scatter3dController();
}
return GEPPETTO.Main.scatter3dController;
}
else if(type == GEPPETTO.Widgets.POPUP){
if(GEPPETTO.Main.popupsController == null || undefined){
GEPPETTO.Main.popupsController = new PopupsController();
}
return GEPPETTO.Main.popupsController;
}
else if(type == GEPPETTO.Widgets.TREEVISUALISERDAT){
if(GEPPETTO.Main.treeVisDatController == null || undefined){
GEPPETTO.Main.treeVisDatController = new TreeVisualiserControllerDAT();
}
return GEPPETTO.Main.treeVisDatController;
}else if(type == GEPPETTO.Widgets.TREEVISUALISERD3){
if(GEPPETTO.Main.treeVis3DController == null || undefined){
GEPPETTO.Main.treeVis3DController = new TreeVisualiserControllerD3();
}
return GEPPETTO.Main.treeVis3DController;
}
else if(type == GEPPETTO.Widgets.VARIABLEVISUALISER){
if(GEPPETTO.Main.variableVisController == null || undefined){
GEPPETTO.Main.variableVisController = new VariableVisualizerController();
}
return GEPPETTO.Main.variableVisController;
}else if(type == GEPPETTO.Widgets.CONNECTIVITY){
if(GEPPETTO.Main.connectivityController == null || undefined){
GEPPETTO.Main.connectivityController = new ConnectivityController();
}
return GEPPETTO.Main.connectivityController;
}

}
};

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/js/GEPPETTO.Vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ define(function(require) {
*/
checkKeyboard: function() {
if(GEPPETTO.isKeyPressed("ctrl+alt+p")) {
GEPPETTO.Main.getController(GEPPETTO.Widgets.PLOT).toggle();
GEPPETTO.WidgetFactory.getController(GEPPETTO.Widgets.PLOT).toggle();
}

else if(GEPPETTO.isKeyPressed("ctrl+alt+j")) {
GEPPETTO.Console.toggleConsole();
}

else if(GEPPETTO.isKeyPressed("ctrl+alt+s")) {
GEPPETTO.Main.getController(GEPPETTO.Widgets.SCATTER3D).toggle();
GEPPETTO.WidgetFactory.getController(GEPPETTO.Widgets.SCATTER3D).toggle();
}
},

Expand Down
Loading

0 comments on commit b711bdc

Please sign in to comment.