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.js99
1 files changed, 99 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..d85b5797
--- /dev/null
+++ b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
@@ -0,0 +1,99 @@
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 focusDelegate : {
18 value: null
19 },
20
21 _rule : {
22 value : null
23 },
24 rule : {
25 get: function() {
26 return this._rule;
27 },
28 set: function(rule) {
29 this.cssText = rule.cssText;
30
31 if(rule.type === 'inline') {
32 this.sheetName = 'Inline Style';
33 } else {
34 this.sheetName = rule.href || 'Style Tag';
35 }
36
37 this.selector = rule.selectorText;
38 this.declaration = rule.style;
39
40 console.log('Rule with selector "' +rule.selectorText+ '" is set on componenet.');
41
42 this._rule = rule;
43 }
44 },
45 declarationComponent: {
46 value: null
47 } ,
48// declarationNodeName: {
49// value: "dl"
50// },
51// declarationElement: {
52// value: null
53// },
54 _declaration: {
55 value: null
56 },
57 declaration: {
58 get: function() {
59 return this._declaration;
60 },
61 set: function(dec) {
62 this._declaration = dec;
63 }
64 },
65 condition: {
66 value: false
67 },
68 templateDidLoad : {
69 value: function() {
70 console.log("css style rule : template did load");
71 if(this._declaration) {
72 this.declarationComponent.declaration = this._declaration;
73 }
74
75 if(this.focusDelegate) {
76 this.declarationComponent.focusDelegate = this.focusDelegate;
77 }
78 }
79 },
80 prepareForDraw : {
81 value: function() {
82 console.log("css style rule : prepare for draw");
83
84 if(!this.declarationElement) {
85 ///// Create element to contain declaration
86 this.declarationElement = document.createElement(this.declarationNodeName);
87 }
88
89 if(!this._declaration && this._rule) {
90
91 }
92 }
93 },
94 draw : {
95 value: function() {
96 console.log("css style rule : draw");
97 }
98 }
99});