diff options
author | Pushkar Joshi | 2012-05-31 17:16:21 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-05-31 17:16:21 -0700 |
commit | 8915a7109d918a2e69b0999ebaa2deb84811fef8 (patch) | |
tree | 19a8af74c58c9ea261f0842f36efdab959be3256 /js/document/_toDelete/text-document.js | |
parent | eea0a556e44c2b60d3aaf6e46d2432d3e6303812 (diff) | |
parent | 06b609df1ff7833592faddbd8d7abb5b9f15a74d (diff) | |
download | ninja-8915a7109d918a2e69b0999ebaa2deb84811fef8.tar.gz |
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/document/_toDelete/text-document.js')
-rwxr-xr-x | js/document/_toDelete/text-document.js | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/js/document/_toDelete/text-document.js b/js/document/_toDelete/text-document.js new file mode 100755 index 00000000..2574b67c --- /dev/null +++ b/js/document/_toDelete/text-document.js | |||
@@ -0,0 +1,198 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | |||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component; | ||
11 | |||
12 | var 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 | _needsSave: { value: false, enumarable: 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 | needsSave: { | ||
165 | get: function() { return this._needsSave; }, | ||
166 | set: function(value) { | ||
167 | this._needsSave = value; | ||
168 | } | ||
169 | }, | ||
170 | |||
171 | callback: { | ||
172 | get: function() { return this._callback; }, | ||
173 | set: function(value) { this._callback = value; } | ||
174 | }, | ||
175 | |||
176 | currentView: { | ||
177 | get: function() { return this._currentView; }, | ||
178 | set: function(value) { this._currentView = value } | ||
179 | }, | ||
180 | |||
181 | /** Base Methods **/ | ||
182 | init: { | ||
183 | value: function(name, uri, type, container, uuid, callback) { | ||
184 | this.name = name; | ||
185 | this.uri = uri; | ||
186 | this.documentType = type; | ||
187 | this.container = container; | ||
188 | this.uuid = uuid; | ||
189 | this.callback = callback; | ||
190 | } | ||
191 | }, | ||
192 | |||
193 | loadDocument: { | ||
194 | value: function() { | ||
195 | // Have the XHR here? | ||
196 | } | ||
197 | } | ||
198 | }); \ No newline at end of file | ||