From 25d885879fc5991a7494044d9e2bf4e553b4bd3a Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 25 Sep 2015 13:29:51 -0400 Subject: [PATCH] application types --- js/API/LatticeAPI.js | 6 +++--- js/cells/supercells/GIKSuperCell.js | 2 +- js/lattice/Lattice.js | 16 ++++++++-------- js/lattice/LatticeBase.js | 2 +- js/menus/MenuWrapperView.js | 2 +- js/menus/Ribbon.js | 2 +- js/menus/templates/ESetupMenuView.html | 2 +- js/menus/templates/LatticeMenuView.html | 12 ++++++------ js/menus/templates/MSetupMenuView.html | 2 +- js/menus/templates/MaterialMenuView.html | 2 +- js/menus/templates/MenuWrapperView.html | 2 +- js/menus/templates/NavViewMenu.html | 2 +- js/menus/templates/PartMenuView.html | 2 +- js/menus/templates/Ribbon.html | 2 +- js/models/AppState.js | 2 +- js/plists/PList.js | 4 ++-- 16 files changed, 31 insertions(+), 31 deletions(-) diff --git a/js/API/LatticeAPI.js b/js/API/LatticeAPI.js index 7bed5afd..fe6248ec 100644 --- a/js/API/LatticeAPI.js +++ b/js/API/LatticeAPI.js @@ -31,7 +31,7 @@ define(['lattice', 'plist'], function(lattice, plist){ }, getApplicationType: function(){ - return lattice.get("latticeType"); + return lattice.get("applicationType"); }, getPartType: function(){ @@ -76,7 +76,7 @@ define(['lattice', 'plist'], function(lattice, plist){ console.warn("no application type " + applicationType + " for cell type " + plistCellData.name + " and connection type " + plistConnectionData.name); return; } - return lattice.set("latticeType", applicationType); + return lattice.set("applicationType", applicationType); }, setPartType: function(partType){ @@ -84,7 +84,7 @@ define(['lattice', 'plist'], function(lattice, plist){ var plistCellData = plist.allLattices[cellType]; var connectionType = lattice.get("connectionType"); var plistConnectionData = plistCellData[connectionType]; - var applicationType = lattice.get("latticeType"); + var applicationType = lattice.get("applicationType"); var plistAppData = plistConnectionData[applicationType]; if (plistConnectionData[applicationType] === undefined){ console.warn("no part type " + partType + " for cell type " + plistCellData.name + " and connection type " + plistConnectionData.name + " and application type " + plistAppData.name); diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index dfda8f28..45705e9f 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -30,7 +30,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', GIKSuperCell.prototype._makeSubCellForIndex = function(json, callback){ json.materialID = this.material.getID(); - if (lattice.get("latticeType") == "dnaBricks"){ + if (lattice.get("applicationType") == "dnaBricks"){ callback(new DNABrickCell(json, this)); return; } diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 02c91353..ccca998d 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -15,7 +15,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis cellType: "cube", connectionType: "gik", - latticeType: "willGik", + applicationType: "willGik", partType: null, aspectRatio: null, @@ -39,8 +39,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis this._connectionTypeChanged(); this.reloadCells(); }); - this.listenTo(this, "change:latticeType", function(){ - this._latticeTypeChanged(); + this.listenTo(this, "change:applicationType", function(){ + this._applicationTypeChanged(); this.reloadCells(); }); this.listenTo(this, "change:aspectRatio", function(){ @@ -52,7 +52,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis this.updateThreeViewTarget(); }); - this._latticeTypeChanged(); + this._applicationTypeChanged(); this.reloadCells(); }, @@ -77,12 +77,12 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis _connectionTypeChanged: function(){ var cellType = this.get("cellType"); var connectionType = this.get("connectionType"); - var latticeType = _.keys(plist.allLattices[cellType].connection[connectionType].type)[0]; - this.set("latticeType", latticeType, {silent:true}); - this._latticeTypeChanged(); + var appType = _.keys(plist.allLattices[cellType].connection[connectionType].type)[0]; + this.set("applicationType", appType, {silent:true}); + this._applicationTypeChanged(); }, - _latticeTypeChanged: function(){ + _applicationTypeChanged: function(){ var latticeData = this._getLatticePlistData(); this.set("aspectRatio", latticeData.aspectRatio.clone(), {silent:true}); diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 91048b29..b3e6938b 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -40,7 +40,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre //lattice type _getLatticePlistData: function(){ - return plist.allLattices[this.get("cellType")].connection[this.get("connectionType")].type[this.get("latticeType")]; + return plist.allLattices[this.get("cellType")].connection[this.get("connectionType")].type[this.get("applicationType")]; }, reloadCells: function(cells, subclass){ diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index 193b720d..2136e931 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -36,7 +36,7 @@ define(['jquery', 'underscore', 'plist', 'backbone', 'lattice', 'appState', 'tex if (this.currentNav == this.model.get("currentNav")) return; this.render(); }); - this.listenTo(lattice, "change:cellType change:connectionType change:latticeType", this._populateAndShow); + this.listenTo(lattice, "change:cellType change:connectionType change:applicationType", this._populateAndShow); this.listenTo(this.model, "change:currentTab", function(){ if (this.currentTab == this.model.get("currentTab")) return; if (!this.model.changedAttributes() || this.model.changedAttributes()["currentNav"]) return; diff --git a/js/menus/Ribbon.js b/js/menus/Ribbon.js index ec73dab5..a9223d00 100644 --- a/js/menus/Ribbon.js +++ b/js/menus/Ribbon.js @@ -25,7 +25,7 @@ define(['jquery', 'underscore', 'backbone', 'plist', 'lattice', 'appState', 'tex this.listenTo(this.model, "change:deleteMode", this.render); this.listenTo(this.model, "change:highlightMode", this.render); this.listenTo(this.model, "change:axesAreVisible", this.render); - this.listenTo(lattice, "change:cellType change:connectionType change:latticeType", this.render); + this.listenTo(lattice, "change:cellType change:connectionType change:applicationType", this.render); this.render(); }, diff --git a/js/menus/templates/ESetupMenuView.html b/js/menus/templates/ESetupMenuView.html index 62abd20c..76f87236 100644 --- a/js/menus/templates/ESetupMenuView.html +++ b/js/menus/templates/ESetupMenuView.html @@ -5,7 +5,7 @@ Simulation Type: <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialClasses[materialClass] %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(allLattices[cellType].connection[connectionType].type[latticeType].materialClasses || _.keys(allMaterialClasses), function(key){ %> + <% _.each(allLattices[cellType].connection[connectionType].type[applicationType].materialClasses || _.keys(allMaterialClasses), function(key){ %> <li><a class="appState dropdownSelector" data-property="materialClass" data-value="<%= key %>" href="#"><%= allMaterialClasses[key] %></a></li> <% }); %> </ul> diff --git a/js/menus/templates/LatticeMenuView.html b/js/menus/templates/LatticeMenuView.html index c57e9d86..c568f159 100644 --- a/js/menus/templates/LatticeMenuView.html +++ b/js/menus/templates/LatticeMenuView.html @@ -18,19 +18,19 @@ Cell Connection: </div><br/><br/> Type: <div class="btn-group"> - <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allLattices[cellType].connection[connectionType].type[latticeType].name %><span class="caret"></span></button> + <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allLattices[cellType].connection[connectionType].type[applicationType].name %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(allLattices[cellType].connection[connectionType].type, function(latticeTypeData, key){ %> - <li><a class="lattice dropdownSelector" data-property="latticeType" data-value="<%= key %>" href="#"><%= latticeTypeData.name %></a></li> + <% _.each(allLattices[cellType].connection[connectionType].type, function(appTypeData, key){ %> + <li><a class="lattice dropdownSelector" data-property="applicationType" data-value="<%= key %>" href="#"><%= appTypeData.name %></a></li> <% }); %> </ul> </div><br/><br/> -<% if(allLattices[cellType].connection[connectionType].type[latticeType].parts){ %> +<% if(allLattices[cellType].connection[connectionType].type[applicationType].parts){ %> Part Type: <div class="btn-group"> - <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allLattices[cellType].connection[connectionType].type[latticeType].parts[partType].name %><span class="caret"></span></button> + <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allLattices[cellType].connection[connectionType].type[applicationType].parts[partType].name %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(allLattices[cellType].connection[connectionType].type[latticeType].parts, function(val, key){ %> + <% _.each(allLattices[cellType].connection[connectionType].type[applicationType].parts, function(val, key){ %> <li><a class="lattice dropdownSelector" data-property="partType" data-value="<%= key %>" href="#"><%= val.name %></a></li> <% }); %> </ul> diff --git a/js/menus/templates/MSetupMenuView.html b/js/menus/templates/MSetupMenuView.html index 8375962c..3d7e19b4 100644 --- a/js/menus/templates/MSetupMenuView.html +++ b/js/menus/templates/MSetupMenuView.html @@ -2,7 +2,7 @@ Simulation Type: <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialClasses[materialClass] %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(allLattices[cellType].connection[connectionType].type[latticeType].materialClasses || _.keys(allMaterialClasses), function(key){ %> + <% _.each(allLattices[cellType].connection[connectionType].type[applicationType].materialClasses || _.keys(allMaterialClasses), function(key){ %> <li><a class="appState dropdownSelector" data-property="materialClass" data-value="<%= key %>" href="#"><%= allMaterialClasses[key] %></a></li> <% }); %> </ul> diff --git a/js/menus/templates/MaterialMenuView.html b/js/menus/templates/MaterialMenuView.html index 2306310c..04565702 100644 --- a/js/menus/templates/MaterialMenuView.html +++ b/js/menus/templates/MaterialMenuView.html @@ -3,7 +3,7 @@ <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialClasses[materialClass] %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(allLattices[cellType].connection[connectionType].type[latticeType].materialClasses || _.keys(allMaterialClasses), function(key){ %> + <% _.each(allLattices[cellType].connection[connectionType].type[applicationType].materialClasses || _.keys(allMaterialClasses), function(key){ %> <li><a class="appState dropdownSelector" data-property="materialClass" data-value="<%= key %>" href="#"><%= allMaterialClasses[key] %></a></li> <% }); %> </ul> diff --git a/js/menus/templates/MenuWrapperView.html b/js/menus/templates/MenuWrapperView.html index 2ce0aa28..f7d0b40e 100644 --- a/js/menus/templates/MenuWrapperView.html +++ b/js/menus/templates/MenuWrapperView.html @@ -1,6 +1,6 @@ <ul class="nav nav-tabs nav-justified"> <% _.each(allMenus[currentNav].tabs, function(tabName, key){ - if (key == "part" && allLattices[cellType].connection[connectionType].type[latticeType].parts === null) return; %> + if (key == "part" && allLattices[cellType].connection[connectionType].type[applicationType].parts === null) return; %> <li role="presentation" class="menuWrapperTab" data-name="<%= key %>"><a href="#"><%= tabName %></a></li> <% }); %> </ul> \ No newline at end of file diff --git a/js/menus/templates/NavViewMenu.html b/js/menus/templates/NavViewMenu.html index c1f0f9db..af4595dd 100644 --- a/js/menus/templates/NavViewMenu.html +++ b/js/menus/templates/NavViewMenu.html @@ -29,7 +29,7 @@ <a tabindex="-1">Cells<span class="pull-right fui-arrow-right"></span></a> <ul class="dropdown-menu"> <% _.each(allCellModes, function(mode, key){ - if (key == "part" && allLattices[cellType].connection[connectionType].type[latticeType].parts === null) return; %> + if (key == "part" && allLattices[cellType].connection[connectionType].type[applicationType].parts === null) return; %> <li><a class="appState" data-property="cellMode" data-value="<%= key %>" href="#"><% if (cellMode == key) { %><span class="fui-check"></span><% } %><%= mode %></a></li> <% }); %> </ul> diff --git a/js/menus/templates/PartMenuView.html b/js/menus/templates/PartMenuView.html index 329494f3..b8c6030b 100644 --- a/js/menus/templates/PartMenuView.html +++ b/js/menus/templates/PartMenuView.html @@ -1,4 +1,4 @@ -<% var latticeData = allLattices[cellType].connection[connectionType].type[latticeType]; %> +<% var latticeData = allLattices[cellType].connection[connectionType].type[applicationType]; %> Part Type: <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= latticeData.parts[partType].name %><span class="caret"></span></button> diff --git a/js/menus/templates/Ribbon.html b/js/menus/templates/Ribbon.html index 0fee2414..6ce50d48 100644 --- a/js/menus/templates/Ribbon.html +++ b/js/menus/templates/Ribbon.html @@ -3,7 +3,7 @@ <div class="btn-group"> <a data-type="supercell" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "supercell"){ %> ribbon-selected<% } %>" href="#"><img data-type="supercell" src="assets/imgs/super-sm.png"></a> <a data-type="cell" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "cell"){ %> ribbon-selected<% } %>" href="#"><img data-type="cell" src="assets/imgs/cell-sm.png"></a> - <% if (allLattices[cellType].connection[connectionType].type[latticeType].parts){ %> + <% if (allLattices[cellType].connection[connectionType].type[applicationType].parts){ %> <a data-type="part" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "part"){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/part-sm.png"></a> <% } %> <!--<a data-type="beam" class="btn btn-primary btn-ribbon ribbonCellMode<% if (cellMode == "beam"){ %> ribbon-selected<% } %>" href="#">Beam</a>--> diff --git a/js/models/AppState.js b/js/models/AppState.js index 5ff1d306..e07abab9 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -290,7 +290,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], if (this.lattice.get("connectionType") != "gik") break; if (state) { var val = e.keyCode-48; - var range = plist.allLattices[this.lattice.get("cellType")].connection[this.lattice.get("connectionType")].type[this.lattice.get("latticeType")].options.gikRange; + var range = plist.allLattices[this.lattice.get("cellType")].connection[this.lattice.get("connectionType")].type[this.lattice.get("applicationType")].options.gikRange; if (range){ if ((range[0] > 0 && val < range[0]) || (range[1] > 1 && val > range[1])){ console.warn("gik length out of range"); diff --git a/js/plists/PList.js b/js/plists/PList.js index ab9994e8..cfc71501 100644 --- a/js/plists/PList.js +++ b/js/plists/PList.js @@ -106,13 +106,13 @@ define(['three'], function(THREE){ dnabricks: { cellType: "cube", connectionType: "gik", - latticeType: "willGik", + applicationType: "willGik", partType: null }, electronics: { cellType: "cube", connectionType: "gik", - latticeType: "dnaBricks", + applicationType: "dnaBricks", partType: null } }, -- GitLab