API / geotoolkit / controls / 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
↳
Checkbox
Constructors
Methods
Methods
▸ 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.
| Name | Type | Description |
|---|---|---|
tools | ToolsContainer | tools container for the user callback |
registry | Button[] | button registry to remove itself from |
void
▸ clone(): Button
All subclasses should override copyConstructor or provide custom implementation for this method
clone
▸ 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.
| Name | Type | Description |
|---|---|---|
src | Checkbox | Source to copy from |
this
▸ getAction(): ActionCallback
Returns current action callback (if exists)
▸ getBorder(): string
Returns button element border
string
▸ getChecked(): boolean
Returns true if button is checked (for checkbox case), false otherwise
boolean
▸ getClassName(): string
string
▸ getColor(): string
Returns button element background color
string
▸ getElement(): HTMLElement
Returns current html DOM element used for the button
HTMLElement
▸ getHeight(): number
Returns fixed button height in px (if was set), null otherwise
number
▸ getIcon(): string
Returns button icon
string
▸ getInit(): InitCallback
Returns current initialization callback to be called on toolbar init/dispose
initialization callback
▸ 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
string[]
▸ getWidth(): number
Returns fixed button width in px (if was set), null otherwise
number
▸ init(tools, registry, parent, gap, insertId, listener): Checkbox
Initializes button, creates event listeners and adds button element to the document
| Name | Type | Description |
|---|---|---|
tools | ToolsContainer | tools container for the user callback |
registry | Button[] | list of buttons on the Plot, is needed for correct on/off radio buttons |
parent | HTMLElement | parent element to add button to |
gap | HTMLElement | gap element or null if no gap is needed |
insertId | number | insert position index |
listener | (b: Button) => void | listener callback |
this
▸ setAction(action): Checkbox
Sets current action callback
| Name | Type | Description |
|---|---|---|
action | ActionCallback | action callback to be called when pressing the button |
this
▸ setBorder(border): Checkbox
Sets button element border
| Name | Type | Description |
|---|---|---|
border | string | css-styled border value |
this
▸ setChecked(checked): Checkbox
Adds or removes css checked class to the DOM element
| Name | Type | Description |
|---|---|---|
checked | boolean | true to add checked class, false otherwise |
this
▸ setColor(color): Checkbox
Sets button element background color
| Name | Type | Description |
|---|---|---|
color | string | background color |
this
▸ setIcon(icon): Checkbox
Set button icon
| Name | Type |
|---|---|
icon | string |
▸ setInit(init): Checkbox
Sets initialization callback that is called on toolbar init/dispose
| Name | Type | Description |
|---|---|---|
init | InitCallback | initialization callback |
this
▸ setSize(width, height?): Checkbox
Sets button DOM element fixed size (in px)
| Name | Type | Description |
|---|---|---|
width | number | button element size or width |
Optional height | number | button element height. Equals to width, if nothing is provided. |
this
▸ Static getClassName(): string
string