Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DashboardLayoutRegion<LayoutProps>

An abstract representation of a DashboardLayoutRegion. All things that might appear in a Dashboard layout should subclass this.

Defines some layout framework classes for the handling of layout in Phosphor.

Type parameters

Hierarchy

Implements

  • IMessageHandler
  • IObservableDisposable
  • IDisposable
  • IStaleable

Index

Properties

Private _OnStale

_OnStale: Observable<void> = this._OnStaleSrc.asObservable()

Private _OnStaleSrc

_OnStaleSrc: Subject<void> = new Subject<void>()

Private _content

_content: Widget = new Widget()

Private _didUpdate

_didUpdate: boolean = false

Private flag that is set to true after an update-request.

This is used by the layout algorithm to ensure that all subtrees updated properly, since some Phosphor containers will skip updating in certain cases.

Private _isFocused

_isFocused: boolean = false

Private _isStale

_isStale: boolean = false

Private _owner

Private _parentRegion

_parentRegion: RegionWithChildren<any> | null = null

Private _properties

_properties: Partial<LayoutProps>

calculatedSize

calculatedSize: object | undefined

The absolute size of this region. May be pre-defined, or calculated. May be undefined until the first call to DashboardLayoutRegion#sizeContentToFit()

see

sizeContentToFit

deprecated

Layout algorithms should use top-down styling

constructor

dataset

dataset: DOMStringMap

The dataset for the widget's DOM node.

disposed

disposed: ISignal<this, void>

A signal emitted when the widget is disposed.

id

id: string

An immutable ID assigned to this layout region that is unique within it's dashboard

isAttached

isAttached: boolean

Test whether the widget's node is attached to the DOM.

isDisposed

isDisposed: boolean

Test whether the widget has been disposed.

isHidden

isHidden: boolean

Test whether the widget is explicitly hidden.

isVisible

isVisible: boolean

Test whether the widget is visible.

Notes

A widget is visible when it is attached to the DOM, is not explicitly hidden, and has no explicitly hidden ancestors.

layout

Protected metadata

metadata: Metadata<LayoutProps>

node

node: HTMLElement

Get the DOM node owned by the widget.

Private overlay

overlay: DisposableSet = new DisposableSet()

parent

parent: Widget | null

Set the parent of the widget.

Notes

Children are typically added to a widget by using a layout, which means user code will not normally set the parent widget directly.

The widget will be automatically removed from its old parent.

This is a no-op if there is no effective parent change.

Private rootOverlay

rootOverlay: DisposableSet = new DisposableSet()

title

title: Title<Widget>

The title object for the widget.

Notes

The title object is used by some container widgets when displaying the widget alongside some title, such as a tab panel or side bar.

Since not all widgets will use the title, it is created on demand.

The owner property of the title is set to this widget.

titlebar

titlebar: WidgetWrapper

The titlebar for this region.

see

TitleBar

Abstract typeName

typeName: LayoutTypes

Accessors

OnStale

  • get OnStale(): Observable<void>

content

  • get content(): Widget
  • set content(newContent: Widget): void
  • The content of this layout region. The content is where children and content should go, as this will be given the "main area" of the region. The titlebar will, if shown, take up the top 1em of the region.

    Returns Widget

  • The content of this layout region. The content is where children and content should go, as this will be given the "main area" of the region. The titlebar will, if shown, take up the top 1em of the region.

    Parameters

    • newContent: Widget

    Returns void

isFocused

  • get isFocused(): boolean

isStale

  • get isStale(): boolean
  • Whether this region has changes that it's parent hasn't acknowledged

    This is used by the framework to track dirtiness and update reactively.

    Returns boolean

Protected owner

parentRegion

properties

  • get properties(): Readonly<Partial<LayoutProps>>
  • set properties(newProps: Readonly<Partial<LayoutProps>>): void
  • A key-value dictionary of metadata that defines how this layout region should display itself

    Returns Readonly<Partial<LayoutProps>>

  • A key-value dictionary of metadata that defines how this layout region should display itself

    Parameters

    • newProps: Readonly<Partial<LayoutProps>>

    Returns void

uuid

  • get uuid(): string
  • An immutable ID assigned to this layout region that is unique within it's dashboard

    deprecated

    Use ID directly

    Returns string

Methods

activate

  • activate(): void
  • Post an 'activate-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

addClass

  • addClass(name: string): void
  • Add a class name to the widget's DOM node.

    Parameters

    • name: string

      The class name to add to the node.

      Notes

      If the class name is already added to the node, this is a no-op.

      The class name must not contain whitespace.

    Returns void

