aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-02 14:49:34 -0800
committerValerio Virgillito2012-02-02 14:49:34 -0800
commit7ccadc20c96539988290999982d7483e013732f9 (patch)
tree4f39a9086cad6155ea86e63e1d0f43479b70bd8b /js
parent49b15e69f18a9d9748f703092725a3c8df7fc698 (diff)
downloadninja-7ccadc20c96539988290999982d7483e013732f9.tar.gz
adding a componentController and callback for lazy loading.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html11
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js29
2 files changed, 36 insertions, 4 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
index df104ecc..1e040e35 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
@@ -11,6 +11,17 @@
11 11
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "componentController": {
15 "module": "montage/ui/controller/array-controller",
16 "name": "ArrayController",
17 "bindings": {
18 "content": {
19 "boundObject": {"@": "owner"},
20 "boundObjectPropertyPath": "components"
21 }
22 }
23 },
24
14 "owner": { 25 "owner": {
15 "module": "js/panels/Components/ComponentsPanelBase.reel", 26 "module": "js/panels/Components/ComponentsPanelBase.reel",
16 "name": "ComponentsPanelBase", 27 "name": "ComponentsPanelBase",
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index 58a798d8..9b5b755c 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -11,10 +11,25 @@ var Montage = require("montage/core/core").Montage,
11var treeControlModule = require("js/components/tree.reel"); 11var treeControlModule = require("js/components/tree.reel");
12 12
13var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component, { 13var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component, {
14 _hasFocus: { 14
15 enumerable: false, 15 components: {
16 value: false 16 value: null
17 },
18
19 didCreate: {
20 value: function() {
21 this._loadComponents();
22 }
23 },
24
25 _loadComponents: {
26 value: function() {
27 this.photos = [
28 {component: "Button", data: "montage/ui/button.reel/button.json"}
29 ];
30 }
17 }, 31 },
32
18 prepareForDraw: { 33 prepareForDraw: {
19 enumerable: false, 34 enumerable: false,
20 value: function() { 35 value: function() {
@@ -57,7 +72,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
57 componentEl.setAttribute("type", "button"); 72 componentEl.setAttribute("type", "button");
58 //componentEl.innerHTML = "Button"; 73 //componentEl.innerHTML = "Button";
59 74
60 componentInstance = this.application.ninja.currentDocument._window.addComponent(componentEl, {type: componentType, path: "montage/ui/button.reel", name: "Button"}); 75 componentInstance = this.application.ninja.currentDocument._window.addComponent(componentEl, {type: componentType, path: "montage/ui/button.reel", name: "Button"}, this.callback);
61 76
62 77
63 }else if(componentType == "Checkbox"){ 78 }else if(componentType == "Checkbox"){
@@ -140,5 +155,11 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
140 155
141 156
142 } 157 }
158 },
159
160 callback: {
161 value: function() {
162 console.log("the callback");
163 }
143 } 164 }
144}); \ No newline at end of file 165}); \ No newline at end of file