aboutsummaryrefslogtreecommitdiff
path: root/js/document/text-document.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-20 11:14:44 -0800
committerNivesh Rajbhandari2012-02-20 11:14:44 -0800
commitabf78e2d7a97d295ce5a1c425fd359d47379137e (patch)
treed08c91bd2aef31e6325e0b499b2ffc390018bec6 /js/document/text-document.js
parente80a79bff57fecf3aa9b869d8ed2de5fd815287c (diff)
parente23708721a71ca4c71365f5f8e8ac7d6113926db (diff)
downloadninja-abf78e2d7a97d295ce5a1c425fd359d47379137e.tar.gz
Merge branch 'refs/heads/ninja-internal' into ToolFixes
Diffstat (limited to 'js/document/text-document.js')
-rwxr-xr-xjs/document/text-document.js196
1 files changed, 196 insertions, 0 deletions
diff --git a/js/document/text-document.js b/js/document/text-document.js
new file mode 100755
index 00000000..3e20e1f6
--- /dev/null
+++ b/js/document/text-document.js
@@ -0,0 +1,196 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7//BaseDocument Object for all files types and base class for HTML documents.
8
9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component;
11
12var TextDocument = exports.TextDocument = Montage.create(Component, {
13
14
15 //TODO: Clean up, test
16
17
18
19
20
21 ////////////////////////////////////////////////////////////////////
22 ////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////
24 ////////////////////////////////////////////////////////////////////
25 //Taken from text-document, which shouldn't be needed
26
27 // PRIVATE MEMBERS
28 _codeEditor: {
29 value: {
30 "editor": { value: null, enumerable: false },
31
32 }
33 },
34
35 _editor: { value: null, enumerable: false },
36 _hline: { value: null, enumerable: false },
37
38 _textArea: {value: null, enumerable: false },
39
40 _userDocument: {value: null, enumerable: false },
41
42 _source: { value: null, enumerable: false},
43
44 source: {
45 get: function() { return this._source;},
46 set: function(value) { this._source = value;}
47 },
48
49 // PUBLIC MEMBERS
50
51 _savedLeftScroll: {value:null},
52 _savedTopScroll: {value:null},
53
54 //****************************************//
55 //PUBLIC API
56
57
58 // GETTERS / SETTERS
59
60 savedLeftScroll:{
61 get: function() { return this._savedLeftScroll; },
62 set: function(value) { this._savedLeftScroll = value}
63 },
64
65 savedTopScroll:{
66 get: function() { return this._savedTopScroll; },
67 set: function(value) { this._savedTopScroll = value}
68 },
69
70 textArea: {
71 get: function() { return this._textArea; },
72 set: function(value) { this._textArea = value; }
73 },
74 editor: {
75 get: function() { return this._editor; },
76 set: function(value) { this._editor = value}
77 },
78
79 hline: {
80 get: function() { return this._hline; },
81 set: function(value) {this._hline = value; }
82 },
83
84
85 ////////////////////////////////////////////////////////////////////
86 //
87 initialize: {
88 value: function(file, uuid, textArea, container, callback) {
89 //
90 this._userDocument = file;
91 //
92 this.init(file.name, file.uri, file.extension, container, uuid, callback);
93 //
94 this.currentView = "code";
95 this.textArea = textArea;
96 }
97 },
98 ////////////////////////////////////////////////////////////////////
99 //
100 save: {
101 enumerable: false,
102 value: function () {
103 //TODO: Improve sequence
104 this.editor.save();
105 return {mode: this._userDocument.extension, document: this._userDocument, content: this.textArea.value};
106 }
107 },
108 ////////////////////////////////////////////////////////////////////
109 ////////////////////////////////////////////////////////////////////
110 ////////////////////////////////////////////////////////////////////
111 ////////////////////////////////////////////////////////////////////
112
113
114
115
116
117
118
119
120
121
122 /** Private Members **/
123 _name: { value: null, enumerable: false },
124 _uri: { value: null, enumerable: false },
125 _documentType: { value: null, enumerable: false },
126 _container: {value: null, enumerable: false },
127 _uuid: { value: null, enumerable: false },
128 _isActive: { value: true, enumerable: false },
129 _dirtyFlag: { value: false, enumerable: false },
130 _callback: { value: null, enumerable: false },
131 _currentView: { value: null, enumerable: false},
132
133 /** Getters/Setters **/
134 name: {
135 get: function() { return this._name; },
136 set: function(value) { this._name = value; }
137 },
138
139 uri: {
140 get: function() { return this._uri; },
141 set: function(value) { this._uri = value; }
142 },
143
144 documentType: {
145 get: function() { return this._documentType; },
146 set: function(value) { this._documentType = value; }
147 },
148
149 container: {
150 get: function() { return this._container; },
151 set: function(value) { this._container = value; }
152 },
153
154 uuid: {
155 get: function() { return this._uuid; },
156 set: function(value) { this._uuid = value; }
157 },
158
159 isActive: {
160 get: function() { return this._isActive; },
161 set: function(value) { this._isActive = value; }
162 },
163
164 dirtyFlag: {
165 get: function() { return this._dirtyFlag; },
166 set: function(value) { this._dirtyFlag = value; }
167 },
168
169 callback: {
170 get: function() { return this._callback; },
171 set: function(value) { this._callback = value; }
172 },
173
174 currentView: {
175 get: function() { return this._currentView; },
176 set: function(value) { this._currentView = value }
177 },
178
179 /** Base Methods **/
180 init: {
181 value: function(name, uri, type, container, uuid, callback) {
182 this.name = name;
183 this.uri = uri;
184 this.documentType = type;
185 this.container = container;
186 this.uuid = uuid;
187 this.callback = callback;
188 }
189 },
190
191 loadDocument: {
192 value: function() {
193 // Have the XHR here?
194 }
195 }
196}); \ No newline at end of file