[Commits] r848 - in apps/opengeo/geoexplorer/trunk: lib/GeoExplorer/Embed theme
commits at geoext.org
commits at geoext.org
Fri May 22 21:45:30 CEST 2009
Author: dwins
Date: 2009-05-22 21:45:30 +0200 (Fri, 22 May 2009)
New Revision: 848
Modified:
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Embed/Embed.js
apps/opengeo/geoexplorer/trunk/theme/geoexplorer.css
Log:
Spiff up the embedded layer switcher a bit by using an icon and switching it to use Ext's menu button support.
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Embed/Embed.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Embed/Embed.js 2009-05-22 18:20:28 UTC (rev 847)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Embed/Embed.js 2009-05-22 19:45:30 UTC (rev 848)
@@ -119,23 +119,30 @@
var tools =
GeoExplorer.Embed.superclass.createTools.apply(this, arguments);
- var layerChooser = new Ext.Button({
- text: 'Layers',
- // iconCls: 'bmenu',
- handler: function(item, evt) {
- var menu = new Ext.menu.Menu({items:
- ['<h3> <img height="24" width="48" src="http://www.google.com/logos/us_doodle4google09.gif"></img> Layers </h3>']
- });
+ var menu = new Ext.menu.Menu();
- this.mapPanel.layers.each(function(x) {
- menu.addItem(new GeoExplorer.LayerMenuItem({
- layerRecord: x
- }));
- });
+ var updateLayerSwitcher = function() {
+ menu.removeAll();
+ menu.addItem(new Ext.menu.TextItem({
+ text: '<h3> <img height="24" width="48" src="http://www.google.com/logos/us_doodle4google09.gif"></img> Layers </h3>'
+ }));
+ this.mapPanel.layers.each(function(x) {
+ if (x.get("layer").displayInLayerSwitcher) {
+ menu.addItem(new GeoExplorer.LayerMenuItem({
+ layerRecord: x
+ }));
+ }
+ });
+ }
- menu.show(evt.getTarget());
- },
- scope: this
+ this.mapPanel.layers.on("update", updateLayerSwitcher, this);
+ this.mapPanel.layers.on("remove", updateLayerSwitcher, this);
+ this.mapPanel.layers.on("add", updateLayerSwitcher, this);
+
+ var layerChooser = new Ext.Button({
+ tooltip: 'Layer Switcher',
+ iconCls: 'icon-layer-switcher',
+ menu: menu
});
tools.unshift(layerChooser);
Modified: apps/opengeo/geoexplorer/trunk/theme/geoexplorer.css
===================================================================
--- apps/opengeo/geoexplorer/trunk/theme/geoexplorer.css 2009-05-22 18:20:28 UTC (rev 847)
+++ apps/opengeo/geoexplorer/trunk/theme/geoexplorer.css 2009-05-22 19:45:30 UTC (rev 848)
@@ -47,6 +47,10 @@
background-image: url(img/geosilk/ruler_square.png);
}
+.x-btn .icon-layer-switcher {
+ background-image: url(img/silk/layers.png);
+}
+
.x-btn .icon-zoom-in {
background-image: url(img/silk/magnifier_zoom_in.png);
}
More information about the Commits
mailing list