diff options
Diffstat (limited to 'js/panels/css-panel/rule-list.reel/rule-list.js')
-rw-r--r-- | js/panels/css-panel/rule-list.reel/rule-list.js | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/js/panels/css-panel/rule-list.reel/rule-list.js b/js/panels/css-panel/rule-list.reel/rule-list.js new file mode 100644 index 00000000..11cda89c --- /dev/null +++ b/js/panels/css-panel/rule-list.reel/rule-list.js | |||
@@ -0,0 +1,100 @@ | |||
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 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.RuleList = Montage.create(Component, { | ||
11 | hasTemplate: { | ||
12 | value: true | ||
13 | }, | ||
14 | _rules: { | ||
15 | value: null | ||
16 | }, | ||
17 | rules: { | ||
18 | get: function() { | ||
19 | return this._rules; | ||
20 | }, | ||
21 | set: function(list) { | ||
22 | if(!list) { | ||
23 | return null; | ||
24 | } | ||
25 | console.log('list: ', list); | ||
26 | this._rules = list; | ||
27 | this.needsDraw = this._needsAppend = true; | ||
28 | } | ||
29 | }, | ||
30 | _contentController: { | ||
31 | value: null | ||
32 | }, | ||
33 | contentController: { | ||
34 | get: function() { | ||
35 | return this._contentController; | ||
36 | }, | ||
37 | set: function(controller) { | ||
38 | |||
39 | Object.defineBinding(this, 'rules', { | ||
40 | "boundObject": controller, | ||
41 | "boundObjectPropertyPath": "ruleList", | ||
42 | "oneway": true | ||
43 | |||
44 | }); | ||
45 | |||
46 | this._contentController = controller; | ||
47 | } | ||
48 | }, | ||
49 | templateDidLoad : { | ||
50 | value: function() { | ||
51 | console.log("Rule List : template did load"); | ||
52 | //this.condition = true; | ||
53 | } | ||
54 | }, | ||
55 | prepareForDraw : { | ||
56 | value: function() { | ||
57 | console.log("Rule List : prepare for draw"); | ||
58 | } | ||
59 | }, | ||
60 | draw : { | ||
61 | value: function() { | ||
62 | if(this._needsAppend) { | ||
63 | this._rules.forEach(function(rule) { | ||
64 | var componentBase = this.supportedRules[rule.type], | ||
65 | instance, el; | ||
66 | |||
67 | if(componentBase) { | ||
68 | el = document.createElement(this.ruleNodeName); | ||
69 | instance = componentBase.create(); | ||
70 | instance.element = el; | ||
71 | instance.rule = rule; | ||
72 | this.listElement.appendChild(el); | ||
73 | instance.needsDraw = true; | ||
74 | } | ||
75 | |||
76 | |||
77 | }, this); | ||
78 | } | ||
79 | console.log("Rule List : draw"); | ||
80 | } | ||
81 | }, | ||
82 | _createRuleComponent: { | ||
83 | value: function(ruleType) { | ||
84 | |||
85 | } | ||
86 | }, | ||
87 | ruleNodeName : { | ||
88 | value: 'li' | ||
89 | }, | ||
90 | ruleComponents : { | ||
91 | value: { | ||
92 | "1" : 'css-style-rule', | ||
93 | "3" : 'css-import-rule', | ||
94 | "4" : 'css-media-rule', | ||
95 | "5" : 'css-font-face-rule', | ||
96 | "6" : 'css-page-rule', | ||
97 | "10" : 'namespace-rule' | ||
98 | } | ||
99 | } | ||
100 | }); | ||