Class: _Button

LocusZoom_Widgets~_Button(parent)

Plots and panels may have a "toolbar" element suited for showing HTML widgets that may be interactive. When widgets need to incorporate a generic button, or additionally a button that generates a menu, this class provides much of the necessary framework. This widget is rarely used directly; it is usually used as part of the code for other widgets.

Constructor

new _Button(parent)

Parameters:
Name Type Description
parent BaseWidget
Source:

Members

color :String

Color of the button

Type:
  • String
Source:

(protected) html :String

HTML for the button to show.

Type:
  • String
Source:

Button Menu Object The menu is an HTML overlay that can appear below a button. It can contain arbitrary HTML and has logic to be automatically positioned and sized to behave more or less like a dropdown menu.

Type:
  • Object
Source:

onclick :function

Type:
  • function
Source:

onmouseout :function

Type:
  • function
Source:

onmouseover :function

Type:
  • function
Source:

parent :BaseWidget

Type:
  • BaseWidget
Source:

parent_panel :Panel

Type:
Source:

parent_plot :Plot

Type:
Source:

parent_svg :Plot|Panel

Type:
Source:

parent_toolbar :Toolbar|null|*

Type:
Source:

(protected) permanent :Boolean

Configuration when defining a button: track whether this widget should be allowed to keep open menu/button contents in response to certain events

Type:
  • Boolean
Source:

(protected) persist :Boolean

Track internal state on whether to keep showing the button/ menu contents at the moment

Type:
  • Boolean
Source:

selector :d3.selection

Type:
  • d3.selection
Source:

(protected) status :String

Button status (highlighted / disabled/ etc)

Type:
  • String
Source:

(protected) style :Object

Hash of arbitrary button styles to apply as {name: value} entries

Type:
  • Object
Source:

tag :String

Tag to use for the button (default: a)

Type:
  • String
Source:

(protected) title :String

Mouseover title text for the button to show

Type:
  • String
Source:

Methods

disable(bool) → {Button}

Toggle whether the button is disabled

Parameters:
Name Type Description
bool boolean

If provided, explicitly set disabled state

Source:
Returns:
Type
Button

getClass() → {string}

Method to generate a CSS class string

Source:
Returns:
Type
string

hide() → {Button}

Hide the button by removing it from the DOM (may be overridden by current persistence setting)

Source:
Returns:
Type
Button

highlight(bool) → {Button}

Toggle whether the button is highlighted

Parameters:
Name Type Description
bool boolean

If provided, explicitly set highlighted state

Source:
Returns:
Type
Button

postUpdate() → {Button}

Hook for any behavior to be added/changed after the button has been re-rendered

Source:
Returns:
Type
Button

preUpdate() → {Button}

Hook for any actions or state cleanup to be performed before rerendering

Source:
Returns:
Type
Button

setColor(color) → {Button}

Set the color associated with this button

Parameters:
Name Type Description
color 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple'

Any selection not in the preset list will be replaced with gray.

Source:
Returns:
Type
Button

setHtml(html) → {Button}

Specify the HTML content of this button. WARNING: The string provided will be inserted into the document as raw markup; XSS mitigation is the responsibility of each button implementation.

Parameters:
Name Type Description
html String
Source:
Returns:
Type
Button

setPermanent(bool) → {Button}

Allow code to change whether the button is allowed to be permanent

Parameters:
Name Type Description
bool boolean
Source:
Returns:
Type
Button

setStatus(status)

Change button state

Parameters:
Name Type Description
status 'highlighted' | 'disabled' | ''
Source:

setStyle(style) → {Button}

Set a collection of custom styles to be used by the button

Parameters:
Name Type Description
style Object

Hash of {name:value} entries

Source:
Returns:
Type
Button

setTitle(title) → {Button}

Set the mouseover title text for the button (if any)

Parameters:
Name Type Description
title String

Simple text to display

Source:
Returns:
Type
Button

shouldPersist() → {Boolean}

Determine whether the button/menu contents should persist in response to a specific event

Source:
Returns:
Type
Boolean

show()

Show the button, including creating DOM elements if necessary for first render

Source:

update() → {Button}

Update button state and contents, and fully rerender

Source:
Returns:
Type
Button