API / geotoolkit / controls / toolbar / Label / Label
Label elements use .cg-toolbar-label css class
↳
Label
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): Label
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 | Label | 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): Label
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): Label
Sets current action callback
| Name | Type | Description |
|---|---|---|
action | ActionCallback | action callback to be called when pressing the button |
this
▸ setBorder(border): Label
Sets button element border
| Name | Type | Description |
|---|---|---|
border | string | css-styled border value |
this
▸ setChecked(checked): Label
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): Label
Sets button element background color
| Name | Type | Description |
|---|---|---|
color | string | background color |
this
▸ setIcon(icon): Label
Set button icon
| Name | Type |
|---|---|
icon | string |
▸ setInit(init): Label
Sets initialization callback that is called on toolbar init/dispose
| Name | Type | Description |
|---|---|---|
init | InitCallback | initialization callback |
this
▸ setSize(width, height?): Label
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
▸ setText(text): Label
Set label text
| Name | Type | Description |
|---|---|---|
text | string | label text |
▸ Static getClassName(): string
string