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 --- .../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 +- 4 files changed, 131 insertions(+), 1 deletion(-) 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/components/ui') 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, -- cgit v1.2.3 From 65cea92d839bcd25ea9094a0798190a4dc4bea35 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 17 May 2012 00:16:43 -0700 Subject: Adding a disabled property to the label-checkbox. Signed-off-by: Valerio Virgillito --- .../ui/label-checkbox.reel/label-checkbox.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'js/components/ui') diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.js b/js/components/ui/label-checkbox.reel/label-checkbox.js index 82c01262..21b72cb5 100755 --- a/js/components/ui/label-checkbox.reel/label-checkbox.js +++ b/js/components/ui/label-checkbox.reel/label-checkbox.js @@ -42,6 +42,25 @@ exports.LabelCheckbox = Montage.create(Component, { } }, + _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; + } + } + }, + value: { value: false }, @@ -52,7 +71,7 @@ exports.LabelCheckbox = Montage.create(Component, { e.initEvent("change", true, true); e.type = "change"; e.wasSetByCode = false; - this.value = e.value = this._checkbox.checked; + this.checked = this.value = e.value = this._checkbox.checked; this.dispatchEvent(e); } }, @@ -61,6 +80,7 @@ exports.LabelCheckbox = Montage.create(Component, { value: function() { this._labelText.value = this.label; this._checkbox.checked = this.checked; + this._checkbox.disabled = !this._enabled; } } -- cgit v1.2.3 From a396caf12a9e1fc84b984d39f8e671c335d2f5d5 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 18 May 2012 14:36:53 -0700 Subject: File Input control in materials panel was not working because of the change from id to data-montage-id. Signed-off-by: Nivesh Rajbhandari --- js/components/ui/file-input.reel/file-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/components/ui') diff --git a/js/components/ui/file-input.reel/file-input.js b/js/components/ui/file-input.reel/file-input.js index b57f7c21..584380ec 100755 --- a/js/components/ui/file-input.reel/file-input.js +++ b/js/components/ui/file-input.reel/file-input.js @@ -38,7 +38,7 @@ var FileInput = exports.FileInput = Montage.create(Component, { { value:function(event) { - if(event.currentTarget.id === "fileInputControl") + if(event.currentTarget.type === "file") { this.filePath = this.inputField.value; } -- cgit v1.2.3 From 3e22b0940bb7752e292e485d8a393f215cae05de Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 18 May 2012 15:14:36 -0700 Subject: Fixed Materials Popup to work with new changes to repetition bindings. Signed-off-by: Nivesh Rajbhandari --- js/components/ui/input-group.reel/input-group.html | 3 ++- js/components/ui/property-control.reel/property-control.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'js/components/ui') diff --git a/js/components/ui/input-group.reel/input-group.html b/js/components/ui/input-group.reel/input-group.html index ba85c089..7da4a855 100755 --- a/js/components/ui/input-group.reel/input-group.html +++ b/js/components/ui/input-group.reel/input-group.html @@ -25,7 +25,8 @@ "bindings": { "data": { "boundObject": {"@": "propList"}, - "boundObjectPropertyPath": "objectAtCurrentIteration" + "boundObjectPropertyPath": "objectAtCurrentIteration", + "oneway": true } }, "listeners": [ diff --git a/js/components/ui/property-control.reel/property-control.js b/js/components/ui/property-control.reel/property-control.js index c28979a9..20ec173e 100755 --- a/js/components/ui/property-control.reel/property-control.js +++ b/js/components/ui/property-control.reel/property-control.js @@ -120,8 +120,13 @@ var PropertyControl = exports.PropertyControl = Montage.create(Component, { set: function (data) { if (data !== this._data) { this._data = data; - this.label = data.label; - this.controlType = data.controlType; + if(data) { + this._label = data.label; + this._controlType = data.controlType; + } else { + this._label = ""; + this._controlType = null; + } this.needsDraw = true; } } @@ -143,6 +148,9 @@ var PropertyControl = exports.PropertyControl = Montage.create(Component, { { value:function(event) { + if(event.wasSetByCode) { + return; + } this._dispatchPropEvent(event); } }, -- cgit v1.2.3 From fdfba499f0b84360b96096fa866a981e96e8756c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 16:35:56 -0700 Subject: fixing the color chip for the document root Signed-off-by: Valerio Virgillito --- js/components/ui/color-chip.reel/color-chip.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'js/components/ui') diff --git a/js/components/ui/color-chip.reel/color-chip.js b/js/components/ui/color-chip.reel/color-chip.js index 4e64b2e8..630dcd4b 100755 --- a/js/components/ui/color-chip.reel/color-chip.js +++ b/js/components/ui/color-chip.reel/color-chip.js @@ -33,6 +33,11 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { value: {r:0, g:0, b:0, a:1, css:'rgb(0,0,0)', mode:'rgb'} }, + chipBtn: { + serializable: true, + value: null + }, + changeDelegate: { value: function(event) { this.color = event._event.color; @@ -60,7 +65,7 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { this.icon.style.display = "none"; } - this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: this.offset}; + this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, nocolor: true, offset: this.offset}; this.application.ninja.colorController.addButton(this.mode, this.chipBtn); } @@ -80,9 +85,13 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { b = colorObj.value.b; a = colorObj.value.a; css = colorObj.css; + this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); + } else { + mode = "nocolor"; + this.chipBtn.color(mode, null); + } - this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); this.chipBtn.addEventListener("change", this, false); } } -- cgit v1.2.3