diff options
Diffstat (limited to 'js/panels/css-panel/styles-view-container.reel')
3 files changed, 309 insertions, 0 deletions
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.css b/js/panels/css-panel/styles-view-container.reel/styles-view-container.css new file mode 100644 index 00000000..bec2f449 --- /dev/null +++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.css | |||
@@ -0,0 +1,33 @@ | |||
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 | .sub-panel-slot { | ||
7 | background-color: #FFF; | ||
8 | display: -webkit-box; | ||
9 | -webkit-box-orient: vertical; | ||
10 | -webkit-box-flex: 1; | ||
11 | } | ||
12 | .no-styles .sub-panel-slot, .no-styles .styles-view-toolbar-container { | ||
13 | display: none; | ||
14 | } | ||
15 | .styles-view-container .panel-message { | ||
16 | display: none; | ||
17 | } | ||
18 | .styles-view-container.no-styles .panel-message { | ||
19 | display: block; | ||
20 | } | ||
21 | .styles-view-toolbar-container { | ||
22 | border-top: 1px solid #303030; | ||
23 | } | ||
24 | .styles-view-toolbar-container .toolbar-container { | ||
25 | border-top: 1px solid #5c5c5c; | ||
26 | } | ||
27 | |||
28 | /* ----- Toolbar ----*/ | ||
29 | |||
30 | .styles-view-container .toolbar-computed-button { | ||
31 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6b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5CSBGLhFy9eyCkpKdlOmDBhNpCvh88QkAF%2FQQw2NjZuX1%2FfxNDQ0AIREREbkJi%2Bvr7OxIkTZwGZaiAl2AxgBGLtVatW7RMVFRXDZcvBgwcnNDQ01AKZX9DlmIH417Vr186ws7NzPn78%2BNW9e%2Feevnz5kkFGRgYUiAyXLl26XFFR0QBkvoC5FpsrOIFYHIjlQX4OCgqaAgrYvr6%2B60C%2BHRBzQ73LAqVRwuA%2FEH8H4pdA%2FBCI7wO98%2FjRo0dPgE4%2FYmJi8hcalXxxcXG2QFoKOTyYsTnpPxCIiYkZRkREBL5%2B%2FfruuXPnzgKFJSorK5cpKCioHDt27BqQ%2FwnkJSYs%2Bn8DNTyFuozh7du3skBKEZRGvn37xuft7Z2Ym5sLChMlkEtYsDkAFLDMzMx%2FQBwzMzMvHR0d3d%2B%2Ff3Pw8vKCUisDMIzCgfK%2FgemkghFHzAkkJSXlxsbGNuGK2p9A4OHhoc%2BCQ%2F7LvHnz5j98%2BPCepKSk1r9%2F%2F5g%2Ff%2F4sBkxkYbKystzAVPt7ypQpIMPfEUrmHKDQhyZ3mwULFjzZsWPHTy8vrxogXxpXJOACSsAMdxro%2FwJkzYwkGMANdc0PWBSCBAECDAAwy7PLmtswugAAAABJRU5ErkJggg%3D%3D); | ||
32 | |||
33 | } \ No newline at end of file | ||
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.html b/js/panels/css-panel/styles-view-container.reel/styles-view-container.html new file mode 100644 index 00000000..9868f486 --- /dev/null +++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.html | |||
@@ -0,0 +1,91 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
6 | </copyright> --> | ||
7 | <html lang="en"> | ||
8 | <head> | ||
9 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
10 | <link href="styles-view-container.css" rel="stylesheet" type="text/css"> | ||
11 | <script type="text/montage-serialization"> | ||
12 | { | ||
13 | "owner": { | ||
14 | "module" : "js/panels/css-panel/styles-view-container.reel", | ||
15 | "name" : "StylesViewContainer", | ||
16 | "properties" : { | ||
17 | "element" : {"#" : "container"}, | ||
18 | "ruleListContainer": {"@": "ruleListContainer" }, | ||
19 | "computedStyleView": {"@": "computedStyleView" }, | ||
20 | "substitution": {"@": "substitution" }, | ||
21 | "toolbar": {"@": "toolbar"} | ||
22 | } | ||
23 | }, | ||
24 | "substitution": { | ||
25 | "module": "montage/ui/substitution.reel", | ||
26 | "name": "Substitution", | ||
27 | "properties": { | ||
28 | "element": {"#": "sub-panel-slot"}, | ||
29 | "switchComponents": { | ||
30 | "rules": {"@": "ruleListContainer"}, | ||
31 | "computed": {"@": "computedStyleView"} | ||
32 | } | ||
33 | }, | ||
34 | "bindings": { | ||
35 | "switchValue": { | ||
36 | "boundObject": {"@": "owner"}, | ||
37 | "boundObjectPropertyPath": "contentPanel", | ||
38 | "oneway": true | ||
39 | } | ||
40 | } | ||
41 | }, | ||
42 | "stylesViewDelegate" : { | ||
43 | "module": "js/panels/css-panel/styles-view-delegate", | ||
44 | "name": "StylesViewMediator", | ||
45 | "properties": { | ||
46 | "ruleListContainer": {"@": "ruleListContainer"} | ||
47 | } | ||
48 | }, | ||
49 | "ruleListContainer": { | ||
50 | "module": "js/panels/css-panel/rule-list-container.reel", | ||
51 | "name": "RuleListContainer", | ||
52 | "properties": { | ||
53 | "focusDelegate": {"@": "stylesViewDelegate"} | ||
54 | } | ||
55 | }, | ||
56 | "computedStyleView": { | ||
57 | "module": "js/panels/CSSPanel/ComputedStyleSubPanel.reel", | ||
58 | "name": "ComputedStyleSubPanel" | ||
59 | }, | ||
60 | "toolbar": { | ||
61 | "module": "js/components/toolbar.reel", | ||
62 | "name": "Toolbar", | ||
63 | "properties": { | ||
64 | "element": {"#": "styles-view-toolbar"}, | ||
65 | "delegate": {"@": "stylesViewDelegate" }, | ||
66 | "buttons": [ | ||
67 | { | ||
68 | "title": "Add", | ||
69 | "identifier": "add" | ||
70 | }, | ||
71 | { | ||
72 | "title": "Computed Styles", | ||
73 | "identifier": "computed", | ||
74 | "leftAlign": true | ||
75 | } | ||
76 | ] | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | </script> | ||
81 | </head> | ||
82 | <body> | ||
83 | <div id="container" class="styles-view-container"> | ||
84 | <h4 id="no-styles-message" class="panel-message">No styles to display.</h4> | ||
85 | <div id="sub-panel-slot" class="sub-panel-slot"></div> | ||
86 | <div class="styles-view-toolbar-container"> | ||
87 | <div id="styles-view-toolbar"></div> | ||
88 | </div> | ||
89 | </div> | ||
90 | </body> | ||
91 | </html> \ No newline at end of file | ||
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..e63e3c74 --- /dev/null +++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js | |||
@@ -0,0 +1,185 @@ | |||
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.StylesViewContainer = Montage.create(Component, { | ||
11 | contentController : { | ||
12 | value: null | ||
13 | }, | ||
14 | contentPanel : { | ||
15 | value: 'rules' | ||
16 | }, | ||
17 | _selectionNameLabelText : { | ||
18 | value: null | ||
19 | }, | ||
20 | selectionNameLabelText : { | ||
21 | get: function() { | ||
22 | return this._selectionNameLabelText; | ||
23 | }, | ||
24 | set: function(value) { | ||
25 | if(value === this._selectionNameLabelText) { return false; } | ||
26 | |||
27 | this._selectionNameLabelText = value; | ||
28 | |||
29 | this.needsDraw = true; | ||
30 | } | ||
31 | }, | ||
32 | _lastSelection : { | ||
33 | value: null | ||
34 | }, | ||
35 | _hasStyles : { | ||
36 | value: false | ||
37 | }, | ||
38 | hasStyles : { | ||
39 | get: function() { | ||
40 | return this._hasStyles; | ||
41 | }, | ||
42 | set: function(hasThem) { | ||
43 | this._hasStyles = hasThem; | ||
44 | //caller needs to set ndt | ||
45 | //this.needsDraw = true; | ||
46 | } | ||
47 | }, | ||
48 | |||
49 | _getElementLabel : { | ||
50 | value: function(el) { | ||
51 | var id = '#'+el.id, | ||
52 | className = '.'+Array.prototype.slice.call(el.classList).join('.'), | ||
53 | nodeName = el.nodeName; | ||
54 | |||
55 | if(id.length > 1) { | ||
56 | return nodeName + id; | ||
57 | } else if(className.length > 1) { | ||
58 | return nodeName + className; | ||
59 | } | ||
60 | |||
61 | return nodeName; | ||
62 | } | ||
63 | }, | ||