diff options
Diffstat (limited to 'js/panels/css-panel/style-sheet.reel/style-sheet.js')
-rw-r--r-- | js/panels/css-panel/style-sheet.reel/style-sheet.js | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.js b/js/panels/css-panel/style-sheet.reel/style-sheet.js new file mode 100644 index 00000000..2396d625 --- /dev/null +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -0,0 +1,101 @@ | |||
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.StyleSheet = Montage.create(Component, { | ||
11 | deserializedFromTemplate : { | ||
12 | value: function() { | ||
13 | console.log("style sheet view - deserialized"); | ||
14 | } | ||
15 | }, | ||
16 | willDraw : { | ||
17 | value: function() { | ||
18 | console.log("style sheet view - will draw"); | ||
19 | |||
20 | if(this.editing) { | ||
21 | document.body.addEventListener('click', this, false); | ||
22 | } else { | ||
23 | document.body.removeEventListener('click', this, false); | ||
24 | } | ||
25 | } | ||
26 | }, | ||
27 | draw : { | ||
28 | value: function() { | ||
29 | console.log("styles sheet view - draw"); | ||
30 | |||
31 | this.mediaInput.value = this._source.media.mediaText; | ||
32 | |||
33 | if(this.editing) { | ||
34 | this.editView.classList.add('expanded'); | ||
35 | } else { | ||
36 | this.editView.classList.remove('expanded'); | ||
37 | } | ||
38 | } | ||
39 | }, | ||
40 | |||
41 | handleEditButtonAction: { | ||
42 | value: function(e) { | ||
43 | console.log('handle edit button action'); | ||
44 | this.editing = true; | ||
45 | } | ||
46 | }, | ||
47 | _editing : { | ||
48 | value: null | ||
49 | }, | ||
50 | editing : { | ||
51 | get: function() { | ||
52 | return this._editing; | ||
53 | }, | ||
54 | set: function(enterEditingMode) { | ||
55 | this._editing = enterEditingMode; | ||
56 | this.needsDraw = true; | ||
57 | } | ||
58 | }, | ||
59 | |||
60 | handleClick : { | ||
61 | value: function(e) { | ||
62 | console.log("handle click"); | ||
63 | if(e.target !== this.editView) { | ||
64 | this.editing = false; | ||
65 | } | ||
66 | } | ||
67 | }, | ||
68 | |||
69 | mediaInput: { | ||
70 | value: null | ||
71 | }, | ||
72 | |||
73 | _name: { | ||
74 | value: null | ||
75 | }, | ||
76 | name : { | ||
77 | get: function() { | ||
78 | return this._name; | ||
79 | }, | ||
80 | set: function(text) { | ||
81 | this._name = text; | ||
82 | } | ||
83 | }, | ||
84 | _source : { | ||
85 | value: null | ||
86 | }, | ||
87 | source : { | ||
88 | get: function() { | ||
89 | return this._source; | ||
90 | }, | ||
91 | set: function(sheet) { | ||
92 | console.log('sheet being set'); | ||
93 | if(sheet.href) { | ||
94 | this.name = sheet.href.substring(sheet.href.lastIndexOf('/')+1); | ||
95 | } else { | ||
96 | this.name = 'Style Tag'; | ||
97 | } | ||
98 | this._source = sheet; | ||
99 | } | ||
100 | } | ||
101 | }); \ No newline at end of file | ||