aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-02 16:28:39 -0700
committerJohn Mayhew2012-04-02 16:28:39 -0700
commitb4155fb4c33675a8a7cd37473513718043fdf0ba (patch)
tree3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
parent5ba9aeac94c86049423fd5d4b37b277263939c13 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts: js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/runtime/GLRuntime.js js/helper-classes/RDGE/src/core/script/MeshManager.js js/helper-classes/RDGE/src/core/script/engine.js js/helper-classes/RDGE/src/core/script/fx/ssao.js js/helper-classes/RDGE/src/core/script/init_state.js js/helper-classes/RDGE/src/core/script/run_state.js js/helper-classes/RDGE/src/core/script/scenegraphNodes.js js/helper-classes/RDGE/src/core/script/utilities.js js/helper-classes/RDGE/src/tools/compile-rdge-core.bat js/helper-classes/RDGE/src/tools/compile-rdge-core.sh js/helper-classes/RDGE/src/tools/rdge-compiled.js js/lib/drawing/world.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/linear-gradient-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-blur-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js js/preloader/Preloader.js
Diffstat (limited to 'js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js')
-rwxr-xr-xjs/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js91
1 files changed, 81 insertions, 10 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index b6bee37d..3505393c 100755
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -23,6 +23,36 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
23 "text": "styles", 23 "text": "styles",
24 "children": [ 24 "children": [
25 { 25 {
26 "text": "Widgets",
27 "children": [
28 {
29 "text": "Feed Reader",
30 "dataFile" : "node_modules/components-data/feed-reader.json",
31 "component": "feedreader"
32 },
33 {
34 "text": "Map",
35 "dataFile" : "node_modules/components-data/map.json",
36 "component": "map"
37 },
38 {
39 "text": "Picasa Carousel",
40 "dataFile" : "node_modules/components-data/picasa-carousel.json",
41 "component": "picasa-carousel"
42 },
43 {
44 "text": "Search Bar",
45 "dataFile" : "node_modules/components-data/searchfield.json",
46 "component": "searchfield"
47 },
48 {
49 "text": "Youtube Channel",
50 "dataFile" : "node_modules/components-data/youtube-channel.json",
51 "component": "youtube-channel"
52 }
53 ]
54 },
55 {
26 "text": "Montage Components", 56 "text": "Montage Components",
27 "children": [ 57 "children": [
28 { 58 {
@@ -50,7 +80,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
50 "dataFile" : "node_modules/components-data/number-input.json", 80 "dataFile" : "node_modules/components-data/number-input.json",
51 "component": "numberInput" 81 "component": "numberInput"
52 }, 82 },
53 { 83 {
54 "text": "Select Input", 84 "text": "Select Input",
55 "dataFile" : "node_modules/components-data/select.json", 85 "dataFile" : "node_modules/components-data/select.json",
56 "component": "select" 86 "component": "select"
@@ -118,7 +148,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
118 didCreate: { 148 didCreate: {
119 value: function() { 149 value: function() {
120 // Setup the drop delegate 150 // Setup the drop delegate
121// this.application.ninja.dragDropMediator.dropDelegate = this; 151 this.application.ninja.dragDropMediator.dropDelegate = this;
122 // Loop through the component and load the JSON data for them 152 // Loop through the component and load the JSON data for them
123 this._loadComponents(); 153 this._loadComponents();
124 } 154 }
@@ -129,15 +159,19 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
129 _loadComponents: { 159 _loadComponents: {
130 value: function() { 160 value: function() {
131 161
132 this.componentsToLoad = this.components.children[0].children.length; 162 for(var cat in this.components.children) {
163
164 this.componentsToLoad += this.components.children[cat].children.length;
165
166 for(var i = 0, component; component = this.components.children[cat].children[i]; i++) {
167 var req = new XMLHttpRequest();
168 //req.identifier = "searchRequest";
169 req.open("GET", component.dataFile);
170 req.addEventListener("load", this, false);
171 req.addEventListener("error", this, false);
172 req.send();
173 }
133 174
134 for(var i = 0, component; component = this.components.children[0].children[i]; i++) {
135 var req = new XMLHttpRequest();
136 //req.identifier = "searchRequest";
137 req.open("GET", component.dataFile);
138 req.addEventListener("load", this, false);
139 req.addEventListener("error", this, false);
140 req.send();
141 } 175 }
142 } 176 }
143 }, 177 },
@@ -257,6 +291,15 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
257 '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' 291 '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'
258 }; 292 };
259 293
294 var defaultStyles = component.defaultStyles;
295 if(defaultStyles) {
296 for(var n in defaultStyles) {
297 styles[n] = defaultStyles[n];
298 }
299 }
300
301 instance.addEventListener('firstDraw', that, false);
302
260 that.application.ninja.currentDocument.setComponentInstance(instance, element); 303 that.application.ninja.currentDocument.setComponentInstance(instance, element);
261 304
262 NJevent("elementAdding", {"el": element, "data":styles}); 305 NJevent("elementAdding", {"el": element, "data":styles});
@@ -264,6 +307,12 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
264 307
265 } 308 }
266 }, 309 },
310
311 handleFirstDraw: {
312 value: function (e) {
313 NJevent("addComponentFirstDraw");
314 }
315 },
267 316
268 makeComponent: { 317 makeComponent: {
269 value: function(name) { 318 value: function(name) {
@@ -313,6 +362,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
313 el.setAttribute("type", "range"); 362 el.setAttribute("type", "range");
314 break; 363 break;
315 case "textfield": 364 case "textfield":
365 case "searchfield":
316 el = NJUtils.makeNJElement("input", "Textfield", "component"); 366 el = NJUtils.makeNJElement("input", "Textfield", "component");
317 el.elementModel.pi = "TextfieldPi"; 367 el.elementModel.pi = "TextfieldPi";
318 el.setAttribute("type", "text"); 368 el.setAttribute("type", "text");
@@ -326,6 +376,27 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
326 el.elementModel.pi = "ToggleButtonPi"; 376 el.elementModel.pi = "ToggleButtonPi";
327 el.innerHTML = "Off"; 377 el.innerHTML = "Off";
328 break; 378 break;
379 case "map":
380 el = NJUtils.makeNJElement("div", "Map", "component");
381 el.elementModel.pi = "MapPi";
382 el.elementModel.isComponent = true;
383 break;
384 case "feedreader":
385 el = NJUtils.makeNJElement("div", "Feed Reader", "component");
386 el.elementModel.pi = "FeedReaderPi";
387 el.elementModel.isComponent = true;
388 break;
389 case "picasa-carousel":
390 el = NJUtils.makeNJElement("div", "Picasa Carousel", "component");
391 el.elementModel.pi = "PicasaCarouselPi";
392 el.elementModel.isComponent = true;
393 break;
394 case "youtube-channel":
395 el = NJUtils.makeNJElement("div", "Youtube Channel", "component");
396 el.elementModel.pi = "YoutubeChannelPi";
397 el.elementModel.isComponent = true;
398 break;
399
329 } 400 }
330 401
331 return el; 402 return el;