Click or drag to resize

Telogis.GeoBase.AbstractDOMEntity

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release

An abstract base class for constructs that are based on a DOM element, such as map layers and widgets. Primarily, this combines the features of MapLayers.AbstractLayer and Widgets.AbstractWidget to allow code re-use. Note that because of the varying treatments of top-level DOM nodes between these, creation of a base element is left to the derived class.

Constructor
NameDescription
AbstractDOMEntity(config, initMode, elemInitFunc)

Arguments

  • (Optional)config (Object) - Configuration options for the DOM construct. Defaults to {}.

    Properties
    NameTypeDescription
    eventsNumber

    A combination of AbstractDOMEntity.EVENT_* flags that specifies which event handlers should be created for this entity. By default, all event handlers are enabled, but manually specifying only those that are actually used can improve performance.

    Defaults to AbstractDOMEntity.EVENT_ALL.
    idString

    The string identifier for the AbstractDOMEntity. This will often be the ID of some DOM node on the page (usually a div), or may specify a meaningful string for ease of reference to the created object. If this is left out, the widget is created anonymously.

    showBoolean

    Whether to initialize the entity as visible.

    Defaults to true.
    silentBoolean

    Whether to suppress diagnostic console output.

    Defaults to false.
  • (Optional)initMode (Number) - The degree to which the AbstractDOMEntity should be initialized, specified as a combination of AbstractDOMEntity.INIT_* flags. This can be used to stagger the construction of the entity over multiple calls. Note that data initialization must be performed before DOM initialization. Defaults to AbstractDOMEntity.INIT_ALL.

  • (Optional)elemInitFunc (Function) - A callback that initializes the entity's underlying DOM element. If not specified, this element is created as a div and no further action is taken. When this function is executed, AbstractDOMEntity.id and AbstractDOMEntity._silent have been initialized. Defaults to function () {return document.createElement ('div');}.

Functions
NameDescription
addEvent (String eventType, Function action)

Adds an event handler to the DOM entity, such that when a named event type is triggered, the function pointed to by AbstractDOMEntity.addEvent.action is called.

Arguments
  • eventType (String) - The type of event to append a handler for, without the 'on' prefix.

  • action (Function) - The function to be called when the event occurs.

    Arguments
    • e (Object) - The object describing the event that triggered the callback.

attach (Element parent)

Appends the entity's DOM to a given parent node, preserving visibility information.

Arguments
  • parent (Element) - the DOM node to attach the entity to.

destroy ()

Deallocates properties of the DOM entity and deletes references where appropriate, breaking circular references for leak prevention. This should only be called when the entity will never be used again.

destroyInstances ()

Calls AbstractDOMEntity.destroy on every recorded AbstractDOMEntity instance. This is called automatically by Telogis.GeoBase.destroy when the page unloads.

detach ()

Removes the entity's DOM from its currently acknowledged parent node, preserving visibility information.

getVisibility ()

Gets a number indicating the visibility of the AbstractDOMEntity.

Returns

Number - The visibility value of the DOM entity. If this is zero or negative, the entity is hidden; if it is positive, the entity is visible.

hide (Number visibility)

Hides the entity on the page. This is accomplished by detaching its DOM tree from its parent node, but differs from AbstractDOMEntity.detach in that it continues to acknowledge the entity's prior parent node.

Arguments
  • (Optional) visibility (Number) - an override for the entity's visibility counter, which will determine whether it is actually hidden. Defaults to 0.

hideCumulative ()

Stops the entity from displaying on the page. This may be stacked with other calls to AbstractDOMEntity.hideCumulative and AbstractDOMEntity.showCumulative, such that the entity is only hidden once AbstractDOMEntity.hideCumulative has been called for every AbstractDOMEntity.showCumulative, and vice versa.

isVisible ()

Determines whether the entity is currently visible.

Returns

Boolean - True if the entity is showing; false if it is hidden.

log (String text)

A simple wrapper to Console.writeLine that performs output only if the AbstractDOMEntity has not been configured as silent.

Arguments
  • text (String) - the output to display if the entity is not silent.

popFromTop ()

Restores the z-index of the entity after a call to AbstractDOMEntity.pushToTop.

pushToTop (Number top)

Temporarily adjusts the z-index of the entity so that it is displayed above all other elements until AbstractDOMEntity.popFromTop is called.

Arguments
  • (Optional) top (Number) - an optional override for the CSS z-index to adjust the entity to. Defaults to Telogis.Internal.ZIndices.TOP.

removeEvent (String eventType, Function action)

Removes an event handler registered by AbstractDOMEntity.addEvent from the entity.

Arguments
  • eventType (String) - the type of event to remove the handler from.

  • action (Function) - the function to remove from the event handler.

    Arguments
    • e (Object) - the object describing the event triggering the callback.

setVisibility (Boolean value)

