diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/controllers/base-controller.js | 32 | ||||
-rwxr-xr-x | js/document/html-document.js | 500 | ||||
-rwxr-xr-x | js/document/mediators/base-mediator.js | 32 | ||||
-rwxr-xr-x | js/document/models/base-model.js | 32 | ||||
-rwxr-xr-x | js/document/text-document.js | 195 | ||||
-rwxr-xr-x | js/document/views/base-view.js | 32 |
6 files changed, 823 insertions, 0 deletions
diff --git a/js/document/controllers/base-controller.js b/js/document/controllers/base-controller.js new file mode 100755 index 00000000..be441da2 --- /dev/null +++ b/js/document/controllers/base-controller.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 | //////////////////////////////////////////////////////////////////// | ||
30 | }); | ||
31 | //////////////////////////////////////////////////////////////////////// | ||
32 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | ||
diff --git a/js/document/html-document.js b/js/document/html-document.js new file mode 100755 index 00000000..bf9bba76 --- /dev/null +++ b/js/document/html-document.js | |||
@@ -0,0 +1,500 @@ | |||
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 | TextDocument = require("js/document/text-document").TextDocument, | ||
11 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
12 | //////////////////////////////////////////////////////////////////////// | ||
13 | // | ||
14 | exports.HTMLDocument = Montage.create(TextDocument, { | ||
15 | // PRIVATE MEMBERS | ||
16 | _selectionExclude: { value: null, enumerable: false }, | ||
17 | _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, | ||
18 | _iframe: { value: null, enumerable: false }, | ||
19 | _server: { value: null, enumerable: false }, | ||
20 | _templateDocument: { value: null, enumerable: false }, | ||
21 | _selectionModel: { value: [], enumerable: false }, | ||
22 | _undoModel: { value: { "queue" : [], "position" : 0 }, enumerable: false}, | ||
23 | |||
24 | _document: { value: null, enumerable: false }, | ||
25 | _documentRoot: { value: null, enumerable: false }, | ||
26 | _stageBG: { value: null, enumerable: false }, | ||
27 | _window: { value: null, enumerable: false }, | ||
28 | _styles: { value: null, enumerable: false }, | ||
29 | _stylesheets: { value: null, enumerable: false }, | ||
30 | _stageStyleSheetId : { value: 'nj-stage-stylesheet', enumerable: false }, | ||
31 | _userDocument: { value: null, enumerable: false }, | ||
32 | _htmlSource: {value: "<html></html>", enumerable: false}, | ||
33 | _glData: {value: null, enumerable: false }, | ||
34 | _userComponents: { value: {}, enumarable: false}, | ||
35 | |||
36 | _elementCounter: { value: 1, enumerable: false }, | ||
37 | _snapping : { value: true, enumerable: false }, | ||
38 | _layoutMode: { value: "all", enumerable: false }, | ||
39 | _draw3DGrid: { value: false, writable: true }, | ||
40 | _swfObject: { value: false, enumerable: false }, | ||
41 | |||
42 | _zoomFactor: { value: 100, enumerable: false }, | ||
43 | |||
44 | // PUBLIC MEMBERS | ||
45 | cssLoadInterval: { value: null, enumerable: false }, | ||
46 | |||
47 | _savedLeftScroll: {value:null}, | ||
48 | _savedTopScroll: {value:null}, | ||
49 | |||
50 | _codeViewDocument:{ | ||
51 | writable: true, | ||
52 | enumerable: true, | ||
53 | value:null | ||
54 | }, | ||
55 | |||
56 | /* | ||
57 | * PUBLIC API | ||
58 | */ | ||
59 | |||
60 | // GETTERS / SETTERS | ||
61 | |||
62 | codeViewDocument:{ | ||
63 | get: function() { return this._codeViewDocument; }, | ||
64 | set: function(value) { this._codeViewDocument = value} | ||
65 | }, | ||
66 | |||
67 | savedLeftScroll:{ | ||
68 | get: function() { return this._savedLeftScroll; }, | ||
69 | set: function(value) { this._savedLeftScroll = value} | ||
70 | }, | ||
71 | |||
72 | savedTopScroll:{ | ||
73 | get: function() { return this._savedTopScroll; }, | ||
74 | set: function(value) { this._savedTopScroll = value} | ||
75 | }, | ||
76 | |||
77 | selectionExclude: { | ||
78 | get: function() { return this._selectionExclude; }, | ||
79 | set: function(value) { this._selectionExclude = value; } | ||
80 | }, | ||
81 | |||
82 | iframe: { | ||
83 | get: function() { return this._iframe; }, | ||
84 | set: function(value) { this._iframe = value; } | ||
85 | }, | ||
86 | |||
87 | server: { | ||
88 | get: function() { return this._server; }, | ||
89 | set: function(value) { this._server = value; } | ||
90 | }, | ||
91 | |||
92 | selectionModel: { | ||
93 | get: function() { return this._selectionModel; }, | ||
94 | set: function(value) { this._selectionModel = value; } | ||
95 | }, | ||
96 | |||
97 | undoModel: { | ||
98 | get: function() { return this._undoModel; }, | ||
99 | set: function(value) { this._undoModel.queue = value.queue; this._undoModel.position = value.position; } | ||
100 | }, | ||
101 | |||
102 | documentRoot: { | ||
103 | get: function() { return this._documentRoot; }, | ||
104 | set: function(value) { this._documentRoot = value; } | ||
105 | }, | ||
106 | |||
107 | stageBG: { | ||
108 | get: function() { return this._stageBG; }, | ||
109 | set: function(value) { this._stageBG = value; } | ||
110 | }, | ||
111 | |||
112 | elementCounter: { | ||
113 | set: function(value) { this._elementCounter = value; }, | ||
114 | get: function() { return this._elementCounter; } | ||
115 | }, | ||
116 | |||
117 | snapping: { | ||
118 | get: function() { return this._snapping; }, | ||
119 | set: function(value) { | ||
120 | if(this._snapping !== value) { | ||
121 | this._snapping = value; | ||
122 | } | ||
123 | } | ||
124 | }, | ||
125 | |||
126 | // TODO SEND THE EVENT --> Redraw the desired layout | ||
127 | layoutMode: { | ||
128 | get: function() { return this._layoutMode; }, | ||
129 | set: function(mode) { this._layoutMode = mode; } | ||
130 | }, | ||
131 | |||
132 | draw3DGrid: { | ||
133 | get: function() { return this._draw3DGrid; }, | ||
134 | set: function(value) { | ||
135 | if(this._draw3DGrid !== value) { | ||
136 | this._draw3DGrid = value; | ||
137 | } | ||
138 | } | ||
139 | }, | ||
140 | |||
141 | userComponents: { | ||
142 | get: function() { | ||
143 | return this._userComponents; | ||
144 | } | ||
145 | }, | ||
146 | // _drawUserComponentsOnOpen:{ | ||
147 | // value:function(){ | ||
148 | // for(var i in this._userComponentSet){ | ||
149 | // console.log(this._userComponentSet[i].control) | ||
150 | // this._userComponentSet[i].control.needsDraw = true; | ||
151 | // } | ||
152 | // } | ||
153 | // }, | ||
154 | |||
155 | glData: { | ||
156 | get: function() | ||
157 | { | ||
158 | var elt = this.iframe; | ||
159 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); | ||
160 | this._glData = null; | ||
161 | if (elt) | ||
162 | { | ||
163 | this._glData = new Array(); | ||
164 | this.collectGLData( elt, this._glData ); | ||
165 | } | ||
166 | |||
167 | return this._glData | ||
168 | }, | ||
169 | |||
170 | set: function(value) | ||
171 | { | ||
172 | var nWorlds = value.length; | ||
173 | for (var i=0; i<nWorlds; i++) | ||
174 | { | ||
175 | var importStr = value[i]; | ||
176 | var startIndex = importStr.indexOf( "id: " ); | ||
177 | if (startIndex >= 0) | ||
178 | { | ||
179 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
180 | if (endIndex > 0) | ||
181 | { | ||
182 | var id = importStr.substring( startIndex+4, endIndex ); | ||
183 | var canvas = this.iframe.contentWindow.document.getElementById( id ); | ||
184 | if (canvas) | ||
185 | { | ||
186 | if (!canvas.elementModel) | ||
187 | { | ||
188 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | ||
189 | } | ||
190 | |||
191 | if (canvas.elementModel) | ||
192 | { | ||
193 | if (canvas.elementModel.shapeModel.GLWorld) | ||