attachChrome

  • attachChrome(chromeElement: Widget): void
  • Attach a new element to this region's chrome.

    Region chroming is a way of attaching transient or parent-specific elements to the DOM, without interfering with the base class or the implementation of the region children.

    To remove the chrome, simply #dispose() it.

    Region chroming is automatically cleared whenever the parentRegion changes.

    Parameters

    • chromeElement: Widget

    Returns void

children

  • children(): IIterator<Widget>
  • Create an iterator over the widget's children.

    Returns IIterator<Widget>

    A new iterator over the children of the widget.

    Notes

    The widget must have a populated layout in order to have children.

    If a layout is not installed, the returned iterator will be empty.

clearFlag

  • clearFlag(flag: Flag): void
  • Clear the given widget flag.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns void

close

  • close(): void
  • Send a 'close-request' message to the widget.

    Notes

    This is a simple convenience method for sending the message.

    Returns void

contains

  • contains(widget: Widget): boolean
  • Test whether a widget is a descendant of this widget.

    Parameters

    • widget: Widget

      The descendant widget of interest.

    Returns boolean

    true if the widget is a descendant, false otherwise.

Private createDropzoneTarget

  • createDropzoneTarget(dropzone: string): void

dispose

  • dispose(): void

fit

  • fit(): void
  • Post a 'fit-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

focus

  • focus(): void

Protected getDefault

  • getDefault(propertyName: string): unknown
  • Get the default value for a layout property.

    internal

    Do not override this function.

    Parameters

    • propertyName: string

    Returns unknown

getLayoutProperty

  • getLayoutProperty<K>(propertyName: K): LayoutProps[K]
  • Return the value of a layout region property.

    This should fall back to default values if the property is undefined, and respect per-property logic (such as flexSize/fixedSize precedence)

    Type parameters

    • K: keyof LayoutProps

    Parameters

    • propertyName: K

      The name of the layout property to retrieve

    Returns LayoutProps[K]

handleEvent

  • handleEvent(ev: IDragEvent): void

hasClass

  • hasClass(name: string): boolean
  • Test whether the widget's DOM node has the given class name.

    Parameters

    • name: string

      The class name of interest.

    Returns boolean

    true if the node has the class, false otherwise.

hide

  • hide(): void
  • Hide the widget and make it hidden to its parent widget.

    Notes

    This causes the isHidden property to be true.

    If the widget is explicitly hidden, this is a no-op.

    Returns void

hideOverlay

  • hideOverlay(): void

hideRootOverlay

  • hideRootOverlay(): void

Protected notifyLayout

  • notifyLayout(msg: Message): void
  • Invoke the message processing routine of the widget's layout.

    Parameters

    • msg: Message

      The message to dispatch to the layout.

      Notes

      This is a no-op if the widget does not have a layout.

      This will not typically be called directly by user code.

    Returns void

Protected onActivateRequest

  • onActivateRequest(): void

Protected onAfterAttach

  • onAfterAttach(): void

Protected onAfterBlur

  • onAfterBlur(msg: Message): void
  • A handler that is called after this region has lost focus.

    Notes

    The default implementation is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onAfterDetach

  • onAfterDetach(msg: Message): void
  • A message handler invoked on an 'after-detach' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onAfterFocus

  • onAfterFocus(msg: Message): void
  • A handler that is called after this region has recieved focus.

    Notes

    The default implementation is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onAfterHide

  • onAfterHide(msg: Message): void
  • A message handler invoked on an 'after-hide' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onAfterShow

  • onAfterShow(msg: Message): void
  • A message handler invoked on an 'after-show' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeAttach

  • onBeforeAttach(msg: Message): void
  • A message handler invoked on a 'before-attach' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeBlur

  • onBeforeBlur(msg: Message): void
  • A handler that is called before this region is about to lose focus.

    Notes

    The default implementation is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeDetach

  • onBeforeDetach(): void

Protected onBeforeFocus

  • onBeforeFocus(msg: Message): void
  • A handler that is called before this region is about to recieve focus.

    Notes

    The default implementation is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeHide

  • onBeforeHide(msg: Message): void
  • A message handler invoked on a 'before-hide' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeShow

  • onBeforeShow(msg: Message): void
  • A message handler invoked on a 'before-show' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onChildAdded

  • onChildAdded(msg: ChildMessage): void
  • A message handler invoked on a 'child-added' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ChildMessage

    Returns void

Protected onChildRemoved

  • onChildRemoved(msg: ChildMessage): void
  • A message handler invoked on a 'child-removed' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ChildMessage

    Returns void

