diff options
author | Armen Kesablyan | 2012-02-07 16:55:34 -0800 |
---|---|---|
committer | Armen Kesablyan | 2012-02-07 16:55:34 -0800 |
commit | 10f0ad4c15f090b2d0d50d11e4c7aaf291e9eb0e (patch) | |
tree | 12b31910a3c7c7fa2ee0b26d8aaa611710e139a5 /js | |
parent | 7f8730c3add146f1ba107e6fc22d1f5a8348ed8b (diff) | |
parent | 668510892537eaaeb2e11520831d87b44b2489b7 (diff) | |
download | ninja-10f0ad4c15f090b2d0d50d11e4c7aaf291e9eb0e.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into text-tool
Conflicts:
_scss/compass_app_log.txt
css/ninja.css
Diffstat (limited to 'js')
67 files changed, 2311 insertions, 682 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js index f262bb06..a68a7d6b 100644 --- a/js/components/combobox.reel/combobox.js +++ b/js/components/combobox.reel/combobox.js | |||
@@ -67,7 +67,7 @@ exports.Combobox = Montage.create(Component, { | |||
67 | var e = document.createEvent("CustomEvent"); | 67 | var e = document.createEvent("CustomEvent"); |
68 | e.initEvent("change", true, true); | 68 | e.initEvent("change", true, true); |
69 | e.type = "change"; | 69 | e.type = "change"; |
70 | e._wasSetByCode = this._wasSetByCode; | 70 | e.wasSetByCode = this._wasSetByCode; |
71 | e.value = this._value; | 71 | e.value = this._value; |
72 | this.dispatchEvent(e); | 72 | this.dispatchEvent(e); |
73 | 73 | ||
diff --git a/js/components/controllers/tree-controller.js b/js/components/controllers/tree-controller.js new file mode 100644 index 00000000..03ef7b9e --- /dev/null +++ b/js/components/controllers/tree-controller.js | |||
@@ -0,0 +1,185 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | /** | ||
7 | @module montage/ui/controller/tree-controller | ||
8 | @requires montage/core/core | ||
9 | @requires montage/ui/controller/object-controller | ||
10 | @requires montage/core/event/mutable-event | ||
11 | */ | ||
12 | var Montage = require("montage").Montage, | ||
13 | ObjectController = require("montage/ui/controller/object-controller").ObjectController, | ||
14 | ArrayController = require("montage/ui/controller/array-controller").ArrayController, | ||
15 | MutableEvent = require("montage/core/event/mutable-event").MutableEvent; | ||
16 | /** | ||
17 | TODO: Write description like the array controllers: The ArrayController helps with organizing a hierarchical | ||
18 | collection of objects, and managing user selection within that collection. | ||
19 | You can assign a TreeController instance as the <code>contentProvider</code> property for a TreeView object. | ||
20 | @class module:montage/ui/controller/tree-controller.TreeController | ||
21 | @classdesc | ||
22 | @extends module:montage/ui/controller/object-controller.ObjectController | ||
23 | */ | ||
24 | var TreeController = exports.TreeController = Montage.create(ObjectController, /** @lends module:montage/ui/controller/tree-controller.TreeController# */ { | ||
25 | |||
26 | rootKey : { | ||
27 | value: null | ||
28 | }, | ||
29 | |||
30 | branchKey : { | ||
31 | value: 'children' | ||
32 | }, | ||
33 | |||
34 | _root : { | ||
35 | value : null | ||
36 | }, | ||
37 | root : { | ||
38 | get: function() { | ||
39 | return this._root; | ||
40 | }, | ||
41 | set: function(value) { | ||
42 | this._root = value; | ||
43 | |||
44 | this.initArrayControllers(); | ||
45 | } | ||
46 | }, | ||
47 | |||
48 | rootController: { | ||
49 | value: null | ||
50 | }, | ||
51 | |||
52 | initArrayControllers : { | ||
53 | value: function() { | ||
54 | var self = this; | ||
55 | |||
56 | ///// Recursive function that finds all branch nodes and initializes | ||
57 | ///// sets the tree node type to "branch" or "leaf" | ||
58 | |||
59 | function walk(node, init, depth) { | ||
60 | var branch = node[self.branchKey]; | ||
61 | |||
62 | if(branch) { | ||
63 | branch.forEach(function(node) { | ||
64 | walk(node, init, ++depth); | ||
65 | }); | ||
66 | |||
67 | node['treeNodeType'] = 'branch'; | ||
68 | } else { | ||
69 | node['treeNodeType'] = 'leaf'; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | walk(this._root, 0); | ||
74 | |||
75 | } | ||
76 | }, | ||
77 | |||
78 | /** | ||
79 | @private | ||
80 | */ | ||
81 | _selectedIndexes: { | ||
82 | value: null, | ||
83 | enumerable: false | ||
84 | }, | ||
85 | |||
86 | /** | ||
87 | Description TODO | ||
88 | @type {Function} | ||
89 | @default null | ||
90 | */ | ||
91 | selectedIndexes: { | ||
92 | get: function() { | ||
93 | return this._selectedIndexes; | ||
94 | }, | ||
95 | set: function(value) { | ||
96 | this._selectedIndexes = value; | ||