Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DirListing

A widget which hosts a file list area.

Hierarchy

  • Widget
    • DirListing

Implements

  • IDisposable
  • IMessageHandler

Index

Constructors

constructor

Properties

Private _clipboard

_clipboard: string[]

Private _drag

_drag: Drag

Private _dragData

_dragData: object

Type declaration

Private _editNode

_editNode: HTMLInputElement

Private _isCut

_isCut: boolean

Private _items

_items: HTMLElement[]

Private _model

Private _noSelectTimer

_noSelectTimer: number

Private _prevPath

_prevPath: string

Private _selectTimer

_selectTimer: number

Private _softSelection

_softSelection: string

Private _widgetFactory

_widgetFactory: function

Type declaration

    • (model: IContentsModel): Widget
    • Parameters

      • model: IContentsModel

      Returns Widget

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.

Accessors

contentNode

  • get contentNode(): HTMLElement
  • Get the dir listing content node.

    Notes

    This is the node which holds the item nodes.

    Modifying this node directly can lead to undefined behavior.

    This is a read-only property.

    Returns HTMLElement

headerNode

  • get headerNode(): HTMLElement
  • Get the dir listing header node.

    Notes

    This is the node which holds the header cells.

    Modifying this node directly can lead to undefined behavior.

    This is a read-only property.

    Returns HTMLElement

widgetFactory

  • get widgetFactory(): function
  • set widgetFactory(factory: function): void
  • Get the widget factory for the widget.

    Returns function

      • (model: IContentsModel): Widget
      • Parameters

        • model: IContentsModel

        Returns Widget

  • Set the widget factory for the widget.

    Parameters

    • factory: function
        • (model: IContentsModel): Widget
        • Parameters

          • model: IContentsModel

          Returns Widget

    Returns void

Methods

Private _copy

  • _copy(): void
  • Copy the selected items, and optionally cut as well.

    Returns void

Private _doRename

  • _doRename(): Promise<string>
  • Allow the user to rename item on a given row.

    Returns Promise<string>

Private _evtClick

  • _evtClick(event: MouseEvent): void
  • Handle the 'click' event for the widget.

    Parameters

    • event: MouseEvent

    Returns void

Private _evtDblClick

  • _evtDblClick(event: MouseEvent): void
  • Handle the 'dblclick' event for the widget.

    Parameters

    • event: MouseEvent

    Returns void

Private _evtDragEnter

  • _evtDragEnter(event: IDragEvent): void
  • Handle the 'p-dragenter' event for the widget.

    Parameters

    • event: IDragEvent

    Returns void

Private _evtDragLeave

  • _evtDragLeave(event: IDragEvent): void
  • Handle the 'p-dragleave' event for the widget.

    Parameters

    • event: IDragEvent

    Returns void

Private _evtDragOver

  • _evtDragOver(event: IDragEvent): void
  • Handle the 'p-dragover' event for the widget.

    Parameters

    • event: IDragEvent

    Returns void

Private _evtDrop

  • _evtDrop(event: IDragEvent): void
  • Handle the 'p-drop' event for the widget.

    Parameters

    • event: IDragEvent

    Returns void

Private _evtKeydown

  • _evtKeydown(event: KeyboardEvent): void
  • Handle the 'keydown' event for the widget.

    Parameters

    • event: KeyboardEvent

    Returns void

Private _evtMousedown

  • _evtMousedown(event: MouseEvent): void
  • Handle the 'mousedown' event for the widget.

    Parameters

    • event: MouseEvent

    Returns void

Private _evtMousemove

  • _evtMousemove(event: MouseEvent): void
  • Handle the 'mousemove' event for the widget.

    Parameters

    • event: MouseEvent

    Returns void

Private _evtMouseup

  • _evtMouseup(event: MouseEvent): void
  • Handle the 'mouseup' event for the widget.

    Parameters

    • event: MouseEvent

    Returns void

Private _evtScroll

  • _evtScroll(event: MouseEvent): void
  • Handle the 'scroll' event for the widget.

    Parameters

    • event: MouseEvent

    Returns void

