diff options
author | Jose Antonio Marquez | 2012-02-16 11:30:33 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-16 11:30:33 -0800 |
commit | 9fe5d98bf469036c856e28d71ad4160d630b4af4 (patch) | |
tree | 930a334bcda0c26ca02eaa33a1506d147e8691e1 /js/document | |
parent | 89b5e793ea88ef235b54b6e1d1c379698d3e612b (diff) | |
parent | 71619045b692015b0889a4f5c381c1dee9c056cd (diff) | |
download | ninja-9fe5d98bf469036c856e28d71ad4160d630b4af4.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/controllers/base-controller.js | 32 | ||||
-rwxr-xr-x | js/document/html-document.js | 480 | ||||
-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, 803 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..ad5417a9 --- /dev/null +++ b/js/document/html-document.js | |||
@@ -0,0 +1,480 @@ | |||
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 | |||
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 | cssLoadInterval: { value: null, enumerable: false }, | ||
45 | |||
46 | _savedLeftScroll: {value:null}, | ||
47 | _savedTopScroll: {value:null}, | ||
48 | |||
49 | _codeViewDocument:{ | ||
50 | writable: true, | ||
51 | enumerable: true, | ||
52 | value:null | ||
53 | }, | ||
54 | |||
55 | |||
56 | |||
57 | // GETTERS / SETTERS | ||
58 | |||
59 | codeViewDocument:{ | ||
60 | get: function() { return this._codeViewDocument; }, | ||
61 | set: function(value) { this._codeViewDocument = value} | ||
62 | }, | ||
63 | |||
64 | savedLeftScroll:{ | ||
65 | get: function() { return this._savedLeftScroll; }, | ||
66 | set: function(value) { this._savedLeftScroll = value} | ||
67 | }, | ||
68 | |||
69 | savedTopScroll:{ | ||
70 | get: function() { return this._savedTopScroll; }, | ||
71 | set: function(value) { this._savedTopScroll = value} | ||
72 | }, | ||
73 | |||
74 | selectionExclude: { | ||
75 | get: function() { return this._selectionExclude; }, | ||
76 | set: function(value) { this._selectionExclude = value; } | ||
77 | }, | ||
78 | |||
79 | iframe: { | ||
80 | get: function() { return this._iframe; }, | ||
81 | set: function(value) { this._iframe = value; } | ||
82 | }, | ||
83 | |||
84 | server: { | ||
85 | get: function() { return this._server; }, | ||
86 | set: function(value) { this._server = value; } | ||
87 | }, | ||
88 | |||
89 | selectionModel: { | ||
90 | get: function() { return this._selectionModel; }, | ||
91 | set: function(value) { this._selectionModel = value; } | ||
92 | }, | ||
93 | |||
94 | undoModel: { | ||
95 | get: function() { return this._undoModel; }, | ||
96 | set: function(value) { this._undoModel.queue = value.queue; this._undoModel.position = value.position; } | ||
97 | }, | ||
98 | |||
99 | documentRoot: { | ||
100 | get: function() { return this._documentRoot; }, | ||
101 | set: function(value) { this._documentRoot = value; } | ||
102 | }, | ||
103 | |||
104 | stageBG: { | ||
105 | get: function() { return this._stageBG; }, | ||
106 | set: function(value) { this._stageBG = value; } | ||
107 | }, | ||
108 | |||
109 | elementCounter: { | ||
110 | set: function(value) { this._elementCounter = value; }, | ||
111 | get: function() { return this._elementCounter; } | ||
112 | }, | ||
113 | |||
114 | snapping: { | ||
115 | get: function() { return this._snapping; }, | ||
116 | set: function(value) { | ||
117 | if(this._snapping !== value) { | ||
118 | this._snapping = value; | ||
119 | } | ||
120 | } | ||
121 | }, | ||
122 | |||
123 | // TODO SEND THE EVENT --> Redraw the desired layout | ||
124 | layoutMode: { | ||
125 | get: function() { return this._layoutMode; }, | ||
126 | set: function(mode) { this._layoutMode = mode; } | ||
127 | }, | ||
128 | |||
129 | draw3DGrid: { | ||
130 | get: function() { return this._draw3DGrid; }, | ||
131 | set: function(value) { | ||
132 | if(this._draw3DGrid !== value) { | ||
133 | this._draw3DGrid = value; | ||
134 | } | ||
135 | } | ||
136 | }, | ||
137 | |||
138 | userComponents: { | ||
139 | get: function() { | ||
140 | return this._userComponents; | ||
141 | } | ||
142 | }, | ||
143 | // _drawUserComponentsOnOpen:{ | ||
144 | // value:function(){ | ||
145 | // for(var i in this._userComponentSet){ | ||
146 | // console.log(this._userComponentSet[i].control) | ||
147 | // this._userComponentSet[i].control.needsDraw = true; | ||
148 | // } | ||
149 | // } | ||
150 | // }, | ||
151 | |||
152 | glData: { | ||
153 | get: function() | ||
154 | { | ||
155 | var elt = this.iframe; | ||
156 | var elt = this.iframe.contentWindow.document.getElementById("UserContent"); | ||
157 | this._glData = null; | ||
158 | if (elt) | ||
159 | { | ||
160 | this._glData = new Array(); | ||
161 | this.collectGLData( elt, this._glData ); | ||
162 | } | ||
163 | |||
164 | return this._glData | ||
165 | }, | ||
166 | |||
167 | set: function(value) | ||
168 | { | ||
169 | var nWorlds = value.length; | ||
170 | for (var i=0; i<nWorlds; i++) | ||
171 | { | ||
172 | var importStr = value[i]; | ||
173 | var startIndex = importStr.indexOf( "id: " ); | ||
174 | if (startIndex >= 0) | ||
175 | { | ||
176 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
177 | if (endIndex > 0) | ||
178 | { | ||
179 | var id = importStr.substring( startIndex+4, endIndex ); | ||
180 | var canvas = this.iframe.contentWindow.document.getElementById( id ); | ||
181 | if (canvas) | ||
182 | { | ||
183 | if (!canvas.elementModel) | ||
184 | { | ||
185 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | ||
186 | } | ||
187 | |||
188 | if (canvas.elementModel) | ||
189 |