AboutSupportDeveloper GuideVersion 40.130.101.1

Static namespace for OpenFin API methods that interact with the Layout class, available under fin.Platform.Layout.

Hierarchy

  • Base
    • LayoutModule

Accessors

  • get me(): Identity
  • Returns Identity

    me should only be accessed from the fin global (FinApi.me); access through entity classes is not guaranteed to behave sensibly in all calling contexts.

Methods

  • Parameters

    Returns Promise<void>

  • Asynchronously returns a Layout object that represents a Window's layout.

    Returns Promise<Layout>

    const layout = await fin.Platform.Layout.getCurrent();
    // Use wrapped instance to control layout, e.g.:
    const layoutConfig = await layout.getConfig();
  • Synchronously returns a Layout object that represents a Window's layout.

    Returns Layout

    Cannot be called from a view.

    const layout = fin.Platform.Layout.getCurrentSync();
    // Use wrapped instance to control layout, e.g.:
    const layoutConfig = await layout.getConfig();
  • Retrieves the OpenFin.Layout instance for the Window the View is attached to.

    Parameters

    Returns Promise<Layout>

    const viewIdentity = { uuid: 'uuid', name: 'view-name' };
    const layout = await fin.Platform.Layout.getLayoutByViewIdentity(viewIdentity);
    console.log(await layout.getCurrentViews());
  • Experimental

    Initialize the window's Layout.

    Parameters

    Returns Promise<Layout>

    Must be called from a custom window that has a 'layout' option set upon creation of that window. If a containerId is not provided, this method attempts to find an element with the id layout-container. A Layout will emit events locally on the DOM element representing the layout-container. In order to capture the relevant events during Layout initiation, set up the listeners on the DOM element prior to calling init.

    // If no options are included, the layout in the window options is initialized in an element with the id `layout-container`
    const layout = await fin.Platform.Layout.init();

    const containerId = 'my-custom-container-id';

    const myLayoutContainer = document.getElementById(containerId);

    myLayoutContainer.addEventListener('tab-created', function(event) {
    const { tabSelector } = event.detail;
    const tabElement = document.getElementById(tabSelector);
    const existingColor = tabElement.style.backgroundColor;
    tabElement.style.backgroundColor = "red";
    setTimeout(() => {
    tabElement.style.backgroundColor = existingColor;
    }, 2000);
    });

    // initialize the layout into an existing HTML element with the div `my-custom-container-id`
    // the window must have been created with a layout in its window options
    const layout = await fin.Platform.Layout.init({ containerId });
  • Asynchronously returns a Layout object that represents a Window's layout.

    Parameters

    Returns Promise<Layout>

    let windowIdentity;
    if (!fin.me.isWindow) {
    windowIdentity = fin.me.identity;
    } else if (fin.me.isView) {
    windowIdentity = (await fin.me.getCurrentWindow()).identity;
    } else {
    throw new Error('Not running in a platform View or Window');
    }

    const layout = await fin.Platform.Layout.wrap(windowIdentity);
    // Use wrapped instance to control layout, e.g.:
    const layoutConfig = await layout.getConfig();
  • Synchronously returns a Layout object that represents a Window's layout.

    Parameters

    Returns Layout

    let windowIdentity;
    if (!fin.me.isWindow) {
    windowIdentity = fin.me.identity;
    } else if (fin.me.isView) {
    windowIdentity = (await fin.me.getCurrentWindow()).identity;
    } else {
    throw new Error('Not running in a platform View or Window');
    }

    const layout = fin.Platform.Layout.wrapSync(windowIdentity);
    // Use wrapped instance to control layout, e.g.:
    const layoutConfig = await layout.getConfig();