From 19e94dc51a279501352a08d511b18144f83500e5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 28 Feb 2012 00:47:46 -0800 Subject: cleanup and fixing selecting each bread crumb Signed-off-by: Valerio Virgillito --- .../bread-crumb-button.reel/bread-crumb-button.css | 32 ---------- .../bread-crumb-button.html | 36 ----------- .../bread-crumb-button.reel/bread-crumb-button.js | 59 ----------------- .../layout/bread-crumb.reel/bread-crumb.css | 17 ++--- .../layout/bread-crumb.reel/bread-crumb.html | 73 ++++++++++++---------- .../layout/bread-crumb.reel/bread-crumb.js | 59 ++++++----------- 6 files changed, 64 insertions(+), 212 deletions(-) delete mode 100755 js/components/layout/bread-crumb-button.reel/bread-crumb-button.css delete mode 100755 js/components/layout/bread-crumb-button.reel/bread-crumb-button.html delete mode 100755 js/components/layout/bread-crumb-button.reel/bread-crumb-button.js (limited to 'js/components') diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.css b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.css deleted file mode 100755 index 9d0a1eb4..00000000 --- a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.css +++ /dev/null @@ -1,32 +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. -
*/ - -.breadcrumbbuttonBackground { - height: 20px; - min-width: 50px; - margin: auto; - border:1px solid black; - float:left; - margin-left:10px; - background:#474747; - margin-top:3px; -} - - -.breadcrumbtoolBarButton { - border: 1px; - color: white; - text-align:-webkit-center; - margin-top : 4px; - cursor :default; - font-family: 'Droid Sans'; - font-size: 12px; - text-shadow: 1px 1px 1px black; - -} - - - diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.html b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.html deleted file mode 100755 index b3fdb0b6..00000000 --- a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js deleted file mode 100755 index c1ac99bd..00000000 --- a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js +++ /dev/null @@ -1,59 +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.BreadcrumbButton = Montage.create(Component, { - - button: { - value: null - }, - - data: { - value: null - }, - - // Bound container for the button - container: { - value: null - }, - - prepareForDraw: { - value: function() { - this.element.addEventListener("mousedown", this, false); - } - }, - - draw: { - value: function() { - - // Temporary until we have the new template - /* - if(this.container.id === "UserContent") { - this.button.innerHTML = "Body"; - } else { - this.button.innerHTML = this.container.nodeName.toLowerCase(); - } - */ - // - - if(this.data.element.id === "UserContent") { - this.button.innerHTML = "Body"; - } else { - this.button.innerHTML = this.data.element.nodeName; - } - - } - }, - - handleMousedown: { - value: function(event) { - NJevent('breadCrumbTrail',this.data); - } - } - -}); \ No newline at end of file diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.css b/js/components/layout/bread-crumb.reel/bread-crumb.css index 0ca8adec..ae1ea794 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.css +++ b/js/components/layout/bread-crumb.reel/bread-crumb.css @@ -11,17 +11,8 @@ -webkit-box-flex: 0; } -.bread_crumb_button{ - background-color: #575757; - float: left; - width: 40px; - height: 20px; - margin-left: 5px; - margin-top: 3px; - - font-family: 'Droid Sans', sans-serif; - font-size: 12px; - text-shadow: 1px 1px 1px black; - color: white; -} \ No newline at end of file +.breadcrumbTrail button { + float: left; + width: 60px; +} diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html index 234596a6..f2368e9a 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.html +++ b/js/components/layout/bread-crumb.reel/bread-crumb.html @@ -17,43 +17,50 @@ "name": "Breadcrumb", "properties": { "element": {"#": "breadcrumbTrail"}, - "button" : {"@":"breadCrumbButton"}, - "stylerepetition" : {"@":"repetition1"} - + "breadcrumbBt": {"@": "breadCrumbButton"} } }, "breadCrumbButton": { - "module": "js/components/layout/bread-crumb-button.reel", - "name": "BreadcrumbButton", - "properties": { - "element": {"#": "breadcrumb_button"} - }, - "bindings": { - "data": { - "boundObject": {"@": "repetition1"}, - "boundObjectPropertyPath": "objectAtCurrentIteration", - "oneway": true - } - } - }, - - "repetition1": { - "module": "montage/ui/repetition.reel", - "name": "Repetition", - "properties": { - "element": {"#": "breadcrumb_container"} - }, - "bindings": { - "objects": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "containerElements", - "oneway": true - } - } - } - + "module": "montage/ui/button.reel", + "name": "Button", + "properties": { + "element": {"#": "breadcrumb_button"} + }, + "listeners": [ + { + "type": "action", + "listener": {"@": "owner"} + } + ], + "bindings": { + "label": { + "boundObject": {"@": "repetition1"}, + "boundObjectPropertyPath": "objectAtCurrentIteration.label", + "oneway": true + }, + "value": { + "boundObject": {"@": "repetition1"}, + "boundObjectPropertyPath": "objectAtCurrentIteration.nodeUuid", + "oneway": true + } + } + }, + "repetition1": { + "module": "montage/ui/repetition.reel", + "name": "Repetition", + "properties": { + "element": {"#": "breadcrumb_container"} + }, + "bindings": { + "objects": { + "boundObject": {"@": "owner"}, + "boundObjectPropertyPath": "containerElements", + "oneway": true + } + } + } } @@ -62,7 +69,7 @@ diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index d071e48a..b2fa42b1 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -29,10 +29,9 @@ exports.Breadcrumb = Montage.create(Component, { value: [] }, - - deserializedFromTemplate : { + prepareForDraw: { value: function() { - this.eventManager.addEventListener( "breadCrumbTrail", this, false); + this.breadcrumbBt.addEventListener("action", this, false); } }, @@ -40,56 +39,38 @@ exports.Breadcrumb = Montage.create(Component, { value: function() { var parentNode; - this.containerElements.length = 0 - - if(this.container.id === "UserContent") { - this.containerElements.push({selected:false, element:this.container}); - } else { - parentNode = this.container; + this.containerElements.length = 0; - while(parentNode.id!=="UserContent") { - this.containerElements.unshift({selected:false,element:parentNode}); - parentNode = parentNode.parentNode; - } + parentNode = this.container; - this.containerElements.unshift({selected:false,element:parentNode}); + while(parentNode.id !== "UserContent") { + this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); + parentNode = parentNode.parentNode; } - NJevent('layerBinding',{selected:false ,element:this.container}) + // This is always the top container which is now hardcoded to body + this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); + + // This is for the timeline -- Disable it since the timeline should not know about this object + // NJevent('layerBinding',{selected:false ,element:this.container}) + } }, - handleBreadCrumbTrail: { - value: function(event) { - var newLength,revaluatedLength,tmpvalue; - var i=0; + handleAction: { + value: function(evt) { - if(event.detail.setFlag ){ - this.application.ninja.currentSelectedContainer = event.detail.element; + if(evt.target.value === this.container.uuid) { return; } - newLength = this.containerElements.length; + for(var i = this.containerElements.length - 1; i >= 0; i--) { + if(evt.target.value === this.containerElements[i].nodeUuid) break; - while(i < newLength ){ - if(this.containerElements[i].selected){ - tmpvalue = i; - break; - } - i++; + this.containerElements.pop(); } - for(i = newLength -1 ; i >= 1 ; i--) { - if(tmpvalue !== i) { - this.containerElements.pop(); - } else { - break; - } - } - - revaluatedLength = this.containerElements.length; - this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; - + this.application.ninja.currentSelectedContainer = this.containerElements[i].node; } } }); -- cgit v1.2.3