diff options
author | Ananya Sen | 2012-02-15 09:58:37 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-15 09:58:37 -0800 |
commit | a90e3be8850b64e8e370aa8ff8cadaa448dd0c82 (patch) | |
tree | e47dbf5dfd4a3e466cc97acbce21262b24cf89e7 | |
parent | 9048cd50bf5e0a418d1d95498bb593961f72db36 (diff) | |
download | ninja-a90e3be8850b64e8e370aa8ff8cadaa448dd0c82.tar.gz |
Revert "Cleaning up"
This reverts commit a7952c5a16e2cae3fd1a459b03b9f16bba1004da.
Conflicts:
js/controllers/document-controller.js
js/io/document/text-document.js
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-x | js/controllers/document-controller.js | 4 | ||||
-rwxr-xr-x | js/io/document/base-document.js (renamed from js/document/models/base-document.js) | 0 | ||||
-rwxr-xr-x | js/io/document/html-document.js (renamed from js/document/models/html-document.js) | 2 | ||||
-rwxr-xr-x | js/io/document/text-document.js | 156 |
4 files changed, 159 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 25f60cc5..9ece27f9 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -9,8 +9,8 @@ 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 | Component = require("montage/ui/component").Component, | 10 | Component = require("montage/ui/component").Component, |
11 | Uuid = require("montage/core/uuid").Uuid, | 11 | Uuid = require("montage/core/uuid").Uuid, |
12 | HTMLDocument = require("js/document/models/html-document").HTMLDocument, | 12 | HTMLDocument = require("js/io/document/html-document").HTMLDocument, |
13 | BaseDocument = require("js/document/models/base-document").BaseDocument, | 13 | TextDocument = require("js/io/document/text-document").TextDocument, |
14 | DocumentController; | 14 | DocumentController; |
15 | //////////////////////////////////////////////////////////////////////// | 15 | //////////////////////////////////////////////////////////////////////// |
16 | // | 16 | // |
diff --git a/js/document/models/base-document.js b/js/io/document/base-document.js index 45c340ce..45c340ce 100755 --- a/js/document/models/base-document.js +++ b/js/io/document/base-document.js | |||
diff --git a/js/document/models/html-document.js b/js/io/document/html-document.js index cb399f04..ac556c2d 100755 --- a/js/document/models/html-document.js +++ b/js/io/document/html-document.js | |||
@@ -7,7 +7,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
7 | //////////////////////////////////////////////////////////////////////// | 7 | //////////////////////////////////////////////////////////////////////// |
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var Montage = require("montage/core/core").Montage, |
10 | BaseDocument = require("js/document/models/base-document").BaseDocument, | 10 | BaseDocument = require("js/io/document/base-document").BaseDocument, |
11 | NJUtils = require("js/lib/NJUtils").NJUtils; | 11 | NJUtils = require("js/lib/NJUtils").NJUtils; |
12 | //////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////// |
13 | // | 13 | // |
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js new file mode 100755 index 00000000..87fcc551 --- /dev/null +++ b/js/io/document/text-document.js | |||
@@ -0,0 +1,156 @@ | |||
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 | BaseDocument = require("js/io/document/base-document").BaseDocument; | ||
11 | //////////////////////////////////////////////////////////////////////// | ||
12 | // | ||
13 | exports.TextDocument = Montage.create(BaseDocument, { | ||
14 | // PRIVATE MEMBERS | ||
15 | _codeEditor: { | ||
16 | value: { | ||
17 | "editor": { value: null, enumerable: false }, | ||
18 | |||
19 | } | ||
20 | }, | ||
21 | |||
22 | _editor: { value: null, enumerable: false }, | ||
23 | _hline: { value: null, enumerable: false }, | ||
24 | |||
25 | _textArea: {value: null, enumerable: false }, | ||
26 | |||
27 | _userDocument: {value: null, enumerable: false }, | ||
28 | |||
29 | _source: { value: null, enumerable: false}, | ||
30 | |||
31 | source: { | ||
32 | get: function() { return this._source;}, | ||
33 | set: function(value) { this._source = value;} | ||
34 | }, | ||
35 | |||
36 | // PUBLIC MEMBERS | ||
37 | |||
38 | _savedLeftScroll: {value:null}, | ||
39 | _savedTopScroll: {value:null}, | ||
40 | |||
41 | //****************************************// | ||
42 | //PUBLIC API | ||
43 | |||
44 | |||
45 | // GETTERS / SETTERS | ||
46 | |||
47 | savedLeftScroll:{ | ||
48 | get: function() { return this._savedLeftScroll; }, | ||
49 | set: function(value) { this._savedLeftScroll = value} | ||
50 | }, | ||
51 | |||
52 | savedTopScroll:{ | ||
53 | get: function() { return this._savedTopScroll; }, | ||
54 | set: function(value) { this._savedTopScroll = value} | ||
55 | }, | ||
56 | |||
57 | textArea: { | ||
58 | get: function() { return this._textArea; }, | ||
59 | set: function(value) { this._textArea = value; } | ||
60 | }, | ||
61 | editor: { | ||
62 | get: function() { return this._editor; }, | ||
63 | set: function(value) { this._editor = value} | ||
64 | }, | ||
65 | |||
66 | hline: { | ||
67 | get: function() { return this._hline; }, | ||
68 | set: function(value) {this._hline = value; } | ||
69 | }, | ||
70 | |||
71 | |||
72 | //////////////////////////////////////////////////////////////////// | ||
73 | // | ||
74 | initialize: { | ||
75 | value: function(file, uuid, textArea, container, callback) { | ||
76 | // | ||
77 | this._userDocument = file; | ||
78 | // | ||
79 | this.init(file.name, file.uri, file.extension, container, uuid, callback); | ||
80 | // | ||
81 | this.currentView = "code"; | ||
82 | this.textArea = textArea; | ||
83 | } | ||
84 | }, | ||
85 | //////////////////////////////////////////////////////////////////// | ||
86 | // | ||
87 | save: { | ||
88 | enumerable: false, | ||
89 | value: function () { | ||
90 | //TODO: Improve sequence | ||
91 | this.editor.save(); | ||
92 | return {mode: this._userDocument.extension, document: this._userDocument, content: this.textArea.value}; | ||
93 | } | ||
94 | } | ||
95 | //////////////////////////////////////////////////////////////////// | ||
96 | |||
97 | |||
98 | |||
99 | |||
100 | |||
101 | |||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | /* | ||
108 | // PRIVATE METHODS | ||
109 | _loadContent: { | ||
110 | value: function() { | ||
111 | // Start and AJAX call to load the HTML Document as a String | ||
112 | var xhr = new XMLHttpRequest(); | ||
113 | var ref = this; | ||
114 | |||
115 | xhr.onreadystatechange = function() { | ||
116 | if (xhr.readyState == 4) { | ||
117 | ref.source = xhr.responseText; | ||
118 | ref.textArea.innerHTML = xhr.responseText; | ||
119 | //ref.callback(xhr.responseText); | ||
120 | ref.callback(ref); | ||
121 | } | ||
122 | }; | ||
123 | |||
124 | if(this.documentType === "js") { | ||
125 | xhr.open('GET', 'user-document-templates/montage-application-cloud/appdelegate.js'); | ||
126 | } else if(this.documentType === "css") { | ||
127 | xhr.open('GET', 'user-document-templates/montage-application-cloud/default_html.css'); | ||
128 | } else { | ||
129 | xhr.open('GET', 'user-document-templates/montage-application-cloud/index.html'); | ||
130 | } | ||
131 | |||
132 | xhr.send(''); | ||
133 | } | ||
134 | }, | ||
135 | */ | ||
136 | //////////////////////////////////////////////////////////////////// | ||
137 | |||
138 | |||
139 | /** | ||
140 | * public method | ||
141 | */ | ||
142 | /* | ||
143 | save:{ | ||
144 | value:function(){ | ||
145 | try{ | ||
146 | this.editor.save(); | ||
147 | //persist textArea.value to filesystem | ||
148 | this.dirtyFlag=false; | ||
149 | }catch(e){ | ||
150 | console.log("Error while saving "+this.uri); | ||
151 | console.log(e.stack); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | */ | ||
156 | }); \ No newline at end of file | ||