AboutSupportDeveloper GuideVersion 33

A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.

Hierarchy

  • LayoutNode
    • ColumnOrRow

Properties

type: "row" | "column"

The type of this ColumnOrRow. Either 'row' or 'column'.

Methods

  • Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.

    Parameters

    Returns Promise<TabStack>

    Example

    if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
    }

    const stack = await fin.me.getCurrentStack();
    const columnOrRow = await stack.getParent();

    // Create view references by supplying a 'name' and 'url'
    const views = [
    // if 'name' is undefined, one will be generated
    // if 'url' is undefined, it will default the view URL to 'about:blank'
    { name: 'google-view', url: 'http://google.com/'},
    { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
    ];

    // Create a view beforehand to be included in the new tab stack
    const outsideView = await fin.View.create({
    name: 'outside-bloomberg-view',
    url: 'https://bloomberg.com/',
    target: fin.me.identity,
    });

    // Views to add can be identities, or the reference views mentioned above
    const viewsToAdd = [outsideView.identity, ...views];

    // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
    let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
    // Or
    let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
    console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
  • Checks if the TabStack or ColumnOrRow exists

    Returns Promise<boolean>

    Example

    if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
    }

    const stack = await fin.me.getCurrentStack();
    // Retrieves the parent ColumnOrRow
    const columnOrRow = await stack.getParent();
    let exists = await stack.exists();
    // or
    let exists = await columnOrRow.exists();
    // The entity exists: true
    console.log(`The entity exists: ${exists}`);
  • Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow

    Parameters

    Returns Promise<TabStack[]>

    Example

    if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
    }

    const stack = await fin.me.getCurrentStack();
    const columnOrRow = await stack.getParent();
    // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
    let rightStacks = await columnOrRow.getAdjacentStacks('right');
    let leftStacks = await columnOrRow.getAdjacentStacks('left');
    // or
    let rightStacks = await stack.getAdjacentStacks('right');
    let leftStacks = await stack.getAdjacentStacks('left');

    console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
  • Retrieves the content array of the ColumnOrRow

    Returns Promise<(TabStack | ColumnOrRow)[]>

    Example

    if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
    }

    const stack = await fin.me.getCurrentStack();
    // Retrieves the parent ColumnOrRow
    const columnOrRow = await stack.getParent();

    // returns [TabStack]
    const contentArray = await columnOrRow.getContent();
    console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
  • Retrieves the parent of the TabStack or ColumnOrRow

    Returns Promise<undefined | TabStack | ColumnOrRow>

    Example

    if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
    }

    const stack = await fin.me.getCurrentStack();
    // Retrieves the parent ColumnOrRow
    const columnOrRow = await stack.getParent();

    // undefined if entity is the root item
    let parent = await columnOrRow.getParent();
    // or
    let parent = await stack.getParent();
  • Checks if the TabStack or ColumnOrRow is the root content item

    Returns Promise<boolean>

    Example

    if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
    }

    const stack = await fin.me.getCurrentStack();
    const isRoot = await stack.isRoot();
    // The TabStack is root: false
    console.log(`The TabStack is root: ${isRoot}`);

    // Retrieves the parent ColumnOrRow
    const parent = await stack.getParent();
    const parentIsRoot = await parent.isRoot();
    // The parent ColumnOrRow is root: true
    console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);