Maps API for JavaScript Developer's Guide

H.ui.InfoBubble

Class Summary

Extends: H.ui.base.Element

This class represents an information bubble bound to a geographic position on the map.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

dispose ()

This method disposes of the given InfoBubble instance.

setPosition (position)

This method sets the geographic location of the given info bubble.

getState () : {H.ui.InfoBubble.State}

This method retrieves the current state of the info bubble instance.

setState (state)

This method sets the state of the info bubble.

close ()

This method closes the info bubble (setting its state to CLOSED).

open ()

This method opens the info bubble (setting its state to OPEN).

getContentElement () : {?HTMLElement}

This method retrieves the content element of the info bubble object.

setContent (content)

This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of the given info bubble or an HTML node to be appended to the content element.

addEventListener (type, handler, opt_capture, opt_scope)

This method sets a listener for a specific event triggered by the given element.

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the event target.

renderInternal (element, doc)

This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes.

isDisabled () : {boolean}

This method retrieves a value indicating if the given UI element is disabled.

setDisabled (disabled, opt_force) : {H.ui.base.Element}

This method sets a value indicating if the given UI element is disabled.

getData () : {*}

This method retrieves previously stored arbitrary data from the given element.

setData (data)

This method stores arbitrary data with the given UI element.

getElement () : {?HTMLElement}

This method retrieves the HTML element the given UI element renders.

setVisibility (visibility)

This method sets a value indicating if the given element is visible.

getVisibility () : {boolean}

This method retrieves a value indicating if the given element is visibile.

addClass (className) : {H.ui.base.Element}

This method adds a CSS class to the given UI element (if it is not already present).

removeClass (className) : {H.ui.base.Element}

This method removes a CSS class from the given UI element (if it is present).

Events Summary

Table 2. Events
Events

statechange : {H.util.Event}

This event is dispatched when the state of the bubble has changed.

Class Description

This class represents an information bubble bound to a geographic position on the map.

Constructor Details

H.ui.InfoBubble(position, opt_options)

Parameters:
 
position:
{H.geo.IPoint}
 
The geographic location to which this info bubble corresponds
opt_options:
{H.ui.InfoBubble.Options=} [optional]
 
An object containing optional initialization parameters to be passed to the info bubble

Method Details

dispose ()

This method disposes of the given InfoBubble instance.

Note: Disposing of an info bubble does not automatically remove it from the UI's info bubble collection. Please call H.ui.UI#removeBubble before disposing of an info bubble instance.

setPosition (position)

This method sets the geographic location of the given info bubble.

Parameters:
 
position:
{(H.geo.IPoint | H.geo.Point)}
 
An object defining the geographic location of the bubble

getState () : {H.ui.InfoBubble.State}

This method retrieves the current state of the info bubble instance.

Returns:
 
{H.ui.InfoBubble.State}
A value indicating the current state of the info bubble

setState (state)

This method sets the state of the info bubble.

Parameters:
 
state:
{H.ui.InfoBubble.State}
 
A value indicating the new state of the info bubble

close ()

This method closes the info bubble (setting its state to CLOSED).

open ()

This method opens the info bubble (setting its state to OPEN).

getContentElement () : {?HTMLElement}

This method retrieves the content element of the info bubble object.

Note: The content element is null before the info bubble has been added to a UI object.

Returns:
 
{?HTMLElement}
The content element of the given info bubble object

setContent (content)

This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of the given info bubble or an HTML node to be appended to the content element.

Parameters:
 
content:
{(string | Node)}
 
An object representing the content for the given bubble

addEventListener (type, handler, opt_capture, opt_scope)

This method sets a listener for a specific event triggered by the given element.

Parameters:
 
type:
{string}
 
The name of the event type
handler:
{!Function}
 
An event handler function to be invoked when the event is fired
opt_capture:
{boolean=} [optional]
 
If true, listening is active in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
The scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the event target.

Parameters:
 
type:
{string}
 
The name of the event type
handler:
{!Function}
 
The previously added event handler
opt_capture:
{boolean=} [optional]
 
If true, listening is active in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
The scope for the handler function

renderInternal (element, doc)

This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes.

Parameters:
 
element:
{Element}
 
The HTML representation of the given UI element
doc:
{Document}
 
The HTML document into which the give UI element is rendered

isDisabled () : {boolean}

This method retrieves a value indicating if the given UI element is disabled.

Returns:
 
{boolean}
true if the element is disabled, false otherwise

setDisabled (disabled, opt_force) : {H.ui.base.Element}

This method sets a value indicating if the given UI element is disabled.

Parameters:
 
disabled:
{boolean}
 
true to disable the element, false to enable it
opt_force:
{boolean=} [optional]
 
An optional Boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
 
{H.ui.base.Element}
An object representing the given element instance

getData () : {*}

This method retrieves previously stored arbitrary data from the given element.

Returns:
 
{*}
The previously stored data object or null if no data was stored.

setData (data)

This method stores arbitrary data with the given UI element.

Parameters:
 
data:
{*}
 
The data to be stored

getElement () : {?HTMLElement}

This method retrieves the HTML element the given UI element renders.

Note: If the UI element has not been rendered, the method retrieves null.

Returns:
 
{?HTMLElement}
An object representing the given element instance or null

setVisibility (visibility)

This method sets a value indicating if the given element is visible.

Parameters:
 
visibility:
{boolean}
 
true if the given element is visible, otherwise false

getVisibility () : {boolean}

This method retrieves a value indicating if the given element is visibile.

Returns:
 
{boolean}
true if the given element is visible, otherwise false

addClass (className) : {H.ui.base.Element}

This method adds a CSS class to the given UI element (if it is not already present).

Parameters:
 
className:
{string}
 
The name of the CSS class to add
Returns:
 
{H.ui.base.Element}
The given UI element instance

removeClass (className) : {H.ui.base.Element}

This method removes a CSS class from the given UI element (if it is present).

Parameters:
 
className:
{string}
 
The CSS class name to add
Returns:
 
{H.ui.base.Element}
The given UI element instance

Event Details

statechange: {H.util.Event}

This event is dispatched when the state of the bubble has changed.