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
- [new Dropdown(options, registry)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.controls.toolbar.dropdown.dropdown.md#new dropdown(options, registry))
Methods
Constructors
• new Dropdown(options?, registry?)
| Name | Type |
|---|---|
Optional options | Options |
Optional registry | ButtonRegistry |
Button.constructor
Methods
▸ 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.
| 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.<br> Function used as part of the cloning mechanism.<br> Implementations should copy the given instance state to this instance.<br>
| 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[]
▸ getPaddingStyle(): string
Returns button element padding style
string
▸ getTextColor(): string
Returns button element text color
string
▸ getTitle(): string
Returns button DOM element title text
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
▸ setPaddingStyle(padding): Dropdown
Sets button element padding style
| Name | Type | Description |
|---|---|---|
padding | string | number | padding (in px) or style string |
▸ setSize(width, height?): Dropdown
Sets button DOM element fixed size (in px)
| Name | Type | Description |
|---|---|---|
width | string | number | button element size or width |
Optional height | string | number | button element height. Equals to width, if nothing is provided. |
this
▸ setTextColor(color): Dropdown
Sets button element text color
| Name | Type | Description |
|---|---|---|
color | string | text color |
this
▸ setTitle(title): Dropdown
Sets button DOM element title
| Name | Type | Description |
|---|---|---|
title | string | title text |
▸ Static getClassName(): string
string