Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TabBarRenderer

A tab bar renderer that offers a context menu. In addition, this renderer is able to set an explicit position and size on the icon and label of each tab in a side bar. This is necessary because the elements of side bar tabs are rotated using the CSS transform property, disrupting the browser's ability to arrange those elements automatically.

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected Optional _tabBar

_tabBar: TabBar<Widget>

Readonly closeIconSelector

closeIconSelector: string

A selector which matches the close icon node in a tab.

Optional contextMenuPath

contextMenuPath: MenuPath

The menu path used to render the context menu.

Protected Optional Readonly contextMenuRenderer

contextMenuRenderer: ContextMenuRenderer

Protected Readonly decorations

decorations: Map<Title<Widget>, Data[]> = new Map<Title<Widget>, WidgetDecoration.Data[]>()

Protected Optional Readonly decoratorService

decoratorService: TabBarDecoratorService

Protected Optional Readonly iconThemeService

iconThemeService: IconThemeService

Protected Readonly toDispose

toDispose: DisposableCollection = new DisposableCollection()

Protected Readonly toDisposeOnTabBar

toDisposeOnTabBar: DisposableCollection = new DisposableCollection()

Accessors

tabBar

  • get tabBar(): TabBar<Widget> | undefined
  • set tabBar(tabBar: TabBar<Widget> | undefined): void

Methods

createIconClass

  • Create the class name for the tab icon.

    Parameters

    Returns string

    The full class name for the tab icon.

createTabClass

  • Create the class name for the tab.

    Parameters

    Returns string

    The full class name for the tab.

createTabDataset

  • createTabDataset(data: IRenderData<any>): ElementDataset
  • Create the dataset for a tab.

    Parameters

    Returns ElementDataset

    The dataset for the tab.

createTabId

  • createTabId(title: Title<Widget>): string

createTabKey

  • Create a unique render key for the tab.

    Parameters

    Returns string

    The unique render key for the tab.

    Notes

    This method caches the key against the tab title the first time the key is generated. This enables efficient rendering of moved tabs and avoids subtle hover style artifacts.

createTabStyle

dispose

  • dispose(): void

findDuplicateLabels

  • findDuplicateLabels(titles: Title<Widget>[]): Map<string, string>
  • Find duplicate labels from the currently opened tabs in the tab bar. Return the appropriate partial paths that can distinguish the identical labels.

    E.g., a/p/index.ts => a/..., b/p/index.ts => b/...

    To prevent excessively long path displayed, show at maximum three levels from the end by default.

    Parameters

    • titles: Title<Widget>[]

      Array of titles in the current tab bar.

    Returns Map<string, string>

    A map from each tab's original path to its displayed partial path.

Protected getDecorationData

  • getDecorationData<K>(title: Title<Widget>, key: K): Data[K][]
  • Get the decoration data given the tab URI and the decoration data type.

    Type parameters

    Parameters

    • title: Title<Widget>

      The title.

    • key: K

      The type of the decoration data.

    Returns Data[K][]

Protected getDecorations

  • getDecorations(title: Title<Widget>): Data[]

Private getIconClass

  • getIconClass(iconName: string | string[], additionalClasses?: string[]): string
  • Get the class of an icon.

    Parameters

    • iconName: string | string[]

      The name of the icon.

    • Default value additionalClasses: string[] = []

      Additional classes of the icon.

    Returns string

Protected handleContextMenuEvent

  • handleContextMenuEvent(event: MouseEvent): void

Protected handleDblClickEvent

  • handleDblClickEvent(event: MouseEvent): void

renderBadge

  • renderBadge(data: SideBarRenderData, isInSidePanel?: undefined | false | true): VirtualElement

renderCloseIcon

  • renderCloseIcon(data: IRenderData<any>): VirtualElement
  • Render the close icon element for a tab.

    Parameters

    • data: IRenderData<any>

      The data to use for rendering the tab.

    Returns VirtualElement

    A virtual element representing the tab close icon.

renderIcon

  • renderIcon(data: SideBarRenderData, inSidePanel?: undefined | false | true): VirtualElement

renderLabel

  • renderLabel(data: SideBarRenderData, isInSidePanel?: undefined | false | true): VirtualElement
  • If size information is available for the label, set it as inline style. Tab padding and icon size are also considered in the top position.

    Parameters

    • data: SideBarRenderData

      Data used to render the tab.

    • Optional isInSidePanel: undefined | false | true

      An optional check which determines if the tab is in the side-panel.

    Returns VirtualElement

    The virtual element of the rendered label.

renderTab

  • renderTab(data: SideBarRenderData, isInSidePanel?: undefined | false | true): VirtualElement
  • Render tabs with the default DOM structure, but additionally register a context menu listener.

    Parameters

    • data: SideBarRenderData

      Data used to render the tab.

    • Optional isInSidePanel: undefined | false | true

      An optional check which determines if the tab is in the side-panel.

    Returns VirtualElement

    The virtual element of the rendered tab.

Protected resetDecorations

  • resetDecorations(title?: Title<Widget>): void