diff options
author | Eric Guzman | 2012-05-17 17:43:05 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-17 17:43:05 -0700 |
commit | 458a4598ed64e3d8c6010a216fb7fb4b3c3c87e7 (patch) | |
tree | ee329e409fe28ae54c894b9e27e82e1f85aefc85 /js/panels/components-panel.reel | |
parent | 82954f400f7f8609aef0d2bc1f44c9d960907be6 (diff) | |
parent | 52394cdd71bd62c8c109fd135fa146b7183fbd1f (diff) | |
download | ninja-458a4598ed64e3d8c6010a216fb7fb4b3c3c87e7.tar.gz |
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into CSSPanelUpdates
Conflicts:
js/document/templates/montage-html/default_html.css
js/lib/NJUtils.js
Diffstat (limited to 'js/panels/components-panel.reel')
-rwxr-xr-x | js/panels/components-panel.reel/components-panel.js | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/js/panels/components-panel.reel/components-panel.js b/js/panels/components-panel.reel/components-panel.js index 4169423b..e028d1db 100755 --- a/js/panels/components-panel.reel/components-panel.js +++ b/js/panels/components-panel.reel/components-panel.js | |||
@@ -7,8 +7,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component, | 8 | Component = require("montage/ui/component").Component, |
9 | NJUtils = require("js/lib/NJUtils").NJUtils; | 9 | NJUtils = require("js/lib/NJUtils").NJUtils; |
10 | 10 | ClassUUID = require("js/components/core/class-uuid").ClassUuid, | |
11 | var PIData = require("js/data/pi/pi-data").PiData; | 11 | PIData = require("js/data/pi/pi-data").PiData; |
12 | 12 | ||
13 | String.prototype.capitalizeFirstChar = function() { | 13 | String.prototype.capitalizeFirstChar = function() { |
14 | return this.charAt(0).toUpperCase() + this.slice(1); | 14 | return this.charAt(0).toUpperCase() + this.slice(1); |
@@ -278,7 +278,7 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
278 | that = this; | 278 | that = this; |
279 | element = this.makeComponent(component.component); | 279 | element = this.makeComponent(component.component); |
280 | 280 | ||
281 | this.application.ninja.currentDocument._window.addComponent(element, {name: component.name, path: component.module}, function(instance, element) { | 281 | this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addComponent(element, {name: component.name, path: component.module}, function(instance, element) { |
282 | 282 | ||
283 | //var pos = that.getStageCenter(); | 283 | //var pos = that.getStageCenter(); |
284 | 284 | ||
@@ -295,21 +295,13 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | instance.addEventListener('firstDraw', that, false); | 298 | that.application.ninja.currentDocument.model.setComponentInstance(instance, element); |
299 | |||
300 | that.application.ninja.currentDocument.setComponentInstance(instance, element); | ||
301 | 299 | ||
302 | that.application.ninja.elementMediator.addElements(element, styles); | 300 | that.application.ninja.elementMediator.addElements(element, styles); |
303 | }); | 301 | }); |
304 | 302 | ||
305 | } | 303 | } |
306 | }, | 304 | }, |
307 | |||
308 | handleFirstDraw: { | ||
309 | value: function (e) { | ||
310 | NJevent("addComponentFirstDraw"); | ||
311 | } | ||
312 | }, | ||
313 | 305 | ||
314 | makeComponent: { | 306 | makeComponent: { |
315 | value: function(name) { | 307 | value: function(name) { |
@@ -346,7 +338,7 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
346 | break; | 338 | break; |
347 | case "select": | 339 | case "select": |
348 | el = document.application.njUtils.make("select", null, this.application.ninja.currentDocument); | 340 | el = document.application.njUtils.make("select", null, this.application.ninja.currentDocument); |
349 | document.application.njUtils.createModelForComponent(el, "Select"); | 341 | document.application.njUtils.createModelForComponent(el, "SelectInput"); |
350 | break; | 342 | break; |
351 | case "radioButton": | 343 | case "radioButton": |
352 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); | 344 | el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); |
@@ -366,7 +358,7 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
366 | break; | 358 | break; |
367 | case "textarea": | 359 | case "textarea": |
368 | el = document.application.njUtils.make("textarea", null, this.application.ninja.currentDocument); | 360 | el = document.application.njUtils.make("textarea", null, this.application.ninja.currentDocument); |
369 | document.application.njUtils.createModelForComponent(el, "TextArea"); | 361 | document.application.njUtils.createModelForComponent(el, "Textarea"); |
370 | break; | 362 | break; |
371 | case "toggleButton": | 363 | case "toggleButton": |
372 | el = document.application.njUtils.make("button", null, this.application.ninja.currentDocument); | 364 | el = document.application.njUtils.make("button", null, this.application.ninja.currentDocument); |
@@ -392,6 +384,8 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
392 | 384 | ||
393 | } | 385 | } |
394 | 386 | ||
387 | el.setAttribute("data-montage-id", ClassUUID.generate()); | ||
388 | |||
395 | return el; | 389 | return el; |
396 | } | 390 | } |
397 | }, | 391 | }, |
@@ -404,8 +398,8 @@ exports.ComponentsPanel = Montage.create(Component, { | |||
404 | //if(!this.centerStage) { | 398 | //if(!this.centerStage) { |
405 | var top, left; | 399 | var top, left; |
406 | 400 | ||
407 | top = ~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.documentRoot, "height"))) / 2); | 401 | top = (this.application.ninja.stage.canvas.height / 2); // ~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.documentRoot, "height"))) / 2); |
408 | left = ~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.documentRoot, "width"))) / 2); | 402 | left = (this.application.ninja.stage.canvas.width / 2); //~~((parseFloat(this.application.ninja.elementMediator.getProperty(this.application.ninja.currentDocument.documentRoot, "width"))) / 2); |
409 | //this.centerStage = [top, left]; | 403 | //this.centerStage = [top, left]; |
410 | return [left, top]; | 404 | return [left, top]; |
411 | //} | 405 | //} |