diff options
author | Ananya Sen | 2012-02-15 10:52:56 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-15 10:52:56 -0800 |
commit | a8d1a2e1f4f4ab7b9298bfbd1b49731785c79c3a (patch) | |
tree | e47dbf5dfd4a3e466cc97acbce21262b24cf89e7 /js/io | |
parent | e864dc319805e259b7ae39a9d4d96fac552a1f87 (diff) | |
download | ninja-a8d1a2e1f4f4ab7b9298bfbd1b49731785c79c3a.tar.gz |
Revert "Revert "Merging TextDocument into BaseDocument""
This reverts commit b8782f2e3dd106accbb0160a98e6b498f26752ea.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io')
-rwxr-xr-x | js/io/document/base-document.js | 113 |
1 files changed, 112 insertions, 1 deletions
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js index 918b51ad..45c340ce 100755 --- a/js/io/document/base-document.js +++ b/js/io/document/base-document.js | |||
@@ -9,6 +9,115 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
9 | var Montage = require("montage/core/core").Montage; | 9 | var Montage = require("montage/core/core").Montage; |
10 | 10 | ||
11 | var BaseDocument = exports.BaseDocument = Montage.create(Montage, { | 11 | var BaseDocument = exports.BaseDocument = Montage.create(Montage, { |
12 | |||
13 | |||
14 | //TODO: Clean up, test | ||
15 | |||
16 | |||
17 | |||
18 | |||
19 | |||
20 | //////////////////////////////////////////////////////////////////// | ||
21 | //////////////////////////////////////////////////////////////////// | ||
22 | //////////////////////////////////////////////////////////////////// | ||
23 | //////////////////////////////////////////////////////////////////// | ||
24 | //Taken from text-document, which shouldn't be needed | ||
25 | |||
26 | // PRIVATE MEMBERS | ||
27 | _codeEditor: { | ||
28 | value: { | ||
29 | "editor": { value: null, enumerable: false }, | ||
30 | |||
31 | } | ||
32 | }, | ||
33 | |||
34 | _editor: { value: null, enumerable: false }, | ||
35 | _hline: { value: null, enumerable: false }, | ||
36 | |||
37 | _textArea: {value: null, enumerable: false }, | ||
38 | |||
39 | _userDocument: {value: null, enumerable: false }, | ||
40 | |||
41 | _source: { value: null, enumerable: false}, | ||
42 | |||
43 | source: { | ||
44 | get: function() { return this._source;}, | ||
45 | set: function(value) { this._source = value;} | ||
46 | }, | ||
47 | |||
48 | // PUBLIC MEMBERS | ||
49 | |||
50 | _savedLeftScroll: {value:null}, | ||
51 | _savedTopScroll: {value:null}, | ||
52 | |||
53 | //****************************************// | ||
54 | //PUBLIC API | ||
55 | |||
56 | |||
57 | // GETTERS / SETTERS | ||
58 | |||
59 | savedLeftScroll:{ | ||
60 | get: function() { return this._savedLeftScroll; }, | ||
61 | set: function(value) { this._savedLeftScroll = value} | ||
62 | }, | ||
63 | |||
64 | savedTopScroll:{ | ||
65 | get: function() { return this._savedTopScroll; }, | ||
66 | set: function(value) { this._savedTopScroll = value} | ||
67 | }, | ||
68 | |||
69 | textArea: { | ||
70 | get: function() { return this._textArea; }, | ||
71 | set: function(value) { this._textArea = value; } | ||
72 | }, | ||
73 | editor: { | ||
74 | get: function() { return this._editor; }, | ||
75 | set: function(value) { this._editor = value} | ||
76 | }, | ||
77 | |||
78 | hline: { | ||
79 | get: function() { return this._hline; }, | ||
80 | set: function(value) {this._hline = value; } | ||
81 | }, | ||
82 | |||
83 | |||
84 | //////////////////////////////////////////////////////////////////// | ||
85 | // | ||
86 | initialize: { | ||
87 | value: function(file, uuid, textArea, container, callback) { | ||
88 | // | ||
89 | this._userDocument = file; | ||
90 | // | ||
91 | this.init(file.name, file.uri, file.extension, container, uuid, callback); | ||
92 | // | ||
93 | this.currentView = "code"; | ||
94 | this.textArea = textArea; | ||
95 | } | ||
96 | }, | ||
97 | //////////////////////////////////////////////////////////////////// | ||
98 | // | ||
99 | save: { | ||
100 | enumerable: false, | ||
101 | value: function () { | ||
102 | //TODO: Improve sequence | ||
103 | this.editor.save(); | ||
104 | return {mode: this._userDocument.extension, document: this._userDocument, content: this.textArea.value}; | ||
105 | } | ||
106 | }, | ||
107 | //////////////////////////////////////////////////////////////////// | ||
108 | //////////////////////////////////////////////////////////////////// | ||
109 | //////////////////////////////////////////////////////////////////// | ||
110 | //////////////////////////////////////////////////////////////////// | ||
111 | |||
112 | |||
113 | |||
114 | |||
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | |||
12 | /** Private Members **/ | 121 | /** Private Members **/ |
13 | _name: { value: null, enumerable: false }, | 122 | _name: { value: null, enumerable: false }, |
14 | _uri: { value: null, enumerable: false }, | 123 | _uri: { value: null, enumerable: false }, |
@@ -82,12 +191,14 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, { | |||
82 | value: function() { | 191 | value: function() { |
83 | // Have the XHR here? | 192 | // Have the XHR here? |
84 | } | 193 | } |
85 | }, | 194 | }/* |
195 | , | ||
86 | 196 | ||
87 | save:{ | 197 | save:{ |
88 | value:function(){ | 198 | value:function(){ |
89 | //base function - to be overridden | 199 | //base function - to be overridden |
90 | } | 200 | } |
91 | } | 201 | } |
202 | */ | ||
92 | 203 | ||
93 | }); \ No newline at end of file | 204 | }); \ No newline at end of file |