AboutSupportDeveloper GuideVersion 36.122.80.9

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

  • Experimental

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

    Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged. This means the views you pass to createAdjacentStack() may not render in the order given by the array. Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.

    Parameters

    • views: Partial<ViewOptions>[]

      The views that will populate the new TabStack.

    • options: {
          position?: LayoutPosition;
      }

      Additional options that control new TabStack creation.

    Returns Promise<TabStack>

    The newly-created 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}`);
  • Experimental

    Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.

    Parameters

    • edge: LayoutPosition

      Edge whose adjacent TabStacks will be returned.

    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}`);