Home Manual Reference Source Repository
import {Renderable} from 'ug-layout/dom/Renderable'
public class | source

Renderable

The base renderable that all other renderables extend from.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

This renderables container or null if none.

public
public get
public
public get

This renderables height in pixels.

public get

The injector used to create this renderable.

public get

Whether this renderable is destroyed.

public get

The amount of content items belonging to this renderable.

public get

This renderables page offset x.

public get

This renderables page offset y.

public

tags: *

public get

A unique identifier for this renderable.

public get

This renderables width in pixels.

Method Summary

Public Methods
public

addChild(item: Renderable, options: AddChildArgs)

Adds a child item to this renderable.

public

Whether a renderable is a descendant of this renderable.

public

createChild(renderable: RenderableArg<T>, providers: ProviderArg[]): T

Creates a child renderable using this renderable as it's container.

public

destroy(): void

Destroys this renderable and all it's children.

public

emit(event: T)

Emits a BusEvent on this renderable.

public

emitDown(event: T)

Emits a BusEvent down to all descendants recursively.

public

emitUp(event: T)

Emits a BusEvent up to all parents recursively.

public

Gets the renderable area of this renderable.

public

Gets a content renderable at an index.

public

Returns this renderables children renderables.

public

Gets all descendants of this renderable recursively.

public

Gets the index of a content renderable.

public

getParent(Ctor: Type<T>): T | null

Gets this renderables parent or any parent that is an instance of the passed in constructor.

public

getParents(Ctor: Type<T>): T | null

Gets this renderables parents or any parents that are an instance of the passed in constructor.

public

Handles any cleanup from a drop.

public

Invoked when the Injector has been assigned and ready for use.

public

Whether this renderable is a descendant of another renderable.

public

Whether this renderable can be dropped on.

public

Determines whether this renderable is visible.

public

remove()

Removes this item from it's parent. If there is no parent then this renderable will just be destroyed.

public

Removes a content item from this renderable.

public

replaceChild(item: Renderable, withItem: Renderable, options: RemoveChildArgs)

Replaces a content item on this renderable with another content item.

public

resize()

Sets this components size and triggers it's childrens sizing.

public

scope(Event: Type<T>): Observable<T>

Creates an Observable scoped to a specific event type.

public

setContainer(container: Renderable | null)

Sets the container of this renderable.

public

subscribe(Event: Type<T>, observer: PartialObserver<T> | function(event: T)): Subscription

Subscribes to a BusEvent.

Public Constructors

public constructor() source

Public Members

public get container: Renderable | null source

This renderables container or null if none.

public containerChange: * source

public get contentItems: undefined[] source

public destroyed: * source

public get height: number source

This renderables height in pixels.

public get injector: Injector source

The injector used to create this renderable.

public get isDestroyed: boolean source

Whether this renderable is destroyed.

public get length: number source

The amount of content items belonging to this renderable.

public get offsetX: number source

This renderables page offset x.

public get offsetY: number source

This renderables page offset y.

public tags: * source

public get uid: number source

A unique identifier for this renderable.

public get width: number source

This renderables width in pixels.

Public Methods

public addChild(item: Renderable, options: AddChildArgs) source

Adds a child item to this renderable.

Params:

NameTypeAttributeDescription
item Renderable
options AddChildArgs
  • optional
  • default: {}

public contains(item: Renderable): boolean source

Whether a renderable is a descendant of this renderable.

Params:

NameTypeAttributeDescription
item Renderable

Return:

boolean

public createChild(renderable: RenderableArg<T>, providers: ProviderArg[]): T source

Creates a child renderable using this renderable as it's container.

Params:

NameTypeAttributeDescription
renderable RenderableArg<T>
providers ProviderArg[]
  • optional
  • default: []

Return:

T

public destroy(): void source

Destroys this renderable and all it's children.

Return:

void

public emit(event: T) source

Emits a BusEvent on this renderable.

Params:

NameTypeAttributeDescription
event T

public emitDown(event: T) source

Emits a BusEvent down to all descendants recursively. Propagation can be stopped by any descending renderable.

Params:

NameTypeAttributeDescription
event T

public emitUp(event: T) source

Emits a BusEvent up to all parents recursively. Propagation can be stopped by any parent renderable.

Params:

NameTypeAttributeDescription
event T

public getArea(): RenderableArea source

Gets the renderable area of this renderable.

Return:

RenderableArea

public getAtIndex(index: number): Renderable | null source

Gets a content renderable at an index.

Params:

NameTypeAttributeDescription
index number

Return:

Renderable | null

public getChildren(): Renderable[] source

Returns this renderables children renderables. This differs from content items as children should contain all renderables we want as part of the render cycle.

Return:

Renderable[]

public getDescendants(): Renderable[] source

Gets all descendants of this renderable recursively.

Return:

Renderable[]

public getIndexOf(item: Renderable): number source

Gets the index of a content renderable.

Params:

NameTypeAttributeDescription
item Renderable

Return:

number

public getParent(Ctor: Type<T>): T | null source

Gets this renderables parent or any parent that is an instance of the passed in constructor. If non is found then null is returned.

Params:

NameTypeAttributeDescription
Ctor Type<T>
  • optional

Return:

T | null

public getParents(Ctor: Type<T>): T | null source

Gets this renderables parents or any parents that are an instance of the passed in constructor.

Params:

NameTypeAttributeDescription
Ctor Type<T>
  • optional

Return:

T | null

public handleDropCleanup() source

Handles any cleanup from a drop.

public initialize() source

Invoked when the Injector has been assigned and ready for use.

public isContainedWithin(item: Renderable): boolean source

Whether this renderable is a descendant of another renderable.

Params:

NameTypeAttributeDescription
item Renderable

Return:

boolean

public isDroppable(target: Renderable): boolean source

Whether this renderable can be dropped on.

Params:

NameTypeAttributeDescription
target Renderable

Return:

boolean

public isVisible(): boolean source

Determines whether this renderable is visible.

Return:

boolean

public remove() source

Removes this item from it's parent. If there is no parent then this renderable will just be destroyed.

public removeChild(item: Renderable, options: RemoveChildArgs) source

Removes a content item from this renderable.

Params:

NameTypeAttributeDescription
item Renderable
options RemoveChildArgs
  • optional
  • default: {}

public replaceChild(item: Renderable, withItem: Renderable, options: RemoveChildArgs) source

Replaces a content item on this renderable with another content item.

Params:

NameTypeAttributeDescription
item Renderable
withItem Renderable
options RemoveChildArgs
  • optional
  • default: {}

public resize() source

Sets this components size and triggers it's childrens sizing.

public scope(Event: Type<T>): Observable<T> source

Creates an Observable scoped to a specific event type.

Params:

NameTypeAttributeDescription
Event Type<T>

Return:

Observable<T>

public setContainer(container: Renderable | null) source

Sets the container of this renderable.

Params:

NameTypeAttributeDescription
container Renderable | null

public subscribe(Event: Type<T>, observer: PartialObserver<T> | function(event: T)): Subscription source

Subscribes to a BusEvent.

Params:

NameTypeAttributeDescription
Event Type<T>
observer PartialObserver<T> | function(event: T)

Return:

Subscription