Protected onCloseRequest

  • onCloseRequest(): void
  • Close this layout region and dispose of it.

    Notes

    Phosphor defaults to merely unparenting a region when it's closed- Dashboard layouts don't really need this.

    Returns void

Protected onDragEnter

  • onDragEnter(ev: IDragEvent): void

Protected onDragLeave

  • onDragLeave(ev: IDragEvent): void

Protected onDragOver

  • onDragOver(ev: IDragEvent): void

Protected onDrop

  • onDrop(ev: IDragEvent): void

Protected onFitRequest

  • onFitRequest(msg: Message): void
  • A message handler invoked on a 'fit-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onResize

  • onResize(msg: ResizeMessage): void
  • A message handler invoked on a 'resize' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ResizeMessage

    Returns void

Protected onUpdateRequest

  • onUpdateRequest(msg: Message): void
  • A message handler invoked on an 'update-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

processMessage

  • processMessage(msg: Message): void

removeClass

  • removeClass(name: string): void
  • Remove a class name from the widget's DOM node.

    Parameters

    • name: string

      The class name to remove from the node.

      Notes

      If the class name is not yet added to the node, this is a no-op.

      The class name must not contain whitespace.

    Returns void

setFlag

  • setFlag(flag: Flag): void
  • Set the given widget flag.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns void

setFresh

  • setFresh(): void

setHidden

  • setHidden(hidden: boolean): void
  • Show or hide the widget according to a boolean value.

    Parameters

    • hidden: boolean

      true to hide the widget, or false to show it.

      Notes

      This is a convenience method for hide() and show().

    Returns void

setLayoutProperty

  • setLayoutProperty<K>(propertyName: K, value: LayoutProps[K]): void
  • Set a layout property and update this region as appropriate.

    Type parameters

    • K: keyof LayoutProps

    Parameters

    • propertyName: K
    • value: LayoutProps[K]

    Returns void

setStale

  • setStale(): void
  • Mark this region as having changes that need to be synced with something

    Notes

    Examples of this include layout properties, which need to be saved to a model, and added/removed children, which need the dashboard to issue update requests.

    Returns void

show

  • show(): void
  • Show the widget and make it visible to its parent widget.

    Notes

    This causes the isHidden property to be false.

    If the widget is not explicitly hidden, this is a no-op.

    Returns void

showOverlay

  • showOverlay(): void

showRootOverlay

  • showRootOverlay(): void

sizeContentToFit

  • sizeContentToFit(bounds: object): void
  • Size the content of the layout region to fit within the given bounds

    This is normally called by the dashboarding framework, or by layout regions with children after they have fit themselves.

    Subclassers may implement additional logic that is relevant to how they should be displayed, such as background color.

    deprecated

    A later commit will move this to top-down styling, as practiced by Phosphor

    Parameters

    • bounds: object

      The width and height that the layout region should fit into.

    Returns void

startDrag

  • startDrag(clientX: number, clientY: number): void

testFlag

  • testFlag(flag: Flag): boolean
  • Test whether the given widget flag is set.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns boolean

toggleClass

  • toggleClass(name: string, force?: undefined | false | true): boolean
  • Toggle a class name on the widget's DOM node.

    Parameters

    • name: string

      The class name to toggle on the node.

    • Optional force: undefined | false | true

      Whether to force add the class (true) or force remove the class (false). If not provided, the presence of the class will be toggled from its current state.

    Returns boolean

    true if the class is now present, false otherwise.

    Notes

    The class name must not contain whitespace.

update

  • update(): void
  • Post an 'update-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

updateFromProperties

  • updateFromProperties(): void
  • Update the region's actual size in the DOM.

    This is called whenever the region recieves an update-request

    Returns void

Static GetMetadata

Static attach

  • attach(widget: Widget, host: HTMLElement, ref?: HTMLElement | null): void
  • Attach a widget to a host DOM node.

    Parameters

    • widget: Widget

      The widget of interest.

    • host: HTMLElement

      The DOM node to use as the widget's host.

    • Optional ref: HTMLElement | null

      The child of host to use as the reference element. If this is provided, the widget will be inserted before this node in the host. The default is null, which will cause the widget to be added as the last child of the host.

      Notes

      This will throw an error if the widget is not a root widget, if the widget is already attached, or if the host is not attached to the DOM.

    Returns void

Static detach

  • detach(widget: Widget): void
  • Detach the widget from its host DOM node.

    Parameters

    • widget: Widget

      The widget of interest.

      Notes

      This will throw an error if the widget is not a root widget, or if the widget is not attached to the DOM.

    Returns void

Generated using TypeDoc