diff options
author | hwc487 | 2012-05-31 17:11:08 -0700 |
---|---|---|
committer | hwc487 | 2012-05-31 17:11:08 -0700 |
commit | 1c445cf5d905f79937998cf2f1115594ea8c1074 (patch) | |
tree | 35271ad7ffec86fde9102af3dd954fa3a2974582 /js/document/document-text.js | |
parent | 335ce503996e3ccbd2909086328d0a31fbd03370 (diff) | |
parent | 6042bdc5f2aada4412912fd01602d32c9088dc26 (diff) | |
download | ninja-1c445cf5d905f79937998cf2f1115594ea8c1074.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
js/io/system/ninjalibrary.json
Diffstat (limited to 'js/document/document-text.js')
-rwxr-xr-x | js/document/document-text.js | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/js/document/document-text.js b/js/document/document-text.js index 2a469144..811cc8ce 100755 --- a/js/document/document-text.js +++ b/js/document/document-text.js | |||
@@ -6,19 +6,66 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | //////////////////////////////////////////////////////////////////////// | 7 | //////////////////////////////////////////////////////////////////////// |
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var 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 | // |
13 | exports.TextDocument = Montage.create(Component, { | 15 | exports.TextDocument = Montage.create(Component, { |
14 | //////////////////////////////////////////////////////////////////// | 16 | //////////////////////////////////////////////////////////////////// |
15 | // | 17 | // |
16 | hasTemplate: { | 18 | hasTemplate: { |
17 | enumerable: false, | ||
18 | value: false | 19 | value: false |
19 | } | 20 | }, |
20 | //////////////////////////////////////////////////////////////////// | ||
21 | //////////////////////////////////////////////////////////////////// | 21 | //////////////////////////////////////////////////////////////////// |
22 | // | ||
23 | model: { | ||
24 | value: null | ||
25 | }, | ||
26 | //////////////////////////////////////////////////////////////////// | ||
27 | // | ||
28 | init:{ | ||
29 | value: function(file, context, callback, view){ | ||
30 | // | ||
31 | var codeDocumentView = CodeDocumentView.create(), container = null; //TODO: Why is this initilzied to null? | ||
32 | //Creating instance of Text Document Model | ||
33 | this.model = Montage.create(TextDocumentModel,{ | ||
34 | file: {value: file}, | ||
35 | parentContainer: {value: document.getElementById("codeViewContainer")}, //TODO: Remove reference to this element, should be dynamic | ||
36 | views: {value: {'code': codeDocumentView, 'design': null}} //TODO: Add check if file might have design view, if so, then create it | ||
37 | }); | ||
38 | //TODO: Add design view logic | ||
39 | //Initilizing view(s) | ||
40 | codeDocumentView.initialize(this.model.parentContainer); | ||
41 | //Checking for view specified | ||
42 | if (view === 'code') { | ||
43 | //TODO: Remove reference and use as part of model | ||
44 | this.currentView = 'code'; | ||
45 | //Setting current view object to design | ||
46 | this.model.currentView = this.model.views.code; | ||
47 | //Rendering view | ||
48 | codeDocumentView.textArea.value = file.content; | ||
49 | codeDocumentView.initializeTextView(file, this); | ||
50 | } else { | ||
51 | //Other view(s) logic goes here | ||
52 | } | ||
53 | //Checking if callback is needed | ||
54 | if (callback) callback.call(context, this); | ||
55 | } | ||
56 | }, | ||
57 | //////////////////////////////////////////////////////////////////// | ||
58 | // | ||
59 | closeDocument: { | ||
60 | value: function (context, callback) { | ||
61 | //Closing document and getting outcome | ||
62 | var closed = this.model.close(null); | ||
63 | //Making callback if specified | ||
64 | if (callback) callback.call(context, this); | ||
65 | } | ||
66 | } | ||
67 | //////////////////////////////////////////////////////////////////// | ||
68 | //////////////////////////////////////////////////////////////////// | ||
22 | }); | 69 | }); |
23 | //////////////////////////////////////////////////////////////////////// | 70 | //////////////////////////////////////////////////////////////////////// |
24 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 71 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |