From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- js/components/ui/input-group.reel/input-group.js | 85 ++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 js/components/ui/input-group.reel/input-group.js (limited to 'js/components/ui/input-group.reel/input-group.js') diff --git a/js/components/ui/input-group.reel/input-group.js b/js/components/ui/input-group.reel/input-group.js new file mode 100644 index 00000000..456a146c --- /dev/null +++ b/js/components/ui/input-group.reel/input-group.js @@ -0,0 +1,85 @@ +/* +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. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +var InputGroup = exports.InputGroup = Montage.create(Component, { + + forwardEvent: + { + value: function(event) + { + if(event.type === "propertyChanging") + { + this._handlePropertyChanging(event); + } + else + { + this._handlePropertyChange(event); + } + } + }, + + _handlePropertyChanging: + { + value: function(event) + { + this._dispatchPropEvent(event); + } + }, + + _handlePropertyChange: + { + value: function(event) + { + this._dispatchPropEvent(event); + } + }, + + _dispatchPropEvent: { + value: function(event) { + var propEvent = document.createEvent("CustomEvent"); + if(event.type === "propertyChanging") + { + propEvent.initEvent("changing", true, true); + propEvent.type = "changing"; + } + else + { + propEvent.initEvent("change", true, true); + propEvent.type = "change"; + } + propEvent.propertyLabel = event.propertyLabel; + propEvent.propertyValue = event.propertyValue; + propEvent.propertyEvent = event; + + this.dispatchEvent(propEvent); + } + }, + + value: { + enumerable: true, + serializable: true, + get: function () { + var retObject = {}; + for(var i=0, len=this.controlsList.childComponents.length; i< len; i++) + { + var childControl = this.controlsList.childComponents[i]; + retObject[childControl.label] = childControl._control[childControl._prop]; + } + return retObject; + + } + }, + + controlsList: { + enumerable: true, + serializable: true, + value: null + } + +}); -- cgit v1.2.3