Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TerminalWidget

A widget which manages a terminal session.

Hierarchy

  • Widget
    • TerminalWidget

Implements

  • IDisposable
  • IMessageHandler

Index

Constructors

constructor

Properties

Private _background

_background: string

Private _col_width

_col_width: number

Private _color

_color: string

Private _dirty

_dirty: boolean

Private _dummyTerm

_dummyTerm: HTMLElement

Private _fontSize

_fontSize: number

Private _height

_height: number

Private _row_height

_row_height: number

Private _sheet

_sheet: HTMLElement

Private _term

_term: Terminal

Private _width

_width: number

Private _ws

_ws: WebSocket

disposed

disposed: ISignal<Widget, void>

A signal emitted when the widget is disposed.

See also: dispose, disposed

id

id: string

Set the id of the wrapper's DOM node.

isAttached

isAttached: boolean

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

Notes

This is a read-only property.

See also: attach, detach

isDisposed

isDisposed: boolean

Test whether the widget has been disposed.

Notes

This is a read-only property.

See also: dispose, disposed

isHidden

isHidden: boolean

Test whether the widget is explicitly hidden.

Notes

This is a read-only property.

See also: isVisible, hide, show

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.

This is a read-only property.

See also: isHidden, hide, show

layout

layout: Layout

Set the layout for the widget.

Notes

The layout is single-use only. It cannot be set to null and it cannot be changed after the first assignment.

The layout is disposed automatically when the widget is disposed.

node

node: HTMLElement

Get the DOM node managed by the wrapper.

Notes

This property is read-only.

parent

parent: Widget

Set the parent of the widget.

Notes

The widget will be automatically removed from its current parent.

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

title

title: Title

Get the title data object for the widget.

Notes

The title data is used by some container widgets when displaying the widget along with a title, such as a tab panel or dock panel.

Not all widgets will make use of the title data, so it is created on-demand the first time it is accessed.

Static nterms

nterms: number

The number of terminals started. Used to ensure unique sessions.

Accessors

background

  • get background(): string
  • set background(value: string): void
  • Get the background color of the terminal.

    Returns string

  • Set the background color of the terminal.

    Parameters

    • value: string

    Returns void

color

  • get color(): string
  • set color(value: string): void
  • Get the text color of the terminal.

    Returns string

  • Set the text color of the terminal.

    Parameters

    • value: string

    Returns void

fontSize

  • get fontSize(): number
  • set fontSize(size: number): void
  • Get the font size of the terminal in pixels.

    Returns number

  • Set the font size of the terminal in pixels.

    Parameters

    • size: number

    Returns void

popOnBell

  • get popOnBell(): boolean
  • set popOnBell(value: boolean): void
  • Get whether to focus on a bell event.

    Returns boolean

  • Set whether to focus on a bell event.

    Parameters

    • value: boolean

    Returns void

scrollback

  • get scrollback(): number
  • set scrollback(value: number): void
  • Get the size of the scrollback buffer in the terminal.

    Returns number

  • Set the size of the scrollback buffer in the terminal.

    Parameters

    • value: number

    Returns void

visualBell

  • get visualBell(): boolean
  • set visualBell(value: boolean): void
  • Get whether the bell is shown.

    Returns boolean

  • Set whether the bell is shown.

    Parameters

    • value: boolean

    Returns void

Methods

Private _resizeTerminal

  • _resizeTerminal(): void
  • Resize the terminal based on the computed geometry.

    Returns void

Private _snapTermSizing

  • _snapTermSizing(): void
  • Use the dummy terminal to measure the row and column sizes.

    Returns void

addClass

  • addClass(name: string): void
  • Add a class name to the wrapper'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.

    Returns void

attach

  • attach(host: HTMLElement): void
  • Attach the widget to a host DOM node.

    throws

    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.

    Parameters

    • host: HTMLElement

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

    Returns void

