Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layout

An abstract base class for creating lumino layouts. The namespace for the Layout class statics.

Notes

A layout is used to add widgets to a parent and to arrange those widgets within the parent's DOM node.

This class implements the base functionality which is required of nearly all layouts. It must be subclassed in order to be useful.

Notably, this class does not define a uniform interface for adding widgets to the layout. A subclass should define that API in a way which is meaningful for its intended use.

Hierarchy

Implements

  • IIterable<Widget>
  • IDisposable

Index

Type aliases

Static FitPolicy

FitPolicy: "set-no-constraint" | "set-min-size"

A type alias for the layout fit policy.

Notes

The fit policy controls the computed size constraints which are applied to the parent widget by the layout.

Some layout implementations may ignore the fit policy.

Static HorizontalAlignment

HorizontalAlignment: "left" | "center" | "right"

A type alias for the horizontal alignment of a widget.

Static VerticalAlignment

VerticalAlignment: "top" | "center" | "bottom"

A type alias for the vertical alignment of a widget.

Constructors

constructor

Properties

Private _disposed

_disposed: boolean = false

Private _fitPolicy

_fitPolicy: FitPolicy

Private _parent

_parent: Widget | null = null

Accessors

fitPolicy

  • Get the fit policy for the layout.

    Notes

    The fit policy controls the computed size constraints which are applied to the parent widget by the layout.

    Some layout implementations may ignore the fit policy.

    Returns FitPolicy

  • Set the fit policy for the layout.

    Notes

    The fit policy controls the computed size constraints which are applied to the parent widget by the layout.

    Some layout implementations may ignore the fit policy.

    Changing the fit policy will clear the current size constraint for the parent widget and then re-fit the parent.

    Parameters

    Returns void

isDisposed

  • get isDisposed(): boolean

parent

  • get parent(): Widget | null
  • set parent(value: Widget | null): void
  • Get the parent widget of the layout.

    Notes

    This is set automatically when installing the layout on the parent widget. The parent widget should not be set directly by user code.

    Returns Widget | null

  • Set the parent widget of the layout.

    Notes

    This is set automatically when installing the layout on the parent widget. The parent widget should not be set directly by user code.

    Parameters

    Returns void

Methods

dispose

  • dispose(): void
  • Dispose of the resources held by the layout.

    Notes

    This should be reimplemented to clear and dispose of the widgets.

    All reimplementations should call the superclass method.

    This method is called automatically when the parent is disposed.

    Returns void

Protected init

  • init(): void
  • Perform layout initialization which requires the parent widget.

    Notes

    This method is invoked immediately after the layout is installed on the parent widget.

    The default implementation reparents all of the widgets to the layout parent widget.

    Subclasses should reimplement this method and attach the child widget nodes to the parent widget's node.

    Returns void

Abstract iter

  • Create an iterator over the widgets in the layout.

    Returns IIterator<Widget>

    A new iterator over the widgets in the layout.

    Notes

    This abstract method must be implemented by a subclass.

Protected onAfterAttach

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

    Notes

    The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    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 method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    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 method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    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 method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    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 method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeDetach

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

    Notes

    The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    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 method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    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 method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onChildHidden

Protected onChildRemoved

  • A message handler invoked on a 'child-removed' message.

    Notes

    This will remove the child widget from the layout.

    Subclasses should not typically reimplement this method.

    Parameters

    Returns void

Protected onChildShown

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

  • A message handler invoked on a 'resize' message.

    Notes

    The layout should ensure that its widgets are resized according to the specified layout space, and that they are sent a 'resize' message if appropriate.

    The default implementation of this method sends an UnknownSize resize message to all widgets.

    This may be reimplemented by subclasses as needed.

    Parameters

    Returns void

Protected onUpdateRequest

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

    Notes

    The layout should ensure that its widgets are resized according to the available layout space, and that they are sent a 'resize' message if appropriate.

    The default implementation of this method sends an UnknownSize resize message to all widgets.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

processParentMessage

  • processParentMessage(msg: Message): void
  • Process a message sent to the parent widget.

    Parameters

    • msg: Message

      The message sent to the parent widget.

      Notes

      This method is called by the parent widget to process a message.

      Subclasses may reimplement this method as needed.

    Returns void

Abstract removeWidget

  • removeWidget(widget: Widget): void
  • Remove a widget from the layout.

    Parameters

    • widget: Widget

      The widget to remove from the layout.

      Notes

      A widget is automatically removed from the layout when its parent is set to null. This method should only be invoked directly when removing a widget from a layout which has yet to be installed on a parent widget.

      This method should not modify the widget's parent.

    Returns void

Static getHorizontalAlignment

  • Get the horizontal alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns HorizontalAlignment

    The horizontal alignment for the widget.

    Notes

    If the layout width allocated to a widget is larger than its max width, the horizontal alignment controls how the widget is placed within the extra horizontal space.

    If the allocated width is less than the widget's max width, the horizontal alignment has no effect.

    Some layout implementations may ignore horizontal alignment.

Static getVerticalAlignment

  • Get the vertical alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns VerticalAlignment

    The vertical alignment for the widget.

    Notes

    If the layout height allocated to a widget is larger than its max height, the vertical alignment controls how the widget is placed within the extra vertical space.

    If the allocated height is less than the widget's max height, the vertical alignment has no effect.

    Some layout implementations may ignore vertical alignment.

Static setHorizontalAlignment

  • Set the horizontal alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    • value: HorizontalAlignment

      The value for the horizontal alignment.

      Notes

      If the layout width allocated to a widget is larger than its max width, the horizontal alignment controls how the widget is placed within the extra horizontal space.

      If the allocated width is less than the widget's max width, the horizontal alignment has no effect.

      Some layout implementations may ignore horizontal alignment.

      Changing the horizontal alignment will post an update-request message to widget's parent, provided the parent has a layout installed.

    Returns void

Static setVerticalAlignment

  • Set the vertical alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    • value: VerticalAlignment

      The value for the vertical alignment.

      Notes

      If the layout height allocated to a widget is larger than its max height, the vertical alignment controls how the widget is placed within the extra vertical space.

      If the allocated height is less than the widget's max height, the vertical alignment has no effect.

      Some layout implementations may ignore vertical alignment.

      Changing the horizontal alignment will post an update-request message to widget's parent, provided the parent has a layout installed.

    Returns void

Generated using TypeDoc