aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/components/menu/menu-entry.reel/menu-entry.html13
-rwxr-xr-xjs/components/menu/menu-item.reel/menu-item.html13
-rwxr-xr-xjs/components/menu/menu-item.reel/menu-item.js20
-rwxr-xr-xjs/components/menu/menu.reel/menu.html5
-rwxr-xr-xjs/components/menu/menu.reel/menu.js17
-rwxr-xr-xjs/data/menu-data.js147
-rwxr-xr-xjs/ninja.reel/ninja.html3
-rwxr-xr-xjs/stage/stage.reel/stage.js9
8 files changed, 125 insertions, 102 deletions
diff --git a/js/components/menu/menu-entry.reel/menu-entry.html b/js/components/menu/menu-entry.reel/menu-entry.html
index cd013a4e..f64de3cb 100755
--- a/js/components/menu/menu-entry.reel/menu-entry.html
+++ b/js/components/menu/menu-entry.reel/menu-entry.html
@@ -17,11 +17,7 @@
17 "automaticallyOrganizeObjects": false 17 "automaticallyOrganizeObjects": false
18 }, 18 },
19 "bindings": { 19 "bindings": {
20 "content": { 20 "content": {"<-": "@owner.data.entries"}
21 "boundObject": {"@": "owner"},
22 "boundObjectPropertyPath": "data.entries",
23 "oneway": true
24 }
25 } 21 }
26 }, 22 },
27 23
@@ -39,11 +35,8 @@
39 "element": { "#": "menuEntryItem" } 35 "element": { "#": "menuEntryItem" }
40 }, 36 },
41 "bindings": { 37 "bindings": {
42 "data": { 38 "data": {"<-": "@repetition.objectAtCurrentIteration"},
43 "boundObject": {"@": "repetition"}, 39 "enabled": {"<-": "@repetition.objectAtCurrentIteration.enabled"}
44 "boundObjectPropertyPath": "objectAtCurrentIteration",
45 "oneway": true
46 }
47 } 40 }
48 }, 41 },
49 42
diff --git a/js/components/menu/menu-item.reel/menu-item.html b/js/components/menu/menu-item.reel/menu-item.html
index 5ff8c0fc..1902833a 100755
--- a/js/components/menu/menu-item.reel/menu-item.html
+++ b/js/components/menu/menu-item.reel/menu-item.html
@@ -17,11 +17,7 @@
17 "automaticallyOrganizeObjects": false 17 "automaticallyOrganizeObjects": false
18 }, 18 },
19 "bindings": { 19 "bindings": {
20 "content": { 20 "content": {"<-": "@owner.subentries"}
21 "boundObject": {"@": "owner"},
22 "boundObjectPropertyPath": "subentries",
23 "oneway": true
24 }
25 } 21 }
26 }, 22 },
27 23
@@ -39,11 +35,8 @@
39 "element": {"#": "menuEntryItem" } 35 "element": {"#": "menuEntryItem" }
40 }, 36 },
41 "bindings": { 37 "bindings": {
42 "data": { 38 "data": {"<-": "@repetition.objectAtCurrentIteration"},
43 "boundObject": {"@": "repetition"}, 39 "enabled": {"<-": "@repetition.objectAtCurrentIteration.enabled"}
44 "boundObjectPropertyPath": "objectAtCurrentIteration",
45 "oneway": true
46 }
47 } 40 }
48 }, 41 },
49 42
diff --git a/js/components/menu/menu-item.reel/menu-item.js b/js/components/menu/menu-item.reel/menu-item.js
index 9c18ed37..c00c4412 100755
--- a/js/components/menu/menu-item.reel/menu-item.js
+++ b/js/components/menu/menu-item.reel/menu-item.js
@@ -14,7 +14,7 @@ exports.MenuItem = Montage.create(Component, {
14 }, 14 },
15 15
16 _enabled: { 16 _enabled: {
17 value: null 17 value: false
18 }, 18 },
19 19
20 enabled: { 20 enabled: {
@@ -61,7 +61,6 @@ exports.MenuItem = Montage.create(Component, {
61 61
62 prepareForDraw: { 62 prepareForDraw: {
63 value: function() { 63 value: function() {
64 var boundObject = this.application.ninja, strArr = null, i=0;
65 64
66 if(!this.data) return; 65 if(!this.data) return;
67 66
@@ -82,24 +81,7 @@ exports.MenuItem = Montage.create(Component, {
82 }); 81 });
83 82
84 } 83 }
85/*
86 if(this.data.enabled.boundProperty) {
87
88 boundObject = this.application.ninja[this.data.enabled.boundObj];
89
90 Object.defineBinding(this, "enabled", {
91 boundObject: boundObject,
92 boundObjectPropertyPath: this.data.enabled.boundProperty,
93 boundValueMutator: this.data.enabled.boundValueMutator,
94 oneway : this.data.enabled.oneway
95 });
96 84
97 } else {
98 */
99 this.enabled = this.data.enabled;
100 /*
101 }
102 */
103 if(this.data.submenu) { 85 if(this.data.submenu) {
104 this.submenu = true; 86 this.submenu = true;
105 87
diff --git a/js/components/menu/menu.reel/menu.html b/js/components/menu/menu.reel/menu.html
index 7f2aeeef..f15cf119 100755
--- a/js/components/menu/menu.reel/menu.html
+++ b/js/components/menu/menu.reel/menu.html
@@ -12,7 +12,10 @@
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "menudata": { 14 "menudata": {
15 "prototype": "js/data/menu-data" 15 "prototype": "js/data/menu-data",
16 "bindings": {
17 "currentDocument": {"<-": "@owner.currentDocument"}
18 }
16 }, 19 },
17 20
18 "menuController": { 21 "menuController": {
diff --git a/js/components/menu/menu.reel/menu.js b/js/components/menu/menu.reel/menu.js
index fb221640..50d3f0bc 100755
--- a/js/components/menu/menu.reel/menu.js
+++ b/js/components/menu/menu.reel/menu.js
@@ -9,6 +9,23 @@ var Montage = require("montage/core/core").Montage,
9 9
10exports.Menu = Montage.create(Component, { 10exports.Menu = Montage.create(Component, {
11 11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26 }
27 },
28
12 _active: { 29 _active: {
13 value: false 30 value: false
14 }, 31 },
diff --git a/js/data/menu-data.js b/js/data/menu-data.js
index aeb95ccc..6c597542 100755
--- a/js/data/menu-data.js
+++ b/js/data/menu-data.js
@@ -4,9 +4,51 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9
10exports.MenuData = Montage.create(Component, {
11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26
27 this.documentEnabledIndices.forEach(function(index) {
28 index.enabled = true;
29 });
30
31 }
32 },
33
34 didCreate: {
35 value: function() {
36 var self = this;
37
38 this.topLevelMenu.forEach(function(item) {
39 item.entries.forEach(function(entry) {
40 if(entry.depend && entry.depend === "document") {
41 self.documentEnabledIndices.push(entry);
42 }
43 });
44 });
45 }
46 },
47
48 documentEnabledIndices: {
49 value: []
50 },
8 51
9exports.MenuData = Montage.create( Montage, {
10 topLevelMenu: { 52 topLevelMenu: {
11 value: [ 53 value: [
12 { 54 {
@@ -33,65 +75,47 @@ exports.MenuData = Montage.create( Montage, {
33 { 75 {
34 "displayText" : "Close File", 76 "displayText" : "Close File",