From 984d65c818969ea3bef57ade9cbf5fc50d9a2316 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 6 Feb 2012 11:43:01 -0800 Subject: Tree Components - Adding the tree components --- .../treeview/ninja-leaf.reel/ninja-leaf.js | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 js/components/treeview/ninja-leaf.reel/ninja-leaf.js (limited to 'js/components/treeview/ninja-leaf.reel/ninja-leaf.js') diff --git a/js/components/treeview/ninja-leaf.reel/ninja-leaf.js b/js/components/treeview/ninja-leaf.reel/ninja-leaf.js new file mode 100644 index 00000000..bd566b26 --- /dev/null +++ b/js/components/treeview/ninja-leaf.reel/ninja-leaf.js @@ -0,0 +1,41 @@ +/* +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; + TreeNode = require("js/components/treeview/tree-node").TreeNode; + +exports.Leaf = Montage.create(TreeNode, { + hasTemplate: { + value: true + }, + templateDidLoad : { + value: function() { + this.needsDraw = true; + } + }, + prepareForDraw: { + value : function() { + this.activationEvent = this.activationEvent || 'click'; + this.label._element.addEventListener(this.activationEvent, this.handleNodeActivation.bind(this), false); + } + }, + handleNodeActivation: { + value: function(e) { + console.log(this.sourceObject); + this.treeView.contentController.delegate.applyPresetSelection(this.sourceObject); + } + }, + draw : { + value : function() { + if(this.sourceObject[this.labelKey]) { + this._labelText = this.sourceObject[this.labelKey]; + } + } + } + + +}); -- cgit v1.2.3