[Commits] r756 - sandbox/elemoine/playground/geoext/examples
commits at geoext.org
commits at geoext.org
Fri May 15 15:07:43 CEST 2009
Author: elemoine
Date: 2009-05-15 15:07:43 +0200 (Fri, 15 May 2009)
New Revision: 756
Modified:
sandbox/elemoine/playground/geoext/examples/toolbar.js
Log:
add some separators in the toolbar, and push the menu button to the right of the toolbar
Modified: sandbox/elemoine/playground/geoext/examples/toolbar.js
===================================================================
--- sandbox/elemoine/playground/geoext/examples/toolbar.js 2009-05-15 09:38:22 UTC (rev 755)
+++ sandbox/elemoine/playground/geoext/examples/toolbar.js 2009-05-15 13:07:43 UTC (rev 756)
@@ -9,61 +9,63 @@
var vector = new OpenLayers.Layer.Vector("vector");
map.addLayers([wms, vector]);
- var ctrl, toolbarItems = [];
+ var ctrl, toolbarItems = [], action, actions = {};
// ZoomToMaxExtent control, a "button" control
ctrl = new OpenLayers.Control.ZoomToMaxExtent();
map.addControl(ctrl);
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl, {
- text: "max extent"
- })
- );
+ action = GeoExt.Action.fromControl(ctrl, {
+ text: "max extent"
+ })
+ actions["max_extent"] = action;
+ toolbarItems.push(action);
+ toolbarItems.push("-");
// Navigation control and DrawFeature controls
// in the same toggle group
ctrl = new OpenLayers.Control.Navigation();
map.addControl(ctrl);
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl, {
- text: "nav",
- // button options
- toggleGroup: "draw",
- allowDepress: false,
- pressed: true,
- // check item options
- group: "draw",
- checked: true
- })
- );
+ action = GeoExt.Action.fromControl(ctrl, {
+ text: "nav",
+ // button options
+ toggleGroup: "draw",
+ allowDepress: false,
+ pressed: true,
+ // check item options
+ group: "draw",
+ checked: true
+ });
+ actions["nav"] = action;
+ toolbarItems.push(action);
ctrl = new OpenLayers.Control.DrawFeature(
vector, OpenLayers.Handler.Polygon
);
map.addControl(ctrl);
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl, {
- text: "draw poly",
- // button options
- toggleGroup: "draw",
- allowDepress: false,
- // check item options
- group: "draw"
- })
- );
+ action = GeoExt.Action.fromControl(ctrl, {
+ text: "draw poly",
+ // button options
+ toggleGroup: "draw",
+ allowDepress: false,
+ // check item options
+ group: "draw"
+ });
+ actions["draw_poly"] = action;
+ toolbarItems.push(action);
ctrl = new OpenLayers.Control.DrawFeature(
vector, OpenLayers.Handler.Path
);
map.addControl(ctrl);
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl, {
- text: "draw line",
- // button options
- toggleGroup: "draw",
- allowDepress: false,
- // check item options
- group: "draw"
- })
- );
+ action = GeoExt.Action.fromControl(ctrl, {
+ text: "draw line",
+ // button options
+ toggleGroup: "draw",
+ allowDepress: false,
+ // check item options
+ group: "draw"
+ });
+ actions["draw_line"] = action;
+ toolbarItems.push(action);
+ toolbarItems.push("-");
// SelectFeature control, a "toggle" control
ctrl = new OpenLayers.Control.SelectFeature(vector, {
@@ -71,29 +73,31 @@
hover: true
});
map.addControl(ctrl);
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl, {
- text: "select",
- // button options
- enableToggle: true
- })
- );
+ action = GeoExt.Action.fromControl(ctrl, {
+ text: "select",
+ // button options
+ enableToggle: true
+ });
+ actions["select"] = action;
+ toolbarItems.push(action);
+ toolbarItems.push("-");
// Navigation history - two "button" controls
ctrl = new OpenLayers.Control.NavigationHistory();
map.addControl(ctrl);
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl.previous, {
- text: "previous",
- disabled: true
- })
- );
- toolbarItems.push(
- GeoExt.Action.fromControl(ctrl.next, {
- text: "next",
- disabled: true
- })
- );
+ action = GeoExt.Action.fromControl(ctrl.previous, {
+ text: "previous",
+ disabled: true
+ });
+ actions["previous"] = action;
+ toolbarItems.push(action);
+ action = GeoExt.Action.fromControl(ctrl.next, {
+ text: "next",
+ disabled: true
+ });
+ actions["next"] = action;
+ toolbarItems.push(action);
+ toolbarItems.push("->");
// Reuse the GeoExt.Action objects created above
// as menu items
@@ -102,18 +106,18 @@
menu: new Ext.menu.Menu({
items: [
// ZoomToMaxExtent
- toolbarItems[0],
+ actions["max_extent"],
// Nav
- new Ext.menu.CheckItem(toolbarItems[1]),
+ new Ext.menu.CheckItem(actions["nav"]),
// Draw poly
- new Ext.menu.CheckItem(toolbarItems[2]),
+ new Ext.menu.CheckItem(actions["draw_poly"]),
// Draw line
- new Ext.menu.CheckItem(toolbarItems[3]),
+ new Ext.menu.CheckItem(actions["draw_line"]),
// Select control
- new Ext.menu.CheckItem(toolbarItems[4]),
+ new Ext.menu.CheckItem(actions["select"]),
// Navigation history control
- toolbarItems[5],
- toolbarItems[6]
+ actions["previous"],
+ actions["next"],
]
})
});
More information about the Commits
mailing list