Last updated

API / geotoolkit / controls / toolbar / Checkbox / Checkbox

Class: Checkbox

toolbar.Checkbox.Checkbox

Checkbox button that adds extra text information to the button icons. Checkbox elements use .cg-toolbar-checkbox css class, inner text applies .cg-toolbar-checkbox-text css class. Use it to change the default checkbox style

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new Checkbox(options)

new Checkbox(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

Button.constructor

Methods

clear

clear(tools, registry): void

Clears this button, removes all listeners and button DOM element from the document.
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

Inherited from

Button.clear


clone

clone(): Button

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

Returns

Button

clone

Inherited from

Button.clone


copyConstructor

Protected copyConstructor(src): Checkbox

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

Parameters

Name Type Description
srcCheckboxSource to copy from

Returns

Checkbox

this

Overrides

Button.copyConstructor


getAction

getAction(): ActionCallback

Returns current action callback (if exists)

Returns

ActionCallback

Inherited from

Button.getAction


getBorder

getBorder(): string

Returns button element border

Returns

string

Inherited from

Button.getBorder


getChecked

getChecked(): boolean

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

Returns

boolean

Inherited from

Button.getChecked


getClassName

getClassName(): string

Returns

string

Inherited from

Button.getClassName


getColor

getColor(): string

Returns button element background color

Returns

string

Inherited from

Button.getColor


getElement

getElement(): HTMLElement

Returns current html DOM element used for the button

Returns

HTMLElement

Inherited from

Button.getElement


getHeight

getHeight(): number

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

Returns

number

Inherited from

Button.getHeight


getIcon

getIcon(): string

Returns button icon

Returns

string

Inherited from

Button.getIcon


getInit

getInit(): InitCallback

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

Returns

InitCallback

initialization callback

Inherited from

Button.getInit


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[]

Inherited from

Button.getName


getWidth

getWidth(): number

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

Returns

number

Inherited from

Button.getWidth


init

init(tools, registry, parent, gap, insertId, listener): Checkbox

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

Checkbox

this

Inherited from

Button.init


setAction

setAction(action): Checkbox

Sets current action callback

Parameters

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

Returns

Checkbox

this

Inherited from

Button.setAction


setBorder

setBorder(border): Checkbox

Sets button element border

Parameters

Name Type Description
borderstringcss-styled border value

Returns

Checkbox

this

Inherited from

Button.setBorder


setChecked

setChecked(checked): Checkbox

Adds or removes css checked class to the DOM element

Parameters

Name Type Description
checkedbooleantrue to add checked class, false otherwise

Returns

Checkbox

this

Inherited from

Button.setChecked


setColor

setColor(color): Checkbox

Sets button element background color

Parameters

Name Type Description
colorstringbackground color

Returns

Checkbox

this

Inherited from

Button.setColor


setIcon

setIcon(icon): Checkbox

Set button icon

Parameters

Name Type
iconstring

Returns

Checkbox

Inherited from

Button.setIcon


setInit

setInit(init): Checkbox

Sets initialization callback that is called on toolbar init/dispose

Parameters

Name Type Description
initInitCallbackinitialization callback

Returns

Checkbox

this

Inherited from

Button.setInit


setSize

setSize(width, height?): Checkbox

Sets button DOM element fixed size (in px)

Parameters

Name Type Description
widthnumberbutton element size or width
Optional heightnumberbutton element height. Equals to width, if nothing is provided.

Returns

Checkbox

this

Inherited from

Button.setSize


getClassName

Static getClassName(): string

Returns

string

Inherited from

Button.getClassName