Private _getSelectedItems

  • _getSelectedItems(): IContentsModel[]
  • Get the currently selected items.

    Returns IContentsModel[]

Private _handleFileSelect

  • _handleFileSelect(event: MouseEvent): void
  • Handle selection on a file node.

    Parameters

    • event: MouseEvent

    Returns void

Private _handleMultiSelect

  • _handleMultiSelect(selected: string[], index: number): void
  • Handle a multiple select on a file item node.

    Parameters

    • selected: string[]
    • index: number

    Returns void

Private _onModelRefreshed

  • _onModelRefreshed(): void
  • Handle the refreshed signal from the model.

    Returns void

Private _onSelectionChanged

  • _onSelectionChanged(): void
  • Handle the selectionChanged signal from the model.

    Returns void

Private _selectItem

  • _selectItem(index: number, keepExisting: boolean): void
  • Select a given item.

    Parameters

    • index: number
    • keepExisting: boolean

    Returns void

Private _startDrag

  • _startDrag(index: number, clientX: number, clientY: number): void
  • Start a drag event.

    Parameters

    • index: number
    • clientX: number
    • clientY: number

    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.

copy

  • copy(): void

cut

  • cut(): void

delete

  • delete(): Promise<void>
  • Delete the currently selected item(s).

    Returns Promise<void>

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 directory listing.

    Returns void

download

  • download(): Promise<void>
  • Download the currently selected item(s).

    Returns Promise<void>

duplicate

  • duplicate(): Promise<void>
  • Duplicate the currently selected item(s).

    Returns Promise<void>

fit

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

    See also: [[MsgFitRequest]]

    Returns void

handleEvent

  • handleEvent(event: Event): void
  • Handle the DOM events for the directory listing.

    Parameters

    • event: Event

      The DOM event sent to the widget.

      Notes

      This method implements the DOM EventListener interface and is called in response to events on the panel's DOM node. It should not be called directly by user code.

    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
  • A message handler invoked on an 'after-attach' message.

    Parameters

    • msg: Message

    Returns void

Protected onAfterShow

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

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

    See also: [[MsgAfterShow]]

    Parameters

    • msg: Message

    Returns void

Protected onBeforeDetach

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

    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 onResize

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

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

    See also: [[ResizeMessage]]

    Parameters

    • msg: ResizeMessage

    Returns void

Protected onUpdateRequest

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

    Parameters

    • msg: Message

    Returns void

paste

  • paste(): Promise<void>
  • Paste the items from the clipboard.

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

rename

  • rename(): Promise<string>
  • Rename the first currently selected item.

    Returns Promise<string>

selectNext

  • selectNext(keepExisting?: boolean): void
  • Select next item.

    Parameters

    • Default value keepExisting: boolean = false

      Whether to keep the current selection and add to it.

    Returns void

selectPrevious

  • selectPrevious(keepExisting?: boolean): void
  • Select previous item.

    Parameters

    • Default value keepExisting: boolean = false

      Whether to keep the current selection and add to it.

    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

shutdownKernels

  • shutdownKernels(): Promise<void>
  • Shut down kernels on the applicable currently selected items.

    Returns Promise<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 createHeaderNode

  • createHeaderNode(): HTMLElement
  • Create the header node for a dir listing.

    Returns HTMLElement

    A new DOM node to use as the dir listing header.

    Notes

    This method may be reimplemented to create custom headers.

Static createItemNode

  • createItemNode(): HTMLElement
  • Create a new item node for a dir listing.

    Returns HTMLElement

    A new DOM node to use as a content item.

    Notes

    This method may be reimplemented to create custom items.

Static createNode

  • createNode(): HTMLElement
  • Create the DOM node for a dir listing.

    Returns HTMLElement

Static updateItemNode

  • updateItemNode(node: HTMLElement, model: IContentsModel): void
  • Update an item node to reflect the current state of a model.

    Parameters

    • node: HTMLElement

      A node created by a call to createItemNode.

    • model: IContentsModel

      The model object to use for the item state.

      Notes

      This is called automatically when the item should be updated.

      If the createItemNode method is reimplemented, this method should also be reimplemented so that the item state is properly updated.

    Returns void

Generated using TypeDoc