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