Tabbing

Layouts v1 API is deprecated and no longer supported as of OpenFin 16+. Please use Platform API instead.

Index

Events

TabActivatedEvent

TabActivatedEvent:

Event fired whenever the active tab within a tab group is changed. See addEventListener.

import {tabbing} from 'openfin-layouts';
import {TabActivatedEvent} from 'openfin-layouts/dist/client/tabbing';

tabbing.addEventListener('tab-activated', (event: TabActivatedEvent) => {
    const activeTab = event.identity;
    console.log("Active tab:", activeTab.uuid, activeTab.name);
});

identity

identity: WindowIdentity

Identifies the window that is the source of the current event.

tabstripIdentity

tabstripIdentity: WindowIdentity

Identity object that uniquely identifies the current tabset.

type

type: "tab-activated"

TabAddedEvent

TabAddedEvent:

Event fired whenever the current window is tabbed. This event is used when adding windows to both new and existing tabsets. See addEventListener.

To find out which other windows are in the tabset, use the getTabs() method.

import {tabbing} from 'openfin-layouts';
import {TabAddedEvent} from 'openfin-layouts/dist/client/tabbing';

tabbing.addEventListener('tab-added', async (event: TabAddedEvent) => {
    console.log("Window added to tab group: ", event.identity);
    console.log("Windows in current group: ", await tabbing.getTabs());
});

If a window is moved from one tab group to another, this will be messaged as a tab-removed event, followed by a tab-added.

identity

identity: WindowIdentity

Identifies the window that is the source of the current event.

index

index: number

The index at which the tab was inserted.

An integer in the range [0, <tab count>-1].

properties

properties: TabProperties

The properties of the newly-added tab.

These will be generated from the identity window, or will be whatever properties were previously set for the identity window using updateTabProperties.

tabstripIdentity

tabstripIdentity: WindowIdentity

Identity object that uniquely identifies the current tabset.

type

type: "tab-added"

TabPropertiesUpdatedEvent

TabPropertiesUpdatedEvent:

Event fired whenever a windows tab properties are updated. See addEventListener.

The event will always contain the full properties of the tab, even if only a subset of them were updated.

import {tabbing} from 'openfin-layouts';
import {TabPropertiesUpdatedEvent} from 'openfin-layouts/dist/client/tabbing';

tabbing.addEventListener('tab-properties-updated', (event: TabPropertiesUpdatedEvent) => {
    const tabIdentity = event.identity;
    const properties = event.properties;
    console.log(`Properties for ${tabIdentity.uuid}/${tabIdentity.name} are:`, properties);
});

identity

identity: WindowIdentity

Identifies the window that is the source of the current event.

properties

properties: TabProperties

New tab properties.

This will always contain the full set of properties for the tab, even if only a subset of the properties were updated in the updateTabProperties call.

type

type: "tab-properties-updated"

TabRemovedEvent

TabRemovedEvent:

Event fired whenever the current window is removed from it's previous tabset. See addEventListener.

To find out which other windows are in the tabset, use the getTabs() method.

import {tabbing} from 'openfin-layouts';
import {TabRemovedEvent} from 'openfin-layouts/dist/client/tabbing';

tabbing.addEventListener('tab-removed', async (event: TabRemovedEvent) => {
    console.log("Window removed from tab group");
});

If a window is moved from one tab group to another, this will be messaged as a tab-removed event, followed by a tab-added.

identity

identity: WindowIdentity

Identifies the window that is the source of the current event.

tabstripIdentity

tabstripIdentity: WindowIdentity

Identity object that uniquely identifies the current tabset.

type

type: "tab-removed"

Functions

addEventListener

  • addEventListener(eventType: "tab-added", listener: function): void
  • addEventListener(eventType: "tab-removed", listener: function): void
  • addEventListener(eventType: "tab-activated", listener: function): void
  • addEventListener(eventType: "tab-properties-updated", listener: function): void

closeTab

  • closeTab(identity?: Identity): Promise<void>
  • Closes the tab for the window context and removes it from its associated tab group.

    import {tabbing} from 'openfin-layouts';
    
    // Closes the current window context tab.
    tabbing.closeTab();
    
    // Closes another windows context tab.
    tabbing.closeTab({uuid: 'App1', name: 'App1'});

    Note that the identity doesn't need to be tabbed for this call to take effect - so long as the window is known with the service.

    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity refers to a window that doesn't exist, or is deregistered from the service.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to close. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>

