Class: SidebarWindow

.ALS. SidebarWindow


new SidebarWindow(sidebarTitle, contentTitle, button)

A sidebar window similar to the settings and wizard windows.

It's based on items. Each item is L.ALS.Widgetable. Its name will be displayed in the sidebar (or a drop-down menu, if viewport is too narrow). User can switch between the items.

Note: All widget-related methods from L.ALS.Widgetable won't work here.

Parameters:
Name Type Description
sidebarTitle string

Title of the sidebar. Pass locale property to localize it.

contentTitle string

Title of the content. Pass locale property to localize it.

button Element | undefined

Button which will activate this window. Don't pass anything if you'll add this functionality later.

Extends

Members


_windowWrapper :HTMLDivElement

Div that wraps entire window

Type:
  • HTMLDivElement

<protected> buttonsGroup

Button group for this window

Inherited From:

<protected> constructorArguments :Array.<any>

Contains arguments passed to this constructor

Type:
  • Array.<any>
Inherited From:

container :HTMLDivElement

Container to add widgets to. This element must be added to the page.

Type:
  • HTMLDivElement
Inherited From:

select :HTMLSelectElement

Select element

Type:
  • HTMLSelectElement

<protected> serializationIgnoreList :Array.<string>

Contains properties that won't be serialized. Append your properties at the constructor.

Type:
  • Array.<string>
Inherited From:

window :HTMLDivElement

Window which contains Widgetable's container

Type:
  • HTMLDivElement
Inherited From:

windowContainer :HTMLDivElement

Container for the window which should be added to the page

Type:
  • HTMLDivElement
Inherited From:

Methods


_setWindowHeight(height)

Sets window height

Parameters:
Name Type Description
height number | "auto"

Height to set


addCloseButton(id, text, icon, callbackObject, callback)

Adds close button to this window. You should add this button after you've added all your own buttons.

Parameters:
Name Type Description
id string

Button ID

text string

Button label

icon string

Button icon - a RemixIcon class.

callbackObject Object | L.ALS.Serializable

Just pass "this". If you plan to use serialization, this object MUST be instance of L.ALS.Serializable.

callback string

Name of a method of callbackObject that will be called when button will be pressed.

Inherited From:
Returns:

Added button

Type
L.ALS.Widgets.Button

addItem(name, item)

Adds item to this window

Parameters:
Name Type Description
name string

Name of the item or locale string

item L.ALS.Widgetable

Item to add


addWidget()

Doesn't do anything

Overrides:

addWidgets()

Doesn't do anything

Overrides:

bindButton(button)

Binds a button that will open and close this window

Parameters:
Name Type Description
button HTMLElement

Button to bind

Inherited From:

deserializeWidgets(serializedWidgets, seenObjects)

Deserializes widgets and adds them to this object. Removes all previously added widgets. Use this if you want to deserialize only widgets in your own Widgetable.

Parameters:
Name Type Description
serializedWidgets Object

Result of L.ALS.Widgetable#serializeWidgets

seenObjects Object

Already seen objects' ids. Intended only for internal use.

Inherited From:

displayItem(name)

Displays item with given name

Parameters:
Name Type Description
name string

Item to display


getButtonsGroup()

Inherited From:
Returns:

Buttons group to which you can add your own buttons

Type
L.ALS.Widgets.ButtonsGroup

getItem(name)

Gets item's widgetable by item's name

Parameters:
Name Type Description
name string

name of the item

Returns:

Item's widgetable or undefined if there's no such item.

Type
L.ALS.Widgetable | undefined

getObjectToSerializeTo(newObject, seenObjects)

Registers this object for serialization and deserialization. Returns an object to serialize custom properties to.

Call it first, if you implement your own algrorithm, and serialize to the returned object!

Parameters:
Name Type Description
newObject Object

Object to where you'll serialize

seenObjects Object

Already seen objects

Inherited From:
Returns:

Object to serialize to.

Type
Object

getWidgetById()

Doesn't do anything

Overrides:

isHidden()

Returns:

True, if this window is hidden

Type
boolean

removeAllWidgets()

Doesn't do anything

Overrides:

removeItem(name)

Removes item from this window

Parameters:
Name Type Description
name string

Name of the item to remove


removeWidget()

Doesn't do anything

Overrides:

serialize(seenObjects)

Serializes this object to JSON. If overridden, you MUST perform following operations before returning JSON:

let json = {} // Your JSON
... // Perform serialization
json.constructorArguments = this.serializeConstrutorArguments(); // Serialize constructor arguments
json.serializableClassName = this.serializableClassName; // Add class name to JSON
return json; // Finally return JSON
Parameters:
Name Type Description
seenObjects Object

Already seen objects

Inherited From:
Returns:

This serialized object

Type
Object

serializeConstructorArguments()

Serializes constructor arguments. If your constructor is not empty, result of this method MUST be added to json at L.ALS.Serializable#serialize as "_construtorArgs" property.

Deprecated in favor of L.ALS.Serializable#getObjectFromSerialized which uses this function under-the-hood.

Inherited From:
Deprecated:
  • Yes
Returns:

Serialized constructor arguments

Type
Array

serializeWidgets(seenObjects)

Serializes widgets.

If you're serializing L.ALS.Layer, you don't need to call this method, L.ALS.Layer#getObjectToSerializeTo already does that.

Parameters:
Name Type Description
seenObjects Object

Already seen objects' ids. Intended only for internal use.

Inherited From:
Returns:

Object where keys are widget's ids and values are serialized widgets themselves

Type
Object

setConstructorArguments(args)

Sets constructor arguments for serialization

Parameters:
Name Type Description
args

Arguments to set

Inherited From:

updateWindowHeight()

Updates window height.

Call it if you update window contents dynamically.