aboutsummaryrefslogtreecommitdiff
path: root/js/io/document/html-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/document/html-document.js')
-rwxr-xr-xjs/io/document/html-document.js500
1 files changed, 0 insertions, 500 deletions
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js
deleted file mode 100755
index 88cfec67..00000000
--- a/js/io/document/html-document.js
+++ /dev/null
@@ -1,500 +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/io/document/base-document").BaseDocument,
11 NJUtils = require("js/lib/NJUtils").NJUtils;
12////////////////////////////////////////////////////////////////////////
13//
14exports.HTMLDocument = Montage.create(BaseDocument, {
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)
194 canvas.elementModel.shapeModel.GLWorld.clearTree();
195
196 var world = new GLWorld( canvas );
197 canvas.elementModel.shapeModel.GLWorld = world;
198 world.import( importStr );
199 }
200 }
201 }
202 }
203 }
204 }
205 },
206
207 zoomFactor: {
208 get: function() { return this._zoomFactor; },
209 set: function(value) { this._zoomFactor = value; }
210 },
211
212 /**
213 * Add a reference to a component instance to the userComponents hash using the
214 * element UUID
215 */
216 setComponentInstance: {
217 value: function(instance, el) {
218 this.userComponents[el.uuid] = instance;
219 }
220 },
221
222 /**
223 * Returns the component instance obj from the element
224 */
225 getComponentFromElement: {
226 value: function(el) {
227 if(el) {
228 if(el.uuid) return this.userComponents[el.uuid];
229 } else {
230 return null;
231 }
232 }
233 },
234
235 //****************************************//
236 // PUBLIC METHODS
237
238