diff options
Diffstat (limited to 'node_modules/montage/ui/component-placeholder.reel')
-rwxr-xr-x | node_modules/montage/ui/component-placeholder.reel/component-placeholder.js | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/node_modules/montage/ui/component-placeholder.reel/component-placeholder.js b/node_modules/montage/ui/component-placeholder.reel/component-placeholder.js deleted file mode 100755 index 784172e0..00000000 --- a/node_modules/montage/ui/component-placeholder.reel/component-placeholder.js +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
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 | @module "montage/ui/component-placeholder.reel" | ||
8 | @requires montage/core/core | ||
9 | @requires montage/ui/component | ||
10 | @requires core/logger | ||
11 | */ | ||
12 | var Montage = require("montage").Montage; | ||
13 | var Component = require("ui/component").Component; | ||
14 | var logger = require("core/logger").logger("componentplaceholder"); | ||
15 | /** | ||
16 | @class module:"montage/ui/component-placeholder.reel".ComponentPlaceHolder | ||
17 | */ | ||
18 | |||
19 | var ComponentPlaceHolder = exports.ComponentPlaceHolder = Montage.create(Component, /** @lends module:"montage/ui/component-placeholder.reel".ComponentPlaceHolder */ { | ||
20 | |||
21 | hasTemplate: {value: false}, | ||
22 | |||
23 | name: {value: null}, | ||
24 | /** | ||
25 | Description TODO | ||
26 | @private | ||
27 | */ | ||
28 | _component: { | ||
29 | serializable: true, | ||
30 | enumerable: false, | ||
31 | value: null | ||
32 | }, | ||
33 | /** | ||
34 | Description TODO | ||
35 | @private | ||
36 | */ | ||
37 | _prepareForDraw: {value: function() { | ||
38 | if (this.element) { | ||
39 | this._replaceElementWithTemplate(); | ||
40 | } | ||
41 | }}, | ||
42 | /** | ||
43 | Description TODO | ||
44 | @function | ||
45 | @returns this._component.draw.apply(this._component, arguments) | ||
46 | */ | ||
47 | draw: {value: function() { | ||
48 | return this._component.draw.apply(this._component, arguments); | ||
49 | }}, | ||
50 | /** | ||
51 | Description TODO | ||
52 | @type {Property} | ||
53 | @default {Boolean} true | ||
54 | */ | ||
55 | hasTemplate: { | ||
56 | value: true | ||
57 | }, | ||
58 | |||
59 | // TODO: Remove when old serialization is gone | ||
60 | /** | ||
61 | Description TODO | ||
62 | @function | ||
63 | @param {Component} visitor The visitor component. | ||
64 | @param {Object} callback The callback object. | ||
65 | */ | ||
66 | traverseComponentTree: {value: function(visitor, callback) { | ||
67 | var self = this; | ||
68 | var innerComponent = this._component; | ||
69 | |||
70 | if (this._isComponentExpanded) { | ||
71 | if (visitor) { | ||
72 | visitor(this); | ||
73 | } | ||
74 | this._component.traverseComponentTree.apply(this._component, arguments); | ||
75 | } else { | ||
76 | this.expandComponent(function() { | ||
77 | if (visitor) { | ||
78 | visitor(self); | ||
79 | } | ||
80 | self._component.traverseComponentTree(visitor, callback); | ||
81 | }); | ||
82 | } | ||
83 | }}, | ||
84 | /** | ||
85 | Description TODO | ||
86 | @private | ||
87 | */ | ||
88 | _replaceElementWithTemplate: {value: function() { | ||
89 | var component = this._component, | ||
90 | element = this.element, | ||
91 | componentElement = component.element, | ||
92 | attributes = element.attributes, | ||
93 | attribute, attributeName, value; | ||
94 | |||
95 | for (var i = 0; (attribute = attributes[i]); i++) { | ||
96 | attributeName = attribute.nodeName; | ||
97 | if (attributeName === "id") { | ||
98 | continue; | ||
99 | } | ||
100 | value = (componentElement.getAttribute(attributeName) || "") + " " + attribute.nodeValue; | ||
101 | componentElement.setAttribute(attributeName, value); | ||
102 | } | ||
103 | |||
104 | element.parentNode.replaceChild(componentElement, element); | ||
105 | |||
106 | this._element = null; | ||
107 | // check to see if the hosted component hasn't replaced its element yet, if not do it now. | ||
108 | if (component._templateElement) { | ||
109 | component._replaceElementWithTemplate(); | ||
110 | } | ||
111 | }}, | ||
112 | |||
113 | // TODO: Add when old serialization is gone | ||
114 | //deserializedFromTemplate: {value: function() { | ||
115 | // this._component = this.parentComponent[this.name]; | ||
116 | //}}, | ||
117 | |||
118 | // TODO: Remove when old serialization is gone | ||
119 | /** | ||
120 | Description TODO | ||
121 | @function | ||
122 | @param {Object} callback The callback object. | ||
123 | @returns self._component.loadComponentTree(callback) | ||
124 | */ | ||
125 | loadComponentTree: {value: function(callback) { | ||
126 | var self = this; | ||
127 | Component.loadComponentTree.call(this, function() { | ||
128 | self._component._cachedParentComponent = self._cachedParentComponent; | ||
129 | return self._component.loadComponentTree(callback); | ||
130 | }); | ||
131 | }}, | ||
132 | |||
133 | // TODO: Remove when old serialization is gone | ||
134 | /** | ||
135 | Description TODO | ||
136 | @function | ||
137 | @param {Object} callback The callback object. | ||
138 | @returns this._component.expandComponent.apply(this._component, arguments) | ||
139 | */ | ||
140 | expandComponent: {value: function(callback) { | ||
141 | this._component = this.parentComponent[this.name]; | ||
142 | this._isComponentExpanded = true; | ||
143 | |||
144 | return this._component.expandComponent.apply(this._component, arguments); | ||
145 | }} | ||
146 | }); | ||