Home Reference Source
import {ButtonBox} from 'guide4you/src/html/ButtonBox.js'
public class | source

ButtonBox

Extends:

ol/Object~BaseObject → ButtonBox

An Element to easily construct nested HTML Menus It contains of a button followed by a body below the button. The button can toggle the visibility of the body. If multiple elements with the same classname are nested it gives the last visible element a special class name. It can also marks one or multiple element in the tree to be active (same classname is needed, too). After a ButtonBox has been added all child elements the method finish should be called.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

classNames_: {"body": *, "collapseButton": *, "titleButton": *, "title": *, "active": *, "collapsed": *, "lastVisible": *}

Private Members
private

$body_: jQuery

private

$title_: jQuery

private
private
private
private

Method Summary

Public Methods
public

finish()

This method should be called after all child elements have been added to the button box

public

get$Body(): jQuery

Returns the body element

public

get$Element(): jQuery

Returns the element itself

public
public

giveLastVisible($element: *)

Gives the last element in the element the last visible class

public
public

setCollapsed(collapsed: boolean, silent: boolean)

public
public

takeLastVisible($element: jQuery): boolean

Searches for the last visible class in its child elements and removes it.

Private Methods
private

get$LastChild_($element: jQuery): jQuery

finds and returns the last child in the body of the given element if it is of the same classname as this ButtonBox

private

distribute the last visible class to the correct element

Public Constructors

public constructor(options: ButtonBoxOptions) source

Params:

NameTypeAttributeDescription
options ButtonBoxOptions
  • optional
  • default: {}

Public Members

public $element_: * source

public classNames_: {"body": *, "collapseButton": *, "titleButton": *, "title": *, "active": *, "collapsed": *, "lastVisible": *} source

Private Members

private $body_: jQuery source

private $title_: jQuery source

private className_: string source

private collapsed_: boolean source

private collapsible_: boolean source

private titleButton_: boolean source

Public Methods

public finish() source

This method should be called after all child elements have been added to the button box

public get$Body(): jQuery source

Returns the body element

Return:

jQuery

public get$Element(): jQuery source

Returns the element itself

Return:

jQuery

public getCollapsed(): boolean source

Return:

boolean

public giveLastVisible($element: *) source

Gives the last element in the element the last visible class

Params:

NameTypeAttributeDescription
$element *

public setCollapseButtonActive(active: *) source

Params:

NameTypeAttributeDescription
active *

public setCollapsed(collapsed: boolean, silent: boolean) source

Params:

NameTypeAttributeDescription
collapsed boolean
silent boolean

public setTitleButtonActive(active: *) source

Params:

NameTypeAttributeDescription
active *

public takeLastVisible($element: jQuery): boolean source

Searches for the last visible class in its child elements and removes it. Returns true if it was removed.

Params:

NameTypeAttributeDescription
$element jQuery

Return:

boolean

Private Methods

private get$LastChild_($element: jQuery): jQuery source

finds and returns the last child in the body of the given element if it is of the same classname as this ButtonBox

Params:

NameTypeAttributeDescription
$element jQuery

Return:

jQuery

private lastVisibleClass_() source

distribute the last visible class to the correct element