aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/styles-view-container.reel/styles-view-container.js')
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
new file mode 100644
index 00000000..1d6d6075
--- /dev/null
+++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
@@ -0,0 +1,70 @@
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.StylesViewContainer = Montage.create(Component, {
11 contentController : {
12 value: null
13 },
14 contentPanel : {
15 value: 'rules'
16 },
17 _hasStyles : {
18 value: false
19 },
20 hasStyles : {
21 get: function() {
22 return this._hasStyles;
23 },
24 set: function(hasThem) {
25 this._hasStyles = hasThem;
26 this.needsDraw = true;
27 }
28 },
29 templateDidLoad : {
30 value: function() {
31 this.eventManager.addEventListener('styleSheetsReady', this, false);
32 this.eventManager.addEventListener('elementChange', this, false);
33 }
34 },
35 handleStyleSheetsReady: {
36 value: function(e) {
37 this.eventManager.addEventListener( "selectionChange", this, false);
38 }
39 },
40 handleSelectionChange: {
41 value: function() {
42 var elements = this.application.ninja.selectedElements;
43
44 if(elements.length === 0) {
45 this.hasStyles = false;
46 return false;
47 }
48
49 this.ruleListContainer.displayListForSelection(elements);
50 this.hasStyles = true;
51 }
52 },
53 handleElementChange : {
54 value: function(e) {
55 if(e._event.detail.type !== 'cssChange') {
56 this.ruleListContainer.displayedList.component.update();
57 }
58 }
59 },
60
61 draw : {
62 value: function() {
63 if(this.hasStyles) {
64 this.element.classList.remove('no-styles');
65 } else {
66 this.element.classList.add('no-styles');
67 }
68 }
69 }
70}); \ No newline at end of file