aboutsummaryrefslogtreecommitdiff
path: root/js/document/document-text.js
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/document-text.js
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/document-text.js')
-rwxr-xr-xjs/document/document-text.js52
1 files changed, 49 insertions, 3 deletions
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