clearFlag

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

    Notes

    This will not typically be consumed directly by user code.

    Parameters

    • flag: WidgetFlag

    Returns void

close

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

    See also: [[MsgCloseRequest]]

    Returns void

compressMessage

  • compressMessage(msg: Message, pending: Queue<Message>): boolean
  • Compress a message posted to the widget.

    Parameters

    • msg: Message

      The message posted to the widget.

    • pending: Queue<Message>

      The queue of pending messages for the widget.

    Returns boolean

    true if the message should be ignored, or false if the message should be enqueued for delivery as normal.

    Notes

    Subclasses may reimplement this method as needed.

contains

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

    Parameters

    • widget: Widget

      The widget of interest.

    Returns boolean

    true if the widget is a descendant, false otherwise.

detach

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

    throws

    An error if the widget is not a root widget, or if the widget is not attached.

    Returns void

dispose

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

    Returns void

fit

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

    See also: [[MsgFitRequest]]

    Returns void

hasClass

  • hasClass(name: string): boolean
  • Test whether the wrapper'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.

    Returns 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.

    Returns void

Protected onAfterAttach

  • onAfterAttach(msg: Message): void
  • Set the size of the terminal when attached if dirty.

    Parameters

    • msg: Message

    Returns void

Protected onAfterShow

  • onAfterShow(msg: Message): void
  • Set the size of the terminal when shown if dirty.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeDetach

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

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

    See also: [[MsgBeforeDetach]]

    Parameters

    • msg: Message

    Returns void

Protected onBeforeHide

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

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

    See also: [[MsgBeforeHide]]

    Parameters

    • msg: Message

    Returns void

Protected onChildAdded

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

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

    See also: [[ChildMessage]]

    Parameters

    • msg: ChildMessage

    Returns void

Protected onChildRemoved

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

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

    See also: [[ChildMessage]]

    Parameters

    • msg: ChildMessage

    Returns void

Protected onCloseRequest

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

    Notes

    The default implementation of this handler detaches the widget.

    See also: close, [[MsgCloseRequest]]

    Parameters

    • msg: Message

    Returns void

Protected onFitRequest

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

    Parameters

    • msg: Message

    Returns void

Protected onResize

  • onResize(msg: ResizeMessage): void
  • On resize, use the computed row and column sizes to resize the terminal.

    Parameters

    • msg: ResizeMessage

    Returns void

Protected onUpdateRequest

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

    Parameters

    • msg: Message

    Returns void

processMessage

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

    Parameters

    • msg: Message

      The message sent to the widget.

      Notes

      Subclasses may reimplement this method as needed.

    Returns void

removeClass

  • removeClass(name: string): void
  • Remove a class name from the wrapper'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.

    Returns void

setFlag

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

    Notes

    This will not typically be consumed directly by user code.

    Parameters

    • flag: WidgetFlag

    Returns void

setHidden

  • setHidden(hidden: boolean): void
  • Set whether the widget is hidden.

    Parameters

    • hidden: boolean

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

      Notes

      widget.setHidden(true) is equivalent to widget.hide(), and widget.setHidden(false) is equivalent to widget.show().

    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.

    Returns void

testFlag

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

    Notes

    This will not typically be consumed directly by user code.

    Parameters

    • flag: WidgetFlag

    Returns boolean

toggleClass

  • toggleClass(name: string, force?: boolean): boolean
  • Toggle a class name on the wrapper's DOM node.

    Parameters

    • name: string

      The class name to toggle on the node.

    • Optional force: boolean

      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.

update

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

    See also: [[MsgUpdateRequest]]

    Returns void

Static createNode

  • createNode(): HTMLElement
  • Create the DOM node for a new node wrapper instance.

    Returns HTMLElement

    The DOM node to use with the node wrapper instance.

    Notes

    The default implementation creates an empty <div>.

    This may be reimplemented by a subclass to create a custom node.

Generated using TypeDoc