Skip to content
Last updated

API / geotoolkit / controls / toolbar / Button / Button

Class: Button

toolbar.Button.Button

Hierarchy

Table of contents

Constructors
  • [new Button(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.controls.toolbar.button.button.md#new button(options))
Methods

Contents

Constructors

new Button(options)

• new Button(options?)

Parameters

Name Type
Optional optionsOptions
Methods

clear

▸ clear(tools, registry): void

Clears this button, removes all listeners and button DOM element from the document.<br> Calls user callback with the ToolsContainer provided and 'false' flag to clear the data. Removes itself from the registry list.

Parameters

Name Type Description
toolsToolsContainertools container for the user callback
registryButton[]button registry to remove itself from

Returns

void


clone

▸ clone(): Button

All subclasses should override copyConstructor or provide custom implementation for this method

Returns

Button

clone


copyConstructor

▸ Protected copyConstructor(src): Button

Copy constructor function.<br> Function used as part of the cloning mechanism.<br> Implementations should copy the given instance state to this instance.<br>

Parameters

Name Type Description
srcButtonSource to copy from

Returns

Button

this


getAction

▸ getAction(): ActionCallback

Returns current action callback (if exists)

Returns

ActionCallback


getBorder

▸ getBorder(): string

Returns button element border

Returns

string


getChecked

▸ getChecked(): boolean

Returns true if button is checked (for checkbox case), false otherwise

Returns

boolean


getClassName

▸ getClassName(): string

Returns

string


getColor

▸ getColor(): string

Returns button element background color

Returns

string


getElement

▸ getElement(): HTMLElement

Returns current html DOM element used for the button

Returns

HTMLElement


getHeight

▸ getHeight(): number

Returns fixed button height in px (if was set), null otherwise

Returns

number


getIcon

▸ getIcon(): string

Returns button icon

Returns

string


getInit

▸ getInit(): InitCallback

Returns current initialization callback to be called on toolbar init/dispose

Returns

InitCallback

initialization callback


getName

▸ getName(): string[]

Returns current name(s) that describe group(s) that the radio button belongs to (checkbox case only). If the button should not switch automatically or is not checkbox, returns empty array

Returns

string[]


getPaddingStyle

▸ getPaddingStyle(): string

Returns button element padding style

Returns

string


getTextColor

▸ getTextColor(): string

Returns button element text color

Returns

string


getTitle

▸ getTitle(): string

Returns button DOM element title text

Returns

string


getWidth

▸ getWidth(): number

Returns fixed button width in px (if was set), null otherwise

Returns

number


init

▸ init(tools, registry, parent, gap, insertId, listener): Button

Initializes button, creates event listeners and adds button element to the document

Parameters

Name Type Description
toolsToolsContainertools container for the user callback
registryButton[]list of buttons on the Plot, is needed for correct on/off radio buttons
parentHTMLElementparent element to add button to
gapHTMLElementgap element or null if no gap is needed
insertIdnumberinsert position index
listener(b: Button) => voidlistener callback

Returns

Button

this


setAction

▸ setAction(action): Button

Sets current action callback

Parameters

Name Type Description
actionActionCallbackaction callback to be called when pressing the button

Returns

Button

this


setBorder

▸ setBorder(border): Button

Sets button element border

Parameters

Name Type Description
borderstringcss-styled border value

Returns

Button

this


setChecked

▸ setChecked(checked): Button

Adds or removes css checked class to the DOM element

Parameters

Name Type Description
checkedbooleantrue to add checked class, false otherwise

Returns

Button

this


setColor

▸ setColor(color): Button

Sets button element background color

Parameters

Name Type Description
colorstringbackground color

Returns

Button

this


setIcon

▸ setIcon(icon): Button

Set button icon

Parameters

Name Type
iconstring

Returns

Button


setInit

▸ setInit(init): Button

Sets initialization callback that is called on toolbar init/dispose

Parameters

Name Type Description
initInitCallbackinitialization callback

Returns

Button

this


setPaddingStyle

▸ setPaddingStyle(padding): Button

Sets button element padding style

Parameters

Name Type Description
paddingstring | numberpadding (in px) or style string

Returns

Button


setSize

▸ setSize(width, height?): Button

Sets button DOM element fixed size (in px)

Parameters

Name Type Description
widthstring | numberbutton element size or width
Optional heightstring | numberbutton element height. Equals to width, if nothing is provided.

Returns

Button

this


setTextColor

▸ setTextColor(color): Button

Sets button element text color

Parameters

Name Type Description
colorstringtext color

Returns

Button

this


setTitle

▸ setTitle(title): Button

Sets button DOM element title

Parameters

Name Type Description
titlestringtitle text

Returns

Button


getClassName

▸ Static getClassName(): string

Returns

string