Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DocumentWidgetManager

A class that maintains the lifecycle of file-backed widgets.

Hierarchy

  • DocumentWidgetManager

Implements

  • IDisposable

Index

Constructors

constructor

  • Construct a new document widget manager.

    Parameters

    Returns DocumentWidgetManager

Properties

Private _activateRequested

_activateRequested: any

Private _initializeWidget

_initializeWidget: any

When a new widget is created, we need to hook it up with some signals, update the widget extensions (for this kind of widget) in the docregistry, among other things.

Private _isDisposed

_isDisposed: any

Private _maybeClose

_maybeClose: any

Ask the user whether to close an unsaved file.

Private _onFileChanged

_onFileChanged: any

Handle a file changed signal for a context.

Private _onPathChanged

_onPathChanged: any

Handle a path changed signal for a context.

Private _onWidgetDisposed

_onWidgetDisposed: any

Handle the disposal of a widget.

Private _registry

_registry: any

Private _widgetDisposed

_widgetDisposed: any

Handle the disposal of a widget.

Protected translator

translator: ITranslator

Accessors

activateRequested

  • get activateRequested(): ISignal<this, string>
  • A signal emitted when one of the documents is activated.

    Returns ISignal<this, string>

isDisposed

  • get isDisposed(): boolean
  • Test whether the document widget manager is disposed.

    Returns boolean

Methods

adoptWidget

  • Install the message hook for the widget and add to list of known widgets.

    Parameters

    Returns void

cloneWidget

  • Clone a widget.

    Parameters

    • widget: Widget

      The source widget.

    Returns IDocumentWidget<Widget, IModel>

    A new widget or undefined.

    Notes

    Uses the same widget factory and context as the source, or throws if the source widget is not managed by this manager.

closeWidgets

  • closeWidgets(context: Context): Promise<void>
  • Close the widgets associated with a given context.

    Parameters

    • context: Context

      The document context object.

    Returns Promise<void>

contextForWidget

  • contextForWidget(widget: Widget): Context
  • Get the document context for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns Context

    The context associated with the widget, or undefined.

createWidget

  • Create a widget for a document and handle its lifecycle.

    throws

    If the factory is not registered.

    Parameters

    Returns IDocumentWidget<Widget, IModel>

    A widget created by the factory.

deleteWidgets

  • deleteWidgets(context: Context): Promise<void>
  • Dispose of the widgets associated with a given context regardless of the widget's dirty state.

    Parameters

    • context: Context

      The document context object.

    Returns Promise<void>

dispose

  • dispose(): void
  • Dispose of the resources used by the widget manager.

    Returns void

findWidget

  • See if a widget already exists for the given context and widget name.

    Parameters

    • context: Context

      The document context object.

    • widgetName: string

    Returns IDocumentWidget<Widget, IModel>

    The found widget, or undefined.

    Notes

    This can be used to use an existing widget instead of opening a new widget.

messageHook

  • messageHook(handler: IMessageHandler, msg: Message): boolean
  • Filter a message sent to a message handler.

    Parameters

    • handler: IMessageHandler

      The target handler of the message.

    • msg: Message

      The message dispatched to the handler.

    Returns boolean

    false if the message should be filtered, of true if the message should be dispatched to the handler as normal.

Protected onClose

  • onClose(widget: Widget): Promise<boolean>
  • Handle 'close-request' messages.

    Parameters

    • widget: Widget

      The target widget.

    Returns Promise<boolean>

    A promise that resolves with whether the widget was closed.

Protected onDelete

  • onDelete(widget: Widget): Promise<void>
  • Dispose of widget regardless of widget's dirty state.

    Parameters

    • widget: Widget

      The target widget.

    Returns Promise<void>

Protected setCaption

  • setCaption(widget: Widget): Promise<void>
  • Set the caption for widget title.

    Parameters

    • widget: Widget

      The target widget.

    Returns Promise<void>

Generated using TypeDoc