API / geotoolkit / controls / toolbar / Dropdown / Dropdown
Dropdown contains multiple buttons list that is visible when mouse hovers the button or dropdown main button is clicked. Its element applies extra .cg-toolbar-dropdown css class, use it to change the default style
↳
Dropdown
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): Dropdown
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 | Dropdown | Source to copy from |
this
▸ getAction(): ActionCallback
Returns current action callback (if exists)
▸ getBorder(): string
Returns button element border
string
▸ getButtons(): Button[]
Returns the contained buttons list
Button[]
▸ 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): Dropdown
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): Dropdown
Sets current action callback
| Name | Type | Description |
|---|---|---|
action | ActionCallback | action callback to be called when pressing the button |
this
▸ setBorder(border): Dropdown
Sets button element border
| Name | Type | Description |
|---|---|---|
border | string | css-styled border value |
this
▸ setChecked(checked): Dropdown
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): Dropdown
Sets button element background color
| Name | Type | Description |
|---|---|---|
color | string | background color |
this
▸ setIcon(icon): Dropdown
Set button icon
| Name | Type |
|---|---|
icon | string |
▸ setInit(init): Dropdown
Sets initialization callback that is called on toolbar init/dispose
| Name | Type | Description |
|---|---|---|
init | InitCallback | initialization callback |
this
▸ setSize(width, height?): Dropdown
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