diff --git a/lib/OpenLayers/Control/Panel.js b/lib/OpenLayers/Control/Panel.js index 749329d2fb..cfe1ea4685 100644 --- a/lib/OpenLayers/Control/Panel.js +++ b/lib/OpenLayers/Control/Panel.js @@ -32,9 +32,25 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, { * APIProperty: defaultControl * {} The control which is activated when the control is * activated (turned on), which also happens at instantiation. + * If is true, will be nullified after the + * first activation of the panel. */ defaultControl: null, + /** + * APIProperty: saveState + * {Boolean} If set to true, the active state of this panel's controls will + * be stored on panel deactivation, and restored on reactivation. Default + * is false. + */ + saveState: false, + + /** + * Property: activeState + * {Object} stores the active state of this panel's controls. + */ + activeState: null, + /** * Constructor: OpenLayers.Control.Panel * Create a new control panel. @@ -71,6 +87,7 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, { initialize: function(options) { OpenLayers.Control.prototype.initialize.apply(this, [options]); this.controls = []; + this.activeState = {}; }, /** @@ -88,7 +105,8 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, { } OpenLayers.Event.stopObservingElement(this.controls[i].panel_div); this.controls[i].panel_div = null; - } + } + this.activeState = null; }, /** @@ -96,11 +114,17 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, { */ activate: function() { if (OpenLayers.Control.prototype.activate.apply(this, arguments)) { - for(var i=0, len=this.controls.length; i