aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorArmen Kesablyan2012-05-23 14:34:58 -0700
committerArmen Kesablyan2012-05-23 14:34:58 -0700
commitc21db7f1e4a0582777bdb5366df5d023a915b779 (patch)
treec4d29cb4686101d4a480ae836d20187879cf5400 /js/document
parent3ed95247e9ea4b0a7833401ed6809647b7c4acbf (diff)
parent1a7e347810401e6262d9d7bad1c3583e6773993b (diff)
downloadninja-c21db7f1e4a0582777bdb5366df5d023a915b779.tar.gz
Merge branch 'refs/heads/dom-architecture' into binding
Conflicts: js/data/panels-data.js Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js43
-rwxr-xr-xjs/document/document-text.js52
-rwxr-xr-xjs/document/html-document.js82
-rwxr-xr-xjs/document/models/base.js22
-rwxr-xr-xjs/document/models/html.js22
-rwxr-xr-xjs/document/models/text.js57
-rwxr-xr-xjs/document/templates/html/index.html4
-rwxr-xr-xjs/document/views/base.js2
-rwxr-xr-xjs/document/views/code.js152
-rwxr-xr-xjs/document/views/design.js47
10 files changed, 366 insertions, 117 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 56d9db02..f92a425c 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -119,38 +119,45 @@ exports.HtmlDocument = Montage.create(Component, {
119 this._observer = null; 119 this._observer = null;
120 //Making callback after view is loaded 120 //Making callback after view is loaded
121 this.loaded.callback.call(this.loaded.context, this); 121 this.loaded.callback.call(this.loaded.context, this);
122 //Setting opacity to be viewable after load
123 this.model.views.design.iframe.style.opacity = 1;
124 } 122 }
125 }, 123 },
126 //////////////////////////////////////////////////////////////////// 124 ////////////////////////////////////////////////////////////////////
127 // 125 //
128 closeDocument: { 126 closeDocument: {
129 value: function (context, callback) { 127 value: function (context, callback) {
128 //Closing document and getting outcome
130 var closed = this.model.close(null); 129 var closed = this.model.close(null);
131 130 //Making callback if specified
132 callback.call(context, this); 131 if (callback) callback.call(context, this);
133 } 132 }
134 }, 133 },
135 //////////////////////////////////////////////////////////////////// 134 ////////////////////////////////////////////////////////////////////
136 // 135 //
137 serializeDocument: { 136 serializeDocument: {
138 value: function () { 137 value: function () {
139 // There are not needed for now ssince we cannot change them 138 // There are not needed for now since we cannot change them
140 //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; 139 //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
141 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; 140 //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
142 141
143 // Serialize the current scroll position 142 // Serialize the current scroll position
144 // TODO: Implement 143 //TODO: Move these properties to the design view class
144 this.model.scrollLeft = this.application.ninja.stage._scrollLeft;
145 this.model.scrollTop = this.application.ninja.stage._scrollTop;
146 this.model.userContentLeft = this.application.ninja.stage._userContentLeft;
147 this.model.userContentTop = this.application.ninja.stage._userContentTop;
148
145 149
146 // Serialize the selection 150 // Serialize the selection, the container and grid
151 //TODO: Move this property to the design view class
147 this.model.selection = this.application.ninja.selectedElements.slice(0); 152 this.model.selection = this.application.ninja.selectedElements.slice(0);
153 this.model.selectionContainer = this.application.ninja.currentSelectedContainer;
148 this.draw3DGrid = this.application.ninja.appModel.show3dGrid; 154 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
149 155
150 // Serialize the undo 156 // Serialize the undo
151 // TODO: Save the montage undo queue 157 // TODO: Save the montage undo queue
152 158
153 // Pause the videos 159 // Pause the videos
160 //TODO: Move these to be handled on the show/hide methods in the view
154 this.model.views.design.pauseVideos(); 161 this.model.views.design.pauseVideos();
155 } 162 }
156 }, 163 },
@@ -158,7 +165,27 @@ exports.HtmlDocument = Montage.create(Component, {
158 // 165 //
159 deserializeDocument: { 166 deserializeDocument: {
160 value: function () { 167 value: function () {
161 //TODO: Import functionality 168 // There are not needed for now since we cannot change them
169 //this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
170 //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
171
172 // Deserialize the current scroll position
173 //TODO: Move these properties to the design view class
174 this.application.ninja.stage._scrollLeft = this.model.scrollLeft;
175 this.application.ninja.stage._scrollTop = this.model.scrollTop;
176 this.application.ninja.stage._userContentLeft = this.model.userContentLeft;
177 this.application.ninja.stage._userContentTop = this.model.userContentTop;
178
179 //TODO: Move this property to the design view class
180 this.application.ninja.selectedElements = this.model.selection.slice(0);
181// this.application.ninja.currentSelectedContainer = this.model.selectionContainer;
182 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
183
184 // Serialize the undo
185 // TODO: Save the montage undo queue
186
187 //TODO: Move this to the document controller
188 this.model.isActive = true;
162 } 189 }
163 } 190 }
164 //////////////////////////////////////////////////////////////////// 191 ////////////////////////////////////////////////////////////////////
diff --git a/js/document/document-text.js b/js/document/document-text.js
index 2a469144..bb63f5f8 100755
--- a/js/document/document-text.js
+++ b/js/document/document-text.js
@@ -7,7 +7,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component; 10 Component = require("montage/ui/component").Component,
11 TextDocumentModel = require("js/document/models/text").TextDocumentModel,
12 CodeDocumentView = require("js/document/views/code").CodeDocumentView;
11//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
12// 14//
13exports.TextDocument = Montage.create(Component, { 15exports.TextDocument = Montage.create(Component, {
@@ -16,9 +18,53 @@ exports.TextDocument = Montage.create(Component, {
16 hasTemplate: { 18 hasTemplate: {
17 enumerable: false, 19 enumerable: false,
18 value: false 20 value: false
19 } 21 },
20 ////////////////////////////////////////////////////////////////////
21 //////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////
23 //
24 model: {
25 value: null
26 },
27 ////////////////////////////////////////////////////////////////////
28 //
29
30 init:{
31 enumerable: false,
32 value : function(file, context, callback, view){
33 var codeDocumentView = CodeDocumentView.create(), container = null;
34
35 //Creating instance of Text Document Model
36 this.model = Montage.create(TextDocumentModel,{
37 file: {value: file},
38 parentContainer: {value: document.getElementById("codeViewContainer")},
39 views: {value: {'code': codeDocumentView, 'design': null}}
40 });
41
42 codeDocumentView.initialize(this.model.parentContainer);
43
44 codeDocumentView.textArea.value = file.content;
45 codeDocumentView.initializeTextView(file, this);
46
47 if (view === 'code') {
48 //TODO: Remove reference and use as part of model
49 this.currentView = 'code';
50 //Setting current view object to design
51 this.model.currentView = this.model.views.code;
52 }
53
54
55 callback.call(context, this);
56 }
57 },
58////////////////////////////////////////////////////////////////////
59 //
60 closeDocument: {
61 value: function (context, callback) {
62 var closed = this.model.close(null);
63
64 callback.call(context, this);
65 }
66 }
67////////////////////////////////////////////////////////////////////
22}); 68});
23//////////////////////////////////////////////////////////////////////// 69////////////////////////////////////////////////////////////////////////
24//////////////////////////////////////////////////////////////////////// \ No newline at end of file 70//////////////////////////////////////////////////////////////////////// \ No newline at end of file
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 68c2a9fb..447d90e3 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -209,8 +209,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
209 { 209 {
210 /* 210 /*
211 // Use this code to test the runtime version of WebGL 211 // Use this code to test the runtime version of WebGL
212 var cdm = new NinjaCvsRt.CanvasDataManager(); 212 var cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {});
213 cdm.loadGLData(elt, value, null ); 213 cvsDataMngr.loadGLData(elt, value);
214 */ 214 */
215 215
216 // /* 216 // /*
@@ -454,55 +454,6 @@ exports.HTMLDocument = Montage.create(TextDocument, {
454 } 454 }
455 }, 455 },
456 456
457 /**
458 * Return the specified inline attribute from the element.
459 */
460 GetElementAttribute: {
461 value: function(element, attribute) {
462
463 var value;
464
465 if(attribute === "src") {
466 return element[attribute].replace(window.location.href, '');
467 }
468
469 value = element[attribute];
470
471 if(value !== undefined) return value;
472// if(value || value === false) return [value, "inline"];
473
474