Source: BKGWebMap/Control/Link.js

/*
 * Copyright (c) 2013 Bundesamt für Kartographie und Geodäsie.
 * See license.txt in the BKG WebMap distribution or repository for the
 * full text of the license.
 *
 * Author: Dirk Thalheim
 */

/**
 * @requires OpenLayers/BaseTypes/Class.js
 * @requires OpenLayers/Control/Button.js
 * @requires BKGWebMap/Control.js
 */

/**
 * @classdesc Einfache Darstellung eines Links innerhalb der Karte
 *
 * @constructor BKGWebMap.Control.Link
 * @param {object} options - Optionen für das Controlelement
 */
BKGWebMap.Control.Link = OpenLayers.Class(OpenLayers.Control,
{
	/**
     * URL für href-Attribut des Links
     * @memberOf BKGWebMap.Control.Link
     * @type string
     */
	href: null,

	/**
     * Zielframe
     * @memberOf BKGWebMap.Control.Link
     * @type string
     */
	target: '_top',

	/**
     * Link title
     * @memberOf BKGWebMap.Control.Link
     * @type string
     */
	title: '',

	/**
     * Link-Inhalt
     * @memberOf BKGWebMap.Control.Link
     * @type string
     */
	content: null,

	/**
     * der konstruierte Link
     * @memberOf BKGWebMap.Control.Link
     * @type HTMLElement
     */
	link: null,

    initialize:function(options) {
        OpenLayers.Control.prototype.initialize.apply(this, [options]);
    },

    destroy:function() {
        OpenLayers.Control.prototype.destroy.apply(this, arguments);
    },

    draw:function(px) {
    	var div = OpenLayers.Control.prototype.draw.apply(this, arguments);
    	if(this.link != null) {
    		return div;
    	}

        this.link = document.createElement('a');
        this.link.href = this.href;
        this.link.title = this.title;
        this.link.target = this.target;
        this.link.innerHTML = this.content;

        div.appendChild(this.link);

    	return div;
    },

    CLASS_NAME: "BKGWebMap.Control.Link"
});