Sets whether the entity is currently visible.

Arguments
  • value (Boolean) - true to show the entity; false otherwise.

show (Number visibility, Function beforeUpdate)

Shows the entity on the page. This is accomplished by attaching its DOM tree to the acknowledged parent, but differs from AbstractDOMEntity.attach in that it guarantees immediate attachment.

Arguments
  • (Optional) visibility (Number) - an override for the entity's visibility counter, which will determine whether it is actually shown. If 0 or less will not be shown; if greater than 0 then show. Defaults to 0.

  • (Optional) beforeUpdate (Function) - a function to call (in arbitrary scope) once the entity's DOM has been rendered visible, but before any queued show-callbacks are executed. Takes no parameters. Defaults to null.

showCumulative (Boolean stealthy)

Shows the entity on the page. This may be nested with other calls to MapLayers.AbstractLayer.showCumulative and MapLayers.AbstractLayer.hideCumulative, such that the entity is only shown once MapLayers.AbstractLayer.showCumulative has been called for every MapLayers.AbstractLayer.hideCumulative, and vice versa.

Arguments
  • (Optional) stealthy (Boolean) - set this to true to stop any events from being triggered by the hide. Defaults to false.

toggleVisibility ()

Shows the entity if it is hidden and hides it if it is showing.

toString ()

Finds a string representation of the AbstractDOMEntity, which will be its AbstractDOMEntity.id.

Returns

String - a string representing the DOM entity.

whenDOMReady (Function callback)

Executes a function immediately if the DOM entity's element has been set up. If it has not, the function is queued to be called once this occurs.

Arguments
  • callback (Function) - an arbitrary function to execute (in the scope of the entity) when the entity's DOM is ready.

whenVisible (Function callback)

Executes a function immediately if the DOM entity is visible. If it is not, the function is queued to be called when the entity's AbstractDOMEntity.Show event handler is triggered.

Arguments
  • callback (Function) - an arbitrary function to execute (in the scope of the entity) when the entity is visible.

Properties
NameTypeDescription
ClickEventHandler

An event to be triggered when the entity is clicked, i.e. when the left mouse button is released on it.

DoubleClickEventHandler

An event to be triggered when the entity is double-clicked with the left mouse button.

elemElement

The underlying DOM element that the AbstractDOMEntity is displayed in.

EVENT_ALLNumber

A flag to enable full event handling.

EVENT_CLICKNumber

A flag to enable click event handling.

EVENT_DOUBLE_CLICKNumber

A flag to enable dblclick event handling.

EVENT_HIDENumber

A flag to enable handling of the event triggered when the entity is hidden.

EVENT_MOUSE_DOWNNumber

A flag to enable mousedown event handling.

EVENT_MOUSE_INNumber

A flag to enable mouseover event handling.

EVENT_MOUSE_MOVENumber

A flag to enable mousemove event handling.

EVENT_MOUSE_OUTNumber

A flag to enable mouseout event handling.

EVENT_MOUSE_UPNumber

A flag to enable mouseup event handling.

EVENT_NONENumber

A flag to completely disable event handling.

EVENT_RIGHT_CLICKNumber

A flag to enable contextmenu event handling.

EVENT_SHOWNumber

A flag to enable handling of the event triggered when the entity is shown.

HideEventHandler

An event triggered when the entity is hidden. This is not triggered if the hide call was to AbstractDOMEntity.hideCumulative and did not result in an actual hide.

idString

The name used to identify this AbstractDOMEntity within the Telogis.GeoBase API. This may also refer to its underlying DOM element.

INIT_DATANumber

An initialization flag for the entity's data.

INIT_DOMNumber

An initialization flag for the entity's DOM.

INIT_FULLNumber

An initialization flag for all the entity's components.

MouseDownEventHandler

An event to be triggered when the mouse button is pressed over the entity.

MouseInEventHandler

An event to be triggered when the mouse cursor enters the entity.

MouseMoveEventHandler

An event to be triggered when the mouse is moved over the entity.

MouseOutEventHandler

An event to be triggered when the mouse cursor leaves the entity.

MouseUpEventHandler

An event to be triggered when the mouse button is released over the entity.

RightClickEventHandler

An event to be triggered when the right mouse button is released on the entity.

ShowEventHandler

An event triggered when the entity is shown. This is not triggered if the show call was to AbstractDOMEntity.showCumulative and did not result in an actual show.

TouchEndEventHandler

An event to be triggered on a touch screen device when the screen is depressed over the entity.

TouchMoveEventHandler

An event to be triggered on a touch screen device while the screen is pressed and the touch point moved.

TouchStartEventHandler

An event to be triggered on a touch screen device when the screen is pressed over the entity.

TouchTapEventHandler

An event to be triggered on a touch screen device when the screen is pressed and then depressed at the same point within 500ms.