closeTabGroup

  • closeTabGroup(identity?: Identity): Promise<void>
  • Closes the tab group for the window context.

    import {tabbing} from 'openfin-layouts';
    
    // Closes the tab group for the current window context.
    tabbing.closeTabGroup();
    
    // Closes the tab group for another windows context.
    tabbing.closeTabGroup({uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity is not an existing tab in a tabstrip.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to close the tab group for. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>

createTabGroup

  • createTabGroup(identities: Identity[], activeTab?: Identity): Promise<void>
  • Creates a tabgroup with the provided windows. The first window in the set will be used to define the tab strips properties. See setTabstrip.

    import {tabbing} from 'openfin-layouts';
    
    tabbing.createTabGroup([{uuid: "App1", name: "App1"}, {uuid: "App2", name: "App2"}, {uuid: "App3", name: "App3"}]);
    throws

    Error: If one of the provided Identities is not valid.

    throws

    Error: If duplicate Identities are provided.

    throws

    Error: If the provided value is not an array or less than 2 windows identities were provided.

    Parameters

    • identities: Identity[]

      Array of window Identities which will be added to the new tab group.

    • Optional activeTab: Identity

      The Identity of the window to set as the active tab in the group. If not provided, the first tab in the tab group will be set as the active tab.

    Returns Promise<void>

getTabs

  • Returns array of window identity references for tabs belonging to the tab group of the provided window context.

    If there is no tab group associated with the window context, will resolve to null.

    import {tabbing} from 'openfin-layouts';
    
    // Gets all tabs for the current window context.
    tabbing.getTabs();
    
    // Get all tabs for another window context.
    tabbing.getTabs({uuid: "sample-window-uuid", name: "sample-window-name"});
    throws

    Error: If identity is not a valid Identity.

    Parameters

    • Default value identity: Identity = getId()

      The window context, defaults to the current window.

    Returns Promise<WindowIdentity[] | null>

maximizeTabGroup

  • maximizeTabGroup(identity?: Identity): Promise<void>
  • Maximizes the tab group for the window context.

    import {tabbing} from 'openfin-layouts';
    
    // Maximizes the tab group for the current window context.
    tabbing.maxmimizeTabGroup();
    
    // Maximizes the tab group for another windows context.
    tabbing.maximizeTabGroup({uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity is not an existing tab in a tabstrip.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to maximize the tab group for. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>

minimizeTabGroup

  • minimizeTabGroup(identity?: Identity): Promise<void>
  • Minimizes the tab group for the window context.

    import {tabbing} from 'openfin-layouts';
    
    // Minimizes the tab group for the current window context.
    tabbing.minimizeTabGroup();
    
    // Minimizes the tab group for another windows context.
    tabbing.minimizeTabGroup({uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity is not an existing tab in a tabstrip.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to minimize the tab group for. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>

removeEventListener

  • removeEventListener(eventType: "tab-added", listener: function): void
  • removeEventListener(eventType: "tab-removed", listener: function): void
  • removeEventListener(eventType: "tab-activated", listener: function): void
  • removeEventListener(eventType: "tab-properties-updated", listener: function): void

removeTab

  • removeTab(identity?: Identity): Promise<void>
  • Removes the specified window context from its tab group. This does not close the window.

    import {tabbing} from 'openfin-layouts';
    
    // Remove the window from its tab group.
    tabbing.removeTab();
    
    // Remove another window from its tab group.
    tabbing.removeTab({uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity refers to a window that doesn't exist, or is deregistered from the service.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to remove. If no Identity is provided as an argument, the current window context will be used.

    Returns Promise<void>

restoreTabGroup

  • restoreTabGroup(identity?: Identity): Promise<void>
  • Restores the tab group for the window context to its normal state.

    import {tabbing} from 'openfin-layouts';
    
    // Restores the tab group for the current window context.
    tabbing.restoreTabGroup();
    
    // Restores the tab group for another windows context.
    tabbing.restoreTabGroup({uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity is not an existing tab in a tabstrip.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to restore the tab group for. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>

setActiveTab

  • setActiveTab(identity?: Identity): Promise<void>
  • Sets the window context as the active tab in its tab group. Active tabs are brought to the front of the tab group and shown.

    import {tabbing} from 'openfin-layouts'
    
    // Sets the current window as active in the tab group.
    tabbing.setActiveTab()
    
    // Sets another window context as the active tab.
    tabbing.setActiveTab({uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    throws

    Error: If identity is not an existing tab in a tabstrip.

    Parameters

    • Default value identity: Identity = getId()

      Identity of the window context to set as active. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>

setTabstrip

  • Creates the custom tabstrip + configuration for the entire application. An application cannot have different windows using different tabstrip UIs.

    import {tabbing} from 'openfin-layouts';
    
    tabbing.setTabstrip({url: 'https://localhost/customTabstrip.html', height: 60});
    throws

    Error: If config is not a valid ApplicationUIConfig

    throws

    Error: If config.url is not a valid URL/URI.

    Parameters

    Returns Promise<void>

tabSelfTo

  • tabSelfTo(identity: Identity): Promise<void>
  • Adds the current window context as a tab to the provided window context.

    The added tab will be brought into focus.

    import {tabbing} from 'openfin-layouts';
    
    // Tab current window to App1.
    tabbing.tabSelfTo({uuid: 'App1', name: 'App1'});
    throws

    Error: If the App Config does not match between the window to add and the current window context.

    throws

    Error: If the Identity is not a valid Identity.

    throws

    Error: If the Identity matches the calling windows Identity.

    Parameters

    • identity: Identity

    Returns Promise<void>

tabToSelf

  • tabToSelf(identity: Identity): Promise<void>
  • Adds the provided window context as a tab to the current window context.

    The added tab will be brought into focus.

    import {tabbing} from 'openfin-layouts';
    
    // Tab App2 to current window.
    tabbing.tabToSelf({uuid: 'App2', name: 'App2'});
    throws

    Error: If the App Config does not match between the window to add and the current window context.

    throws

    Error: If the Identity is not a valid Identity.

    throws

    Error: If the Identity matches the calling windows Identity.

    Parameters

    • identity: Identity

    Returns Promise<void>

tabWindowToWindow

  • tabWindowToWindow(windowToAdd: Identity, targetWindow: Identity): Promise<void>
  • Tabs two windows together. If the targetWindow is already in a group, the tab will be added to that group.

    The added tab will be brought into focus.

    import {tabbing} from 'openfin-layouts';
    
    // Tab App1 to App2
    tabbing.tabWindowToWindow({uuid: 'App1', name: 'App1'}, {uuid: 'App2', name: 'App2'});
    throws

    Error: If the App Config does not match between the target and window to add.

    throws

    Error: If the targetWindow is not a valid Identity.

    throws

    Error: If the windowToAdd is not a valid Identity.

    Parameters

    • windowToAdd: Identity

      The identity of the window to add to the tab group.

    • targetWindow: Identity

      The identity of the window to create a tab group on.

    Returns Promise<void>

updateTabProperties

  • updateTabProperties(properties: Partial<TabProperties>, identity?: Identity): Promise<void>
  • Updates a tab's properties. Properties for a tab include its title and icon when in a tab group.

    import {tabbing} from 'openfin-layouts';
    
    // Updating only some properties for the current window context.
    tabbing.updateTabProperties({title: 'An Awesome Tab!'});
    
    // Update all properties for the current window context.
    tabbing.updateTabProperties({title: 'An Awesome Tab!', icon: 'http://openfin.co/favicon.ico'});
    
    // Update properties for another windows context.
    tabbing.updateTabProperties({title: 'An Awesome Tab'}, {uuid: 'App1', name: 'App1'});
    throws

    Error: If identity is not a valid Identity.

    Parameters

    • properties: Partial<TabProperties>

      Properties object for the tab to consume.

    • Default value identity: Identity = getId()

      Identity of the window context set the properties on. If no Identity is provided as an argument the current window context will be used.

    Returns Promise<void>