Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PanelLayout

A concrete layout implementation suitable for many use cases.

Notes

This class is suitable as a base class for implementing a variety of layouts, but can also be used directly with standard CSS to layout a collection of widgets.

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 _widgets

_widgets: Widget[] = []

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

widgets

  • get widgets(): ReadonlyArray<Widget>

Methods

addWidget

  • addWidget(widget: Widget): void
  • Add a widget to the end of the layout.

    Parameters

    • widget: Widget

      The widget to add to the layout.

      Notes

      If the widget is already contained in the layout, it will be moved.

    Returns void

Protected attachWidget

  • attachWidget(index: number, widget: Widget): void
  • Attach a widget to the parent's DOM node.

    Parameters

    • index: number

      The current index of the widget in the layout.

    • widget: Widget

      The widget to attach to the parent.

      Notes

      This method is called automatically by the panel layout at the appropriate time. It should not be called directly by user code.

      The default implementation adds the widgets's node to the parent's node at the proper location, and sends the appropriate attach messages to the widget if the parent is attached to the DOM.

      Subclasses may reimplement this method to control how the widget's node is added to the parent's node.

    Returns void

Protected detachWidget

  • detachWidget(index: number, widget: Widget): void
  • Detach a widget from the parent's DOM node.

    Parameters

    • index: number

      The previous index of the widget in the layout.

    • widget: Widget

      The widget to detach from the parent.

      Notes

      This method is called automatically by the panel layout at the appropriate time. It should not be called directly by user code.

      The default implementation removes the widget's node from the parent's node, and sends the appropriate detach messages to the widget if the parent is attached to the DOM.

      Subclasses may reimplement this method to control how the widget's node is removed from the parent's node.

    Returns void

dispose

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

    Notes

    This will clear and dispose all widgets in the layout.

    All reimplementations should call the superclass method.

    This method is called automatically when the parent is disposed.

    Returns void

Protected init

  • init(): void

insertWidget

  • insertWidget(index: number, widget: Widget): void
  • Insert a widget into the layout at the specified index.

    Parameters

    • index: number

      The index at which to insert the widget.

    • widget: Widget

      The widget to insert into the layout.

      Notes

      The index will be clamped to the bounds of the widgets.

      If the widget is already added to the layout, it will be moved.

      Undefined Behavior

      An index which is non-integral.

    Returns void

iter

Protected moveWidget

  • moveWidget(fromIndex: number, toIndex: number, widget: Widget): void
  • Move a widget in the parent's DOM node.

    Parameters

    • fromIndex: number

      The previous index of the widget in the layout.

    • toIndex: number

      The current index of the widget in the layout.

    • widget: Widget

      The widget to move in the parent.

      Notes

      This method is called automatically by the panel layout at the appropriate time. It should not be called directly by user code.

      The default implementation moves the widget's node to the proper location in the parent's node and sends the appropriate attach and detach messages to the widget if the parent is attached to the DOM.

      Subclasses may reimplement this method to control how the widget's node is moved in the parent's node.

    Returns void

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

Protected onChildShown

Protected onFitRequest

  • onFitRequest(msg: Message): 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

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 does not modify the widget's parent.

    Returns void

removeWidgetAt

  • removeWidgetAt(index: number): void
  • Remove the widget at a given index from the layout.

    Parameters

    • index: number

      The index of the widget to remove.

      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 does not modify the widget's parent.

      Undefined Behavior

      An index which is non-integral.

    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