RunReferencesDecorator

References decorator that automatically opens newly added components that implement the IOpenable interface and closes removed components that implement the IClosable interface.

Extends: ReferencesDecorator

Implements: IOpenable

Description

The RunReferencesDecorator class allows you to create a references decorator that automatically opens newly added components that implement the IOpenable interface and closes removed components that implement the IClosable interface.

Constructors

Creates a new instance of the decorator.

RunReferencesDecorator(IReferences nextReferences, IReferences topReferences)

  • nextReferences: IReferences - next references or decorator in the chain.
  • topReferences: IReferences - decorator at the top of the chain.

Fields

opened

Flag of the component state

_opened: bool = false

Instance methods

put

Puts a new reference into the reference map.

@override

void put(locator, component)

  • locator: dynamic - locator to find the reference by.
  • reference: dynamic - component reference to be added.

remove

Removes a previously added component that matches the specified locator. If many references match the locator, it removes only the first one. When all references shall be removed, use the removeAll method instead.

@override

dynamic remove(locator)

  • locator: dynamic - locator to remove component
  • returns: dynamic - removed component.

removeAll

Removes all component references that match the specified locator.

@override

List removeAll(locator)

  • locator: dynamic - locator to remove references by.
  • returns: List - list containing all removed references.

See also