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 --- .../montage/ui/select-input.reel/select-input.js | 320 +++++++++++++++++++++ 1 file changed, 320 insertions(+) create mode 100644 node_modules/montage/ui/select-input.reel/select-input.js (limited to 'node_modules/montage/ui/select-input.reel/select-input.js') diff --git a/node_modules/montage/ui/select-input.reel/select-input.js b/node_modules/montage/ui/select-input.reel/select-input.js new file mode 100644 index 00000000..76de1a5a --- /dev/null +++ b/node_modules/montage/ui/select-input.reel/select-input.js @@ -0,0 +1,320 @@ +/* + 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").Montage, + Component = require("ui/component").Component, + ArrayController = require("ui/controller/array-controller").ArrayController, + NativeControl = require("ui/native-control").NativeControl; + +var STRING_CLASS = '[object String]'; +var _toString = Object.prototype.toString; + +var isString = function(object) { + return _toString.call(object) === STRING_CLASS; +}; + +var SelectInput = exports.SelectInput = Montage.create(NativeControl, { + + _fromInput: {value: null}, + + __selectedIndexes: {value: null, enumerable: false}, + _selectedIndexes: { + set: function(value) { + this.__selectedIndexes = value; + if(!this._fromInput) { + this.needsDraw = true; + } else { + this._fromInput = false; + } + }, + get: function() { + return this.__selectedIndexes; + } + }, + + //----------------------- + // Public API + //----------------------- + + _content: {value: null, enumerable: false}, + content: { + set: function(value) { + if(!Array.isArray(value)) { + value = [value]; + } + this._content = value; + + if(!this.contentController) { + var contentController = ArrayController.create(); + contentController.content = value; + this.contentController = contentController; + } + + this.needsDraw = true; + }, + get: function() { + return this._content; + } + }, + + // If contentController is provided, this allows the developer to specify + // which property in each element provides the "value" part of