# OpenLayers.Control.Panel

The Panel control is a container for other controls. With it toolbars may be composed.

#### Inherits from

- OpenLayers.Control

Summary

OpenLayers.Control.Panel | The Panel control is a container for other controls.
Properties |
autoActivate | {Boolean} Activate the control when it is added to a map.
defaultControl | {OpenLayers.Control} The control which is activated when the control is activated (turned on), which also happens at instantiation.
saveState | {Boolean} If set to true, the active state of this panel’s controls will be stored on panel deactivation, and restored on reactivation.
allowDepress | {Boolean} If is true the OpenLayers.Control.TYPE_TOOL controls can be deactivated by clicking the icon that represents them.
Constructor |
OpenLayers.Control.Panel | Create a new control panel.
Functions |
destroy |
activate |
deactivate |
activateControl | This method is called when the user click on the icon representing a control in the panel.
addControls | To build a toolbar, you add a set of controls to it.
getControlsBy | Get a list of controls with properties matching the given criteria.
getControlsByName | Get a list of contorls with names matching the given name.
getControlsByClass | Get a list of controls of a given type (CLASS_NAME).

### Properties

### autoActivate

{Boolean} Activate the control when it is added to a map. Default is true.

### defaultControl

{OpenLayers.Control} The control which is activated when the control is activated (turned on), which also happens at instantiation. If saveState is true, defaultControl will be nullified after the first activation of the panel.

### 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.

### allowDepress

{Boolean} If is true the OpenLayers.Control.TYPE_TOOL controls can be deactivated by clicking the icon that represents them. Default is false.

### Constructor

### OpenLayers.Control.Panel

Create a new control panel.

Each control in the panel is represented by an icon. When clicking on an icon, the activateControl method is called.

#### Specific properties for controls on a panel

type | {Number} One of OpenLayers.Control.TYPE_TOOL, OpenLayers.Control.TYPE_TOGGLE, OpenLayers.Control.TYPE_BUTTON. If not provided, OpenLayers.Control.TYPE_TOOL is assumed.
title | {string} Text displayed when mouse is over the icon that represents the control.

The OpenLayers.Control.type of a control determines the behavior when clicking its icon: OpenLayers.Control.TYPE_TOOL - The control is activated and other controls of this type in the same panel are deactivated. This is the default type. OpenLayers.Control.TYPE_TOGGLE - The active state of the control is toggled. OpenLayers.Control.TYPE_BUTTON - The <OpenLayers.Control.Button.trigger> method of the control is called, but its active state is not changed.

If a control is OpenLayers.Control.active, it will be drawn with the olControl[Name]ItemActive class, otherwise with the olControl[Name]ItemInactive class.

#### Parameters

options | {Object} An optional object whose properties will be used to extend the control.

### Functions

### destroy

> destroy: function()

### activate

> activate: function()

### deactivate

> deactivate: function()

### activateControl

> activateControl: function ( | control | )

This method is called when the user click on the icon representing a control in the panel.

#### Parameters

control | {OpenLayers.Control}

### addControls

> addControls: function( | controls | )

To build a toolbar, you add a set of controls to it. addControls lets you add a single control or a list of controls to the Control Panel.

#### Parameters

controls | {OpenLayers.Control} Controls to add in the panel.

### getControlsBy

> getControlsBy: function( | property,
> | match | )

Get a list of controls with properties matching the given criteria.

#### Parameter

property | {String} A control property to be matched.
match | {String | Object} A string to match. Can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if match.test(control[property]) evaluates to true, the control will be included in the array returned. If no controls are found, an empty array is returned.

#### Returns

{Array(OpenLayers.Control)} A list of controls matching the given criteria. An empty array is returned if no matches are found.

### getControlsByName

> getControlsByName: function( | match | )

Get a list of contorls with names matching the given name.

#### Parameter

match | {String | Object} A control name. The name can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if name.test(control.name) evaluates to true, the control will be included in the list of controls returned. If no controls are found, an empty array is returned.

#### Returns

{Array(OpenLayers.Control)} A list of controls matching the given name. An empty array is returned if no matches are found.

### getControlsByClass

> getControlsByClass: function( | match | )

Get a list of controls of a given type (CLASS_NAME).

#### Parameter

match | {String | Object} A control class name. The type can also be a regular expression literal or object. In addition, it can be any object with a method named test. For reqular expressions or other, if type.test(control.CLASS_NAME) evaluates to true, the control will be included in the list of controls returned. If no controls are found, an empty array is returned.

#### Returns

{Array(OpenLayers.Control)} A list of controls matching the given type. An empty array is returned if no matches are found.

Controls affect the display or behavior of the map.

> destroy: function()

> activate: function()

> deactivate: function()

> activateControl: function ( | control | )

This method is called when the user click on the icon representing a control in the panel.

> addControls: function( | controls | )

To build a toolbar, you add a set of controls to it.

> getControlsBy: function( | property,
> | match | )

Get a list of controls with properties matching the given criteria.

> getControlsByName: function( | match | )

Get a list of contorls with names matching the given name.

> getControlsByClass: function( | match | )

Get a list of controls of a given type (CLASS_NAME).
{Boolean} If set to true, the active state of this panel’s controls will be stored on panel deactivation, and restored on reactivation.
{OpenLayers.Control} The control which is activated when the control is activated (turned on), which also happens at instantiation.
{Number} Controls can have a ‘type’.
{Boolean} The control is active (read-only).
Close