diff options
author | Valerio Virgillito | 2012-05-29 00:34:40 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-29 00:34:40 -0700 |
commit | 4c3aac5eabd93052b1554a03d78235215bb49db4 (patch) | |
tree | fe08f4f6d33d81d602f56daeaec845577fb9d8a5 /js/components/layout | |
parent | 9a66ccad0235484643ef6d821315b11b5be4a93e (diff) | |
download | ninja-4c3aac5eabd93052b1554a03d78235215bb49db4.tar.gz |
document bindings phase 1
- using array controller to bind the current document to all ninja components
- removed open document event
- removed references to the document controller
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components/layout')
11 files changed, 197 insertions, 86 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 49dbe3cb..74e89ac1 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -9,13 +9,45 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.Breadcrumb = Montage.create(Component, { | 10 | exports.Breadcrumb = Montage.create(Component, { |
11 | 11 | ||
12 | disabled: { | 12 | _currentDocument: { |
13 | enumerable: false, | ||
14 | value: null | ||
15 | }, | ||
16 | |||
17 | currentDocument: { | ||
18 | enumerable: false, | ||
19 | get: function() { | ||
20 | return this._currentDocument; | ||
21 | }, | ||
22 | set: function(value) { | ||
23 | if (value === this._currentDocument) { | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | this._currentDocument = value; | ||
28 | |||
29 | if(!this._currentDocument) { | ||
30 | this.disabled = true; | ||
31 | } | ||
32 | |||
33 | this.disabled = this._currentDocument.currentView !== "design"; | ||
34 | |||
35 | } | ||
36 | }, | ||
37 | |||
38 | |||
39 | _disabled: { | ||
13 | value: true | 40 | value: true |
14 | }, | 41 | }, |
15 | 42 | ||
16 | handleOpenDocument: { | 43 | disabled: { |
17 | value: function(){ | 44 | get: function() { |
18 | this.disabled = false; | 45 | return this._disabled; |
46 | }, | ||
47 | set: function(value) { | ||
48 | if(value !== this._disabled) { | ||
49 | this._disabled = value; | ||
50 | } | ||
19 | } | 51 | } |
20 | }, | 52 | }, |
21 | 53 | ||
@@ -50,7 +82,6 @@ exports.Breadcrumb = Montage.create(Component, { | |||
50 | 82 | ||
51 | prepareForDraw: { | 83 | prepareForDraw: { |
52 | value: function() { | 84 | value: function() { |
53 | this.eventManager.addEventListener("openDocument", this, false); | ||
54 | this.eventManager.addEventListener("closeDocument", this, false); | 85 | this.eventManager.addEventListener("closeDocument", this, false); |
55 | this.breadcrumbBt.addEventListener("action", this, false); | 86 | this.breadcrumbBt.addEventListener("action", this, false); |
56 | } | 87 | } |
@@ -65,7 +96,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
65 | 96 | ||
66 | parentNode = this.container; | 97 | parentNode = this.container; |
67 | 98 | ||
68 | while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { | 99 | while(parentNode !== this.currentDocument.model.documentRoot) { |
69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 100 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
70 | parentNode = parentNode.parentNode; | 101 | parentNode = parentNode.parentNode; |
71 | } | 102 | } |
@@ -87,6 +118,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
87 | this.containerElements.pop(); | 118 | this.containerElements.pop(); |
88 | } | 119 | } |
89 | 120 | ||
121 | // TODO: This is bound 2 ways, update the internal property | ||
90 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; | 122 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; |
91 | } | 123 | } |
92 | } | 124 | } |
diff --git a/js/components/layout/document-bar.reel/document-bar.html b/js/components/layout/document-bar.reel/document-bar.html index 760186ba..a35b5590 100755 --- a/js/components/layout/document-bar.reel/document-bar.html +++ b/js/components/layout/document-bar.reel/document-bar.html | |||
@@ -37,11 +37,7 @@ | |||
37 | "element": {"#": "disabledCondition"} | 37 | "element": {"#": "disabledCondition"} |
38 | }, | 38 | }, |
39 | "bindings": { | 39 | "bindings": { |
40 | "condition": { | 40 | "condition": {"<-": "@owner.disabled"} |
41 | "boundObject": {"@": "owner"}, | ||
42 | "boundObjectPropertyPath": "disabled", | ||
43 | "oneway": true | ||
44 | } | ||
45 | } | 41 | } |
46 | }, | 42 | }, |
47 | 43 | ||
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 56b61f1d..6a7b0f3f 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js | |||
@@ -9,13 +9,32 @@ var Component = require("montage/ui/component").Component; | |||
9 | 9 | ||
10 | exports.DocumentBar = Montage.create(Component, { | 10 | exports.DocumentBar = Montage.create(Component, { |
11 | 11 | ||
12 | _currentDocument: { | ||
13 | enumerable: false, | ||
14 | value: null | ||
15 | }, | ||
16 | |||
17 | currentDocument: { | ||
18 | enumerable: false, | ||
19 | get: function() { | ||
20 | return this._currentDocument; | ||
21 | }, | ||
22 | set: function(value) { | ||
23 | if (value === this._currentDocument) { | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | this._currentDocument = value; | ||
28 | |||
29 | this.disabled = !this._currentDocument; | ||
30 | |||
31 | } | ||
32 | }, | ||
33 | |||
12 | designView: { value: null, enumerable: false}, | 34 | designView: { value: null, enumerable: false}, |
13 | codeView: { value: null, enumerable: false}, | 35 | codeView: { value: null, enumerable: false}, |
14 | zoomControl: { value: null, enumerable: false }, | 36 | zoomControl: { value: null, enumerable: false }, |
15 | _type: { enumerable: false, value: null }, | 37 | _type: { enumerable: false, value: null }, |
16 | disabled: { value: true }, | ||
17 | |||
18 | |||
19 | 38 | ||
20 | type: { | 39 | type: { |
21 | enumerable: false, | 40 | enumerable: false, |
@@ -86,7 +105,6 @@ exports.DocumentBar = Montage.create(Component, { | |||
86 | 105 | ||
87 | prepareForDraw: { | 106 | prepareForDraw: { |
88 | value: function() { | 107 | value: function() { |
89 | this.eventManager.addEventListener( "openDocument", this, false); | ||
90 | this.eventManager.addEventListener( "closeDocument", this, false); | 108 | this.eventManager.addEventListener( "closeDocument", this, false); |
91 | this.designView.addEventListener("click", this, false); | 109 | this.designView.addEventListener("click", this, false); |
92 | this.codeView.addEventListener("click", this, false); | 110 | this.codeView.addEventListener("click", this, false); |
@@ -94,6 +112,22 @@ exports.DocumentBar = Montage.create(Component, { | |||
94 | } | 112 | } |
95 | }, | 113 | }, |
96 | 114 | ||
115 | _disabled: { | ||
116 | value: true | ||
117 | }, | ||
118 | |||
119 | disabled: { | ||
120 | get: function() { | ||
121 | return this._disabled; | ||
122 | }, | ||
123 | set: function(value) { | ||
124 | if(value !== this._disabled) { | ||
125 | this._disabled = value; | ||
126 | } | ||
127 | } | ||
128 | }, | ||
129 | |||
130 | |||
97 | handleClick: { | 131 | handleClick: { |
98 | value: function(event) { | 132 | value: function(event) { |
99 | if(event._event.target.id === this.currentView) return; | 133 | if(event._event.target.id === this.currentView) return; |
@@ -103,12 +137,6 @@ exports.DocumentBar = Montage.create(Component, { | |||
103 | } | 137 | } |
104 | }, | 138 | }, |
105 | 139 | ||
106 | handleOpenDocument: { | ||
107 | value: function() { | ||
108 | this.disabled = false; | ||
109 | } | ||
110 | }, | ||
111 | |||
112 | handleCloseDocument: { | 140 | handleCloseDocument: { |
113 | value: function() { | 141 | value: function() { |
114 | if(!this.application.ninja.documentController.activeDocument) { | 142 | if(!this.application.ninja.documentController.activeDocument) { |
diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css index 4601974f..010e1da7 100755 --- a/js/c |