aboutsummaryrefslogtreecommitdiff
path: root/js/document/models
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-14 14:00:48 -0800
committerJose Antonio Marquez2012-02-14 14:00:48 -0800
commit93c8f327d662a7693d1d6ca050a0efd15ebc18ed (patch)
treeb3f9e8708977b740a72be24dfa1905d37317ae53 /js/document/models
parenta7952c5a16e2cae3fd1a459b03b9f16bba1004da (diff)
downloadninja-93c8f327d662a7693d1d6ca050a0efd15ebc18ed.tar.gz
Merging TextDocument into BaseDocument
Merged the text-document class with base-document, didn't make sense to have two classes for basic model of documents, the html-document class remain extending base-document to incorporate design view. These two classes might be renamed.
Diffstat (limited to 'js/document/models')
-rwxr-xr-xjs/document/models/base-document.js113
-rwxr-xr-xjs/document/models/text-document.js156
2 files changed, 112 insertions, 157 deletions
diff --git a/js/document/models/base-document.js b/js/document/models/base-document.js
index 918b51ad..45c340ce 100755
--- a/js/document/models/base-document.js
+++ b/js/document/models/base-document.js
@@ -9,6 +9,115 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
9var Montage = require("montage/core/core").Montage; 9var Montage = require("montage/core/core").Montage;
10 10
11var BaseDocument = exports.BaseDocument = Montage.create(Montage, { 11var 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
12 /** Private Members **/ 121 /** Private Members **/
13 _name: { value: null, enumerable: false }, 122 _name: { value: null, enumerable: false },
14 _uri: { value: null, enumerable: false }, 123 _uri: { value: null, enumerable: false },
@@ -82,12 +191,14 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
82 value: function() { 191 value: function() {
83 // Have the XHR here? 192 // Have the XHR here?
84 } 193 }
85 }, 194 }/*
195,
86 196
87 save:{ 197 save:{
88 value:function(){ 198 value:function(){
89 //base function - to be overridden 199 //base function - to be overridden
90 } 200 }
91 } 201 }
202*/
92 203
93}); \ No newline at end of file 204}); \ No newline at end of file
diff --git a/js/document/models/text-document.js b/js/document/models/text-document.js
deleted file mode 100755
index c0d4f256..00000000
--- a/js/document/models/text-document.js
+++ /dev/null
@@ -1,156 +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
7////////////////////////////////////////////////////////////////////////
8//
9var Montage = require("montage/core/core").Montage,
10 BaseDocument = require("js/document/models/base-document").BaseDocument;
11////////////////////////////////////////////////////////////////////////
12//
13exports.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