From a3024011a91d3941f81481dd4d600e9684eb0fd4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 2 Feb 2012 00:11:51 -0800 Subject: upgrading to Montage v0.6 Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/composer/composer.js | 142 +++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 node_modules/montage/ui/composer/composer.js (limited to 'node_modules/montage/ui/composer/composer.js') diff --git a/node_modules/montage/ui/composer/composer.js b/node_modules/montage/ui/composer/composer.js new file mode 100644 index 00000000..2f91bb22 --- /dev/null +++ b/node_modules/montage/ui/composer/composer.js @@ -0,0 +1,142 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + @module montage/ui/event/composer/composer + @requires montage +*/ +var Montage = require("montage").Montage; +/** + @class module:montage/ui/composer/composer.Composer + @extends module:montage.Montage + */ +exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer/composer.Composer# */ { + + _component: { + value: null + }, + + component: { + get: function() { + return this._component; + }, + set: function(component) { + this._component = component; + } + }, + + _element: { + value: null + }, + + element: { + get: function() { + return this._element; + }, + set: function(element) { + this._element = element; + } + }, + + _needsFrame: { + value: false + }, + + /** + This property should be set to true when this composer wants to have its + frame method executed during the next draw cycle. Setting this property + to true will cause a draw cycle to be scheduled iff one is not already + scheduled. + */ + needsFrame: { + set: function(value) { + if (this._needsFrame !== value) { + this._needsFrame = value; + if (this._component) { + if (value) { + this._component.scheduleComposer(this); + } + } + } + }, + get: function() { + return this._needsFrame; + } + }, + + /** + This method will be invoked by the framework at the beginning of a draw cycle. This is the method where + a composer should implement its update logic. + @param {Date} timestamp time that the draw cycle started + */ + frame: { + value: function(timestamp) { + + } + }, + + + /* + Invoked by the framework to default the composer's element to the component's element if necessary. + @private + */ + _resolveDefaults: { + value: function() { + if (this.element == null) { + if (this.component != null) { + this.element = this.component.element; + } + } + } + }, + + /* + Invoked by the framework to load this composer + @private + */ + _load: { + value: function() { + if (!this.element) { + this._resolveDefaults(); + } + this.load(); + } + }, + + /** + Called when a composer should be loaded. Any event listeners that the composer needs to install should + be installed in this method. + @function + */ + load: { + value: function() { + + } + }, + + /** + Called when a component removes a composer. Any event listeners that the composer needs to remove should + be removed in this method and any additional cleanup should be performed. + @function + */ + unload: { + value: function() { + + } + }, + + /* + Called when a composer is part of a template serialization. It's responsible for calling addComposer on + the component. + */ + deserializedFromTemplate: { + value: function() { + if (this.component) { + this.component.addComposer(this); + } + } + } + +}); -- cgit v1.2.3