aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js')
-rw-r--r--js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js126
1 files changed, 126 insertions, 0 deletions
diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
new file mode 100644
index 00000000..95adddd0
--- /dev/null
+++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
@@ -0,0 +1,126 @@
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.StyleSheetsView = Montage.create(Component, {
11 noDocumentCondition : {
12 value: true
13 },
14 showToolbar : {
15 value: false
16 },
17 _resizedHeight : {
18 value: null
19 },
20 isResizing : {
21 value: null
22 },
23 _height: {
24 value: null
25 },
26 height: {
27 get: function() {
28 return this._height;
29 },
30 set: function(val) {
31 if(this._height !== val) {
32 this._height = val;
33 this.needsDraw = true;
34 }
35 }
36 },
37
38 styleSheets : {
39 value: []
40 },
41 stylesController : {
42 value: null
43 },
44 deserializedFromTemplate : {
45 value: function() {
46 console.log("style sheet view - deserialized");
47
48 this.stylesController = this.application.ninja.stylesController;
49
50 this.eventManager.addEventListener("styleSheetsReady", this, false);
51 this.eventManager.addEventListener("newStyleSheet", this, false);
52 }
53 },
54 _initView : {
55 value: false
56 },
57
58 handleStyleSheetsReady : {
59 value: function(e) {
60 this._initView = this.needsDraw = true;
61
62// this.noDocumentCondition = false;
63// this.showToolbar = true;
64// this.styleSheets = this.stylesController.userStyleSheets;
65
66 }
67 },
68 handleNewStyleSheet : {
69 value: function(e) {
70 this.styleSheets.push(e._event.detail);
71 }
72 },
73 handleResizeStart: {
74 value:function(e) {
75 this.isResizing = true;
76 this.needsDraw = true;
77 }
78 },
79
80 handleResizeMove: {
81 value:function(e) {
82 this._resizedHeight = e._event.dY;
83 this.needsDraw = true;
84 }
85 },
86
87 handleResizeEnd: {
88 value: function(e) {
89 this.height += this._resizedHeight;
90 this._resizedHeight = 0;
91 this.isResizing = false;
92 this.needsDraw = true;
93 }
94 },
95
96
97 prepareForDraw : {
98 value: function() {
99 console.log("style sheet view - prepare for draw");
100 }
101 },
102 draw : {
103 value: function() {
104 console.log("styles sheet view - draw");
105
106 if(this._initView) {
107 this.noDocumentCondition = false;
108 this.showToolbar = true;
109 this.styleSheets = this.stylesController.userStyleSheets;
110 this._initView = false;
111 }
112
113 if(this.height) {
114 console.log("StyleSheetsView draw - resizing to", (this.height + this._resizedHeight) + "px");
115 this.styleSheetList.element.style.height = (this.height + this._resizedHeight) + "px";
116 }
117 }
118 },
119 didDraw: {
120 value: function() {
121 if(!this.isResizing) {
122 this.height = this.styleSheetList.element.offsetHeight;
123 }
124 }
125 }
126}); \ No newline at end of file