diff options
Diffstat (limited to 'js/document/models')
-rwxr-xr-x | js/document/models/base-document.js | 204 | ||||
-rwxr-xr-x | js/document/models/base-model.js | 32 | ||||
-rwxr-xr-x | js/document/models/html-document.js | 492 |
3 files changed, 32 insertions, 696 deletions
diff --git a/js/document/models/base-document.js b/js/document/models/base-document.js deleted file mode 100755 index 45c340ce..00000000 --- a/js/document/models/base-document.js +++ /dev/null | |||
@@ -1,204 +0,0 @@ | |||
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 | |||
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 | |||
121 | /** Private Members **/ | ||
122 | _name: { value: null, enumerable: false }, | ||
123 | _uri: { value: null, enumerable: false }, | ||
124 | _documentType: { value: null, enumerable: false }, | ||
125 | _container: {value: null, enumerable: false }, | ||
126 | _uuid: { value: null, enumerable: false }, | ||
127 | _isActive: { value: true, enumerable: false }, | ||
128 | _dirtyFlag: { value: false, enumerable: false }, | ||
129 | _callback: { value: null, enumerable: false }, | ||
130 | _currentView: { value: null, enumerable: false}, | ||
131 | |||
132 | /** Getters/Setters **/ | ||
133 | name: { | ||
134 | get: function() { return this._name; }, | ||
135 | set: function(value) { this._name = value; } | ||
136 | }, | ||
137 | |||
138 | uri: { | ||
139 | get: function() { return this._uri; }, | ||
140 | set: function(value) { this._uri = value; } | ||
141 | }, | ||
142 | |||
143 | documentType: { | ||
144 | get: function() { return this._documentType; }, | ||
145 | set: function(value) { this._documentType = value; } | ||
146 | }, | ||
147 | |||
148 | container: { | ||
149 | get: function() { return this._container; }, | ||
150 | set: function(value) { this._container = value; } | ||
151 | }, | ||
152 | |||
153 | uuid: { | ||
154 | get: function() { return this._uuid; }, | ||
155 | set: function(value) { this._uuid = value; } | ||
156 | }, | ||
157 | |||
158 | isActive: { | ||
159 | get: function() { return this._isActive; }, | ||
160 | set: function(value) { this._isActive = value; } | ||
161 | }, | ||
162 | |||
163 | dirtyFlag: { | ||
164 | get: function() { return this._dirtyFlag; }, | ||
165 | set: function(value) { this._dirtyFlag = value; } | ||
166 | }, | ||
167 | |||
168 | callback: { | ||
169 | get: function() { return this._callback; }, | ||
170 | set: function(value) { this._callback = value; } | ||
171 | }, | ||
172 | |||
173 | currentView: { | ||
174 | get: function() { return this._currentView; }, | ||
175 | set: function(value) { this._currentView = value } | ||
176 | }, | ||
177 | |||
178 | /** Base Methods **/ | ||
179 | init: { | ||
180 | value: function(name, uri, type, container, uuid, callback) { | ||
181 | this.name = name; | ||
182 | this.uri = uri; | ||
183 | this.documentType = type; | ||
184 | this.container = container; | ||
185 | this.uuid = uuid; | ||
186 | this.callback = callback; | ||
187 | } | ||
188 | }, | ||
189 | |||
190 | loadDocument: { | ||
191 | value: function() { | ||
192 | // Have the XHR here? | ||
193 | } | ||
194 | }/* | ||
195 | , | ||
196 | |||
197 | save:{ | ||
198 | value:function(){ | ||
199 | //base function - to be overridden | ||
200 | } | ||
201 | } | ||
202 | */ | ||
203 | |||
204 | }); \ No newline at end of file | ||
diff --git a/js/document/models/base-model.js b/js/document/models/base-model.js new file mode 100755 index 00000000..be441da2 --- /dev/null +++ b/js/document/models/base-model.js | |||
@@ -0,0 +1,32 @@ | |||
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 | //////////////////////////////////////////////////////////////////////// | ||
8 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component; | ||
11 | //////////////////////////////////////////////////////////////////////// | ||
12 | // | ||
13 | exports.ENTERNAME = Montage.create(Montage, { | ||
14 | //////////////////////////////////////////////////////////////////// | ||
15 | // | ||
16 | hasTemplate: { | ||
17 | enumerable: false, | ||
18 | value: false | ||
19 | }, | ||
20 | //////////////////////////////////////////////////////////////////// | ||
21 | // | ||
22 | deserializedFromTemplate: { | ||
23 | enumerable: false, | ||
24 | value: function () { | ||
25 | // | ||
26 | } | ||
27 | } | ||
28 | //////////////////////////////////////////////////////////////////// | ||
29 | ////// |