From 1433f2bdf2e5b8c5c18fed5e9c17fd983ab3606d Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 2 Mar 2012 10:55:51 -0800 Subject: CSS Panel - Updating components, created toolbar components, and small changes to styles controller --- js/components/toolbar.reel/toolbar.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 js/components/toolbar.reel/toolbar.js (limited to 'js/components/toolbar.reel/toolbar.js') diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js new file mode 100644 index 00000000..79e7ff1f --- /dev/null +++ b/js/components/toolbar.reel/toolbar.js @@ -0,0 +1,27 @@ +/* + 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; + +exports.Toolbar = Montage.create(Component, { + + deserializedFromTemplate : { + value: function() { + console.log("toolbar - deserialized"); + } + }, + prepareForDraw : { + value: function() { + console.log("toolbar - prepare for draw"); + } + }, + draw : { + value: function() { + console.log("toolbar - draw"); + } + } +}); \ No newline at end of file -- cgit v1.2.3 From 4cefebd99813f05713deb2f72bba0a035dfcb508 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 23 Apr 2012 11:46:54 -0700 Subject: Toolbar - Add buttons to toolbar component --- js/components/toolbar.reel/toolbar.js | 40 ++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'js/components/toolbar.reel/toolbar.js') diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js index 79e7ff1f..03edf477 100644 --- a/js/components/toolbar.reel/toolbar.js +++ b/js/components/toolbar.reel/toolbar.js @@ -8,20 +8,50 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; exports.Toolbar = Montage.create(Component, { - - deserializedFromTemplate : { - value: function() { - console.log("toolbar - deserialized"); + _needsButtonProperties : { + value: null + }, + _buttons : { value: null }, + buttons : { + get: function() { + return this._buttons; + }, + set: function(btns) { + this._buttons = btns; + this._needsButtonProperties = true; + console.log("buttons set"); } }, prepareForDraw : { value: function() { console.log("toolbar - prepare for draw"); + if(this._needsButtonProperties) { + this.repetition.childComponents.forEach(function(button) { + button.identifier = button.sourceObject.identifier; + button.addEventListener('action', this.delegate, false); + }, this); + } } }, draw : { value: function() { - console.log("toolbar - draw"); + console.log("toolbar - draw - repetition ", this.repetition); + if(this._needsClass) { + + this.repetition.childComponents.forEach(function(button) { + button.element.classList.add('toolbar-' + button.sourceObject.identifier + '-button'); + }, this); + } + + if(this._needsButtonProperties) { + this._needsClass = this.needsDraw = true; + this._needsButtonProperties = false; + } + + } + }, + _needsClass : { + value: null } }); \ No newline at end of file -- cgit v1.2.3 From fc104084e964023263332dbf2d916bf00d525e8b Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 3 May 2012 11:48:46 -0700 Subject: Panel Toolbar - Support hiding and showing of buttons --- js/components/toolbar.reel/toolbar.js | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'js/components/toolbar.reel/toolbar.js') diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js index 03edf477..dbff2db6 100644 --- a/js/components/toolbar.reel/toolbar.js +++ b/js/components/toolbar.reel/toolbar.js @@ -11,6 +11,8 @@ exports.Toolbar = Montage.create(Component, { _needsButtonProperties : { value: null }, + leftAlignClass : { value: "left-button" }, + hideButtonClass : { value: "hide-button" }, _buttons : { value: null }, buttons : { get: function() { @@ -22,6 +24,44 @@ exports.Toolbar = Montage.create(Component, { console.log("buttons set"); } }, + + _buttonToHide : { + value: null + }, + _buttonToShow : { + value: null + }, + getButton : { + value: function(identifier) { + var buttons = this.repetition.childComponents, + buttonIds = buttons.map(function(component) { + return component.sourceObject.identifier; + }); + + return buttons[buttonIds.indexOf(identifier)]; + } + }, + hideButton : { + value: function(identifier) { + var button = this.getButton(identifier); + + if(button) { + this._buttonToHide = button; + this.needsDraw = true; + } + } + }, + showButton : { + value: function(identifier) { + var button = this.getButton(identifier); + + if(button) { + this._buttonToShow = button; + this.needsDraw = true; + } + } + }, + prepareForDraw : { value: function() { console.log("toolbar - prepare for draw"); @@ -40,7 +80,14 @@ exports.Toolbar = Montage.create(Component, { this.repetition.childComponents.forEach(function(button) { button.element.classList.add('toolbar-' + button.sourceObject.identifier + '-button'); + + ///// add left align class if specified in serialization + if(button.sourceObject.leftAlign) { + button.element.parentElement.classList.add(this.leftAlignClass); + } }, this); + + this._needsClass = false; } if(this._needsButtonProperties) { @@ -48,6 +95,14 @@ exports.Toolbar = Montage.create(Component, { this._needsButtonProperties = false; } + if(this._buttonToHide) { + this._buttonToHide.element.classList.add(this.hideButtonClass); + this._buttonToHide = null; + } + if(this._buttonToShow) { + this._buttonToShow.element.classList.remove(this.hideButtonClass); + this._buttonToShow = null; + } } }, -- cgit v1.2.3 From b52222a0e165825bf507b4f69b33d51c84eb85d4 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 10 May 2012 15:11:40 -0700 Subject: CSS Panel - Fix errors from new Montage and remove logs. --- js/components/toolbar.reel/toolbar.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'js/components/toolbar.reel/toolbar.js') diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js index dbff2db6..bc3cbd08 100644 --- a/js/components/toolbar.reel/toolbar.js +++ b/js/components/toolbar.reel/toolbar.js @@ -21,7 +21,6 @@ exports.Toolbar = Montage.create(Component, { set: function(btns) { this._buttons = btns; this._needsButtonProperties = true; - console.log("buttons set"); } }, @@ -64,7 +63,6 @@ exports.Toolbar = Montage.create(Component, { prepareForDraw : { value: function() { - console.log("toolbar - prepare for draw"); if(this._needsButtonProperties) { this.repetition.childComponents.forEach(function(button) { button.identifier = button.sourceObject.identifier; @@ -75,7 +73,6 @@ exports.Toolbar = Montage.create(Component, { }, draw : { value: function() { - console.log("toolbar - draw - repetition ", this.repetition); if(this._needsClass) { this.repetition.childComponents.forEach(function(button) { -- cgit v1.2.3 From a8e97144c832e355de7f8177ce38644119248e87 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 21 May 2012 09:30:24 -0700 Subject: Style sheets view - Fixed drawing of toolbar and "no sheets" message --- js/components/toolbar.reel/toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/components/toolbar.reel/toolbar.js') diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js index bc3cbd08..8f93aa2b 100644 --- a/js/components/toolbar.reel/toolbar.js +++ b/js/components/toolbar.reel/toolbar.js @@ -20,7 +20,7 @@ exports.Toolbar = Montage.create(Component, { }, set: function(btns) { this._buttons = btns; - this._needsButtonProperties = true; + this._needsButtonProperties = this.needsDraw = true;; } }, -- cgit v1.2.3 From 1c3da2901f454ad2c18e20216bb2517740a1c080 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 22 May 2012 14:28:00 -0700 Subject: CSS Panel - Update components to use new serialization format --- js/components/toolbar.reel/toolbar.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'js/components/toolbar.reel/toolbar.js') diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js index 8f93aa2b..2ccdb2c5 100644 --- a/js/components/toolbar.reel/toolbar.js +++ b/js/components/toolbar.reel/toolbar.js @@ -11,17 +11,31 @@ exports.Toolbar = Montage.create(Component, { _needsButtonProperties : { value: null }, + _sourceObject : { + value: null + }, + sourceObject : { + get: function() { + return this._sourceObject; + }, + set: function(value) { + if(value === this._sourceObject) { return; } + this._sourceObject = value; + }, + serializable: true + }, leftAlignClass : { value: "left-button" }, hideButtonClass : { value: "hide-button" }, - _buttons : { value: null }, + _buttons : { value: [], distinct: true }, buttons : { get: function() { return this._buttons; }, set: function(btns) { this._buttons = btns; - this._needsButtonProperties = this.needsDraw = true;; - } + this._needsButtonProperties = this.needsDraw = true; + }, + serializable: true }, _buttonToHide : { -- cgit v1.2.3