From 6dfe2e62b1d7a71daf097aac3a31213d564e6122 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 00:54:30 -0700 Subject: Removing the old checkbox components. Created a new LabelCheckbox Signed-off-by: Valerio Virgillito --- js/components/checkbox.reel/checkbox.html | 23 ---- js/components/checkbox.reel/checkbox.js | 120 --------------------- .../ui/label-checkbox.reel/label-checkbox.css | 9 ++ .../ui/label-checkbox.reel/label-checkbox.html | 54 ++++++++++ .../ui/label-checkbox.reel/label-checkbox.js | 67 ++++++++++++ .../ui/property-control.reel/property-control.js | 2 +- js/panels/properties.reel/properties.css | 8 +- .../properties.reel/sections/custom.reel/custom.js | 8 +- 8 files changed, 139 insertions(+), 152 deletions(-) delete mode 100755 js/components/checkbox.reel/checkbox.html delete mode 100755 js/components/checkbox.reel/checkbox.js create mode 100644 js/components/ui/label-checkbox.reel/label-checkbox.css create mode 100755 js/components/ui/label-checkbox.reel/label-checkbox.html create mode 100755 js/components/ui/label-checkbox.reel/label-checkbox.js (limited to 'js') diff --git a/js/components/checkbox.reel/checkbox.html b/js/components/checkbox.reel/checkbox.html deleted file mode 100755 index ded91fc2..00000000 --- a/js/components/checkbox.reel/checkbox.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/js/components/checkbox.reel/checkbox.js b/js/components/checkbox.reel/checkbox.js deleted file mode 100755 index be331f4e..00000000 --- a/js/components/checkbox.reel/checkbox.js +++ /dev/null @@ -1,120 +0,0 @@ -/* -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; -var Component = require("montage/ui/component").Component; - -exports.Checkbox = Montage.create(Component, { - - _valueSyncedWithInputField: { - enumerable: false, - value: false - }, - - _wasSetByCode: { - enumerable: false, - value: true - }, - - prependLabel: { - value: false - }, - - label: { - value: null - }, - - value: { - value: false - }, - - _checked: { - enumerable: false, - value: false - }, - - checked: { - enumerable: true, - serializable: true, - get: function() { - return this._checked; - }, - set: function(value) { - this._checked = value; - this.needsDraw = true; - - var e = document.createEvent("CustomEvent"); - e.initEvent("change", true, true); - e.type = "change"; - e.wasSetByCode = this._wasSetByCode; - e.value = value; - this.value = value; - this.dispatchEvent(e); - - this._wasSetByCode = true; - } - }, - - _enabled: { - enumerable: false, - value: true - }, - - enabled: { - enumerable: true, - serializable: true, - get: function() { - return this._enabled; - }, - set: function(value) { - if(value !== this._enabled) - { - this._enabled = value; - this.needsDraw = true; - } - } - }, - - handleChange: - { - value:function(event) - { - this._valueSyncedWithInputField = true; - this._wasSetByCode = false; - this.checked = this.element.checked; - } - }, - handleClick: { - value: function() { - this._wasSetByCode = false; - this.checked = !this.element.checked; - } - }, - - draw: { - value: function() { - this.element.disabled = !this._enabled; - if(!this._valueSyncedWithInputField) - { - this.element.checked = this._checked; - } - this._valueSyncedWithInputField = false; - } - }, - - prepareForDraw: { - value: function() { - if (this.label !== null) { - var b = document.createElement("label"); - b.innerHTML = this.label; - this.element.appendChild(b); - b.addEventListener("click", this, false); - } - this.element.addEventListener("change", this, false); - } - } - -}); \ No newline at end of file diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.css b/js/components/ui/label-checkbox.reel/label-checkbox.css new file mode 100644 index 00000000..6eb75a0e --- /dev/null +++ b/js/components/ui/label-checkbox.reel/label-checkbox.css @@ -0,0 +1,9 @@ +/* + 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. +
*/ + +.label-checkbox { + display: inline-block; +} \ No newline at end of file diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.html b/js/components/ui/label-checkbox.reel/label-checkbox.html new file mode 100755 index 00000000..0efc7ae0 --- /dev/null +++ b/js/components/ui/label-checkbox.reel/label-checkbox.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.js b/js/components/ui/label-checkbox.reel/label-checkbox.js new file mode 100755 index 00000000..82c01262 --- /dev/null +++ b/js/components/ui/label-checkbox.reel/label-checkbox.js @@ -0,0 +1,67 @@ +/* +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; +var Component = require("montage/ui/component").Component; + +exports.LabelCheckbox = Montage.create(Component, { + + _label: { + value: "" + }, + + label: { + get: function() { + return this._label; + }, + set: function(value) { + if(this._label !== value) { + this._label = value; + this.needsDraw = true; + } + } + }, + + _checked: { + value: false + }, + + checked: { + serializable: true, + get: function() { + return this._checked; + }, + set: function(value) { + if(this._checked !== value) { + this._checked = value; + this.needsDraw = true; + } + } + }, + + value: { + value: false + }, + + handleAction: { + value: function(event) { + var e = document.createEvent("CustomEvent"); + e.initEvent("change", true, true); + e.type = "change"; + e.wasSetByCode = false; + this.value = e.value = this._checkbox.checked; + this.dispatchEvent(e); + } + }, + + draw: { + value: function() { + this._labelText.value = this.label; + this._checkbox.checked = this.checked; + } + + } +}); \ No newline at end of file diff --git a/js/components/ui/property-control.reel/property-control.js b/js/components/ui/property-control.reel/property-control.js index cd59c02c..c28979a9 100755 --- a/js/components/ui/property-control.reel/property-control.js +++ b/js/components/ui/property-control.reel/property-control.js @@ -10,7 +10,7 @@ var Montage = require("montage/core/core").Montage, HotTextUnit = require("js/components/hottextunit.reel").HotTextUnit, Slider = require("js/components/slider.reel").Slider, Button = require("montage/ui/button.reel").Button, - Checkbox = require("js/components/checkbox.reel").Checkbox, + Checkbox = require("js/components/ui/label-checkbox.reel").LabelCheckbox, Combobox = require("js/components/combobox.reel").Combobox, TextField = require("js/components/TextField.reel").TextField, ColorChip = require("js/components/ui/color-chip.reel").ColorChip, diff --git a/js/panels/properties.reel/properties.css b/js/panels/properties.reel/properties.css index 0928da3a..756ecc5c 100755 --- a/js/panels/properties.reel/properties.css +++ b/js/panels/properties.reel/properties.css @@ -256,17 +256,17 @@ padding-right:6px; content: "•"; } -.propertiesPanel input.nj-skinned label { +.propertiesPanel .checkbox-label { position: absolute; - top: 0; - left: 15px; + top: 4px; + padding-left: 5px; + /*left: 15px;*/ font-size: 10px; width:55px; text-align: left; font-weight: normal; color:#FFF; } - .propertiesPanel input[type='radio'].nj-skinned { text-indent: 0px; line-height: 5px; diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index 876fe110..3ab32888 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js @@ -19,7 +19,7 @@ var HT = require("js/components/hottext.reel").HotText; var Dropdown = require("js/components/combobox.reel").Combobox; var TextField = require("js/components/textfield.reel").TextField; var FileInput = require("js/components/ui/file-input.reel").FileInput; -var Checkbox = require("js/components/checkbox.reel").Checkbox; +var LabelCheckbox = require("js/components/ui/label-checkbox.reel").LabelCheckbox; var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; var Button = require("montage/ui/button.reel").Button; @@ -77,7 +77,7 @@ exports.CustomSection = Montage.create(Component, { this.rows.push(tmpRow); } else if(this._fields[i].length === 3) { - + } } @@ -103,7 +103,7 @@ exports.CustomSection = Montage.create(Component, { handleChange: { value:function(event) { if(event._event.wasSetByCode) return; - + var obj = event.currentTarget; this._dispatchPropEvent({"type": "change", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); } @@ -349,7 +349,7 @@ exports.CustomSection = Montage.create(Component, { value: function(aField) { // Generate Textfield - var obj = Checkbox.create(); + var obj = LabelCheckbox.create(); // Set Values for TextField if (aField.id) obj.id = aField.id; -- cgit v1.2.3