aboutsummaryrefslogtreecommitdiff
path: root/js/io/document/text-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/document/text-document.js')
-rw-r--r--js/io/document/text-document.js91
1 files changed, 0 insertions, 91 deletions
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
deleted file mode 100644
index 3506891a..00000000
--- a/js/io/document/text-document.js
+++ /dev/null
@@ -1,91 +0,0 @@
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
7var Montage = require("montage/core/core").Montage;
8var baseDocumentModule = require("js/io/document/base-document");
9
10
11var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.BaseDocument, {
12 // PRIVATE MEMBERS
13 _codeEditor: {
14 value: {
15 "editor": { value: null, enumerable: false },
16 "hline": { value: null, enumerable: false }
17 }
18 },
19
20 _textArea: { value: null, enumerable: false },
21
22 // Temporary Save the source
23 _source: { value: null, enumerable: false},
24
25 textArea: {
26 get: function() { return this._textArea;},
27 set: function(value) { this._textArea = value; }
28 },
29
30 source: {
31 get: function() { return this._source;},
32 set: function(value) { this._source = value;}
33 },
34
35 // PUBLIC MEMBERS
36
37 //****************************************//
38 //PUBLIC API
39
40
41 // GETTERS / SETTERS
42 editor: {
43 get: function() { return this._codeEditor.editor; },
44 set: function(value) { this._codeEditor.editor = value}
45 },
46
47 hline: {
48 get: function() { return this._codeEditor.hline; },
49 set: function(value) {this._codeEditor.hline = value; }
50 },
51
52
53 // PUBLIC METHODS
54 initialize: {
55 value: function(doc, uuid, textArea, callback) {
56 this.init(doc.name, doc.uri, doc.type, textArea, uuid, callback);
57 this.textArea = textArea.firstChild;
58 this.currentView = "code";
59 this._loadContent();
60 }
61 },
62
63 // PRIVATE METHODS
64 _loadContent: {
65 value: function() {
66 // Start and AJAX call to load the HTML Document as a String
67 var xhr = new XMLHttpRequest();
68 var ref = this;
69
70 xhr.onreadystatechange = function() {
71 if (xhr.readyState == 4) {
72 ref.source = xhr.responseText;
73 ref.textArea.innerHTML = xhr.responseText;
74 //ref.callback(xhr.responseText);
75 ref.callback(ref);
76 }
77 };
78
79 if(this.documentType === "js") {
80 xhr.open('GET', 'user-document-templates/montage-application-cloud/appdelegate.js');
81 } else if(this.documentType === "css") {
82 xhr.open('GET', 'user-document-templates/montage-application-cloud/default_html.css');
83 } else {
84 xhr.open('GET', 'user-document-templates/montage-application-cloud/index.html');
85 }
86
87 xhr.send('');
88 }
89 }
90
91}); \ No newline at end of file