aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js')
-rw-r--r--js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js91
1 files changed, 91 insertions, 0 deletions
diff --git a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
new file mode 100644
index 00000000..dd51565a
--- /dev/null
+++ b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
@@ -0,0 +1,91 @@
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.CssStyleRule = Montage.create(Component, {
11 cssText: {
12 value: null
13 },
14 hasTemplate: {
15 value: true
16 },
17 _rule : {
18 value : null
19 },
20 rule : {
21 get: function() {
22 return this._rule;
23 },
24 set: function(rule) {
25 this.cssText = rule.cssText;
26
27 if(rule.type === 'inline') {
28 this.sheetName = 'Inline Style';
29 } else {
30 this.sheetName = rule.href || 'Style Tag';
31 }
32
33 this.selector = rule.selectorText;
34 this.declaration = rule.style;
35
36 console.log('Rule with selector "' +rule.selectorText+ '" is set on componenet.');
37
38 this._rule = rule;
39 }
40 },
41 declarationComponent: {
42 value: null
43 } ,
44// declarationNodeName: {
45// value: "dl"
46// },
47// declarationElement: {
48// value: null
49// },
50 _declaration: {
51 value: null
52 },
53 declaration: {
54 get: function() {
55 return this._declaration;
56 },
57 set: function(dec) {
58 this._declaration = dec;
59 }
60 },
61 condition: {
62 value: false
63 },
64 templateDidLoad : {
65 value: function() {
66 console.log("css style rule : template did load");
67 if(this._declaration) {
68 this.declarationComponent.declaration = this._declaration;
69 }
70 }
71 },
72 prepareForDraw : {
73 value: function() {
74 console.log("css style rule : prepare for draw");
75
76 if(!this.declarationElement) {
77 ///// Create element to contain declaration
78 this.declarationElement = document.createElement(this.declarationNodeName);
79 }
80
81 if(!this._declaration && this._rule) {
82
83 }
84 }
85 },
86 draw : {
87 value: function() {
88 console.log("css style rule : draw");
89 }
90 }
91});