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