Home Reference Source
import {ControlFactory} from 'guide4you/src/configurators/ControlFactory.js'
public class | source

ControlFactory

A Factory that takes a control config as an object and returns the correspondig control. Modules can expand the functionality of this class via the createControl method

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
Private Members
private
private
private

Method Summary

Public Methods
public

addControlTo(receiver: ComposedControl | G4UMap, controlName: string)

Function to add a control by its name to a certain receiver

public

Add all configured Controls to the map

public

createControl(controlType: string, options: g4uControlOptions): Control

The factory function

public

getPositioning(): Positioning

public

Sets the localiser to pass on to the controls

Private Methods
private

Adds multiple controls to one receiver

Public Constructors

public constructor(options: ControlFactoryOptions) source

Params:

NameTypeAttributeDescription
options ControlFactoryOptions

Public Members

public controlsConfig: ControlsConfig source

Private Members

private activeGroups_: Map<string, ActiveGroup> source

private localiser_: L10N source

private map_: G4UMap source

Public Methods

public addControlTo(receiver: ComposedControl | G4UMap, controlName: string) source

Function to add a control by its name to a certain receiver

Params:

NameTypeAttributeDescription
receiver ComposedControl | G4UMap
controlName string

public addControls() source

Add all configured Controls to the map

public createControl(controlType: string, options: g4uControlOptions): Control source

The factory function

Params:

NameTypeAttributeDescription
controlType string
options g4uControlOptions

Return:

Control

public getPositioning(): Positioning source

Return:

Positioning

public setLocaliser(loc: L10N) source

Sets the localiser to pass on to the controls

Params:

NameTypeAttributeDescription
loc L10N

Private Methods

private addControlMultipleInternal_(receiver: ComposedControl | G4UMap, controlNames: string[]) source

Adds multiple controls to one receiver

Params:

NameTypeAttributeDescription
receiver ComposedControl | G4UMap
controlNames string[]