update id system -- now control and layer divs take their classname and add a random number

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1411 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-09-06 20:44:55 +00:00
parent 6fd2302450
commit 74f5b814eb
10 changed files with 7 additions and 37 deletions

View File

@@ -31,6 +31,8 @@ OpenLayers.Control.prototype = {
*/
initialize: function (options) {
Object.extend(this, options);
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
},
/**
@@ -60,10 +62,7 @@ OpenLayers.Control.prototype = {
draw: function (px) {
if (this.div == null) {
this.div = OpenLayers.Util.createDiv();
this.div.id = "Control";
if (this.id != null) {
this.div.id += "_" + this.id;
}
this.div.id = this.id;
}
if (px != null) {
this.position = px.clone();

View File

@@ -11,10 +11,6 @@ OpenLayers.Control.LayerSwitcher = Class.create();
OpenLayers.Control.LayerSwitcher.prototype =
Object.extend( new OpenLayers.Control(), {
/** For div.id
* @type String */
id: "LayerSwitcher",
/** @type String */
activeColor: "darkblue",

View File

@@ -27,10 +27,6 @@ OpenLayers.Control.LayerTabs.NONACTIVE_COLOR = "lightblue";
OpenLayers.Control.LayerTabs.prototype =
Object.extend( new OpenLayers.Control(), {
/** For div.id
* @type String */
id: "LayerTabs",
/** @type String */
activeColor: "",

View File

@@ -15,10 +15,6 @@ OpenLayers.Control.MouseToolbar.prototype =
Object.extend( new OpenLayers.Control(),
Object.extend( new OpenLayers.Control.MouseDefaults(), {
/** For div.id
* @type String */
id: "MouseToolbar",
mode: null,
buttons: null,

View File

@@ -13,10 +13,6 @@ OpenLayers.Control.PanZoom.Y = 4;
OpenLayers.Control.PanZoom.prototype =
Object.extend( new OpenLayers.Control(), {
/** For div.id
* @type String */
id: "PanZoom",
/** @type int */
slideFactor: 50,

View File

@@ -13,10 +13,6 @@ OpenLayers.Control.PanZoomBar.Y = 4;
OpenLayers.Control.PanZoomBar.prototype =
Object.extend( new OpenLayers.Control.PanZoom(), {
/** For div.id
* @type String */
id: "PanZoomBar",
/** @type Array(...) */
buttons: null,

View File

@@ -11,10 +11,6 @@ OpenLayers.Control.Permalink = Class.create();
OpenLayers.Control.Permalink.prototype =
Object.extend( new OpenLayers.Control(), {
/** For div.id
* @type String */
id: "Permalink",
/** @type DOMElement */
element: null,

View File

@@ -13,10 +13,6 @@ OpenLayers.Control.Scale.prototype =
/** @type DOMElement */
element: null,
/** For div.id
* @type String */
id: "Scale",
/**
* @constructor
*

View File

@@ -92,13 +92,13 @@ OpenLayers.Layer.prototype = {
this.name = name;
//generate unique id based on name
this.id = OpenLayers.Util.createUniqueID("Layer_");
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
if (this.div == null) {
this.div = OpenLayers.Util.createDiv();
this.div.style.width = "100%";
this.div.style.height = "100%";
this.div.id = this.id;
}
}
},