Layout

Layout

A Layout class, used to create a layout of Window objects.

Example:

// Create window(s).
let state = {
      width: 400,
      height: 400,
      url: 'child.html',
      title: 'Window X',
      frame: false
  };

// Make an array of windows.
let configs = [state, state, state];

// Create the layout.
let layout = new windowmanager.Layout('tabbed', 'layout-div', configs);

Constructor

new Layout(type, id, configs, tabHeight)

Constructor for the layout class.

Example:

// Create the layout.
let layout = new windowmanager.Layout('tiled', 'layout-div', configs);
Parameters:
Name Type Description
type string

The type of layout, defaults to tiled

id string

The id of the element to attach to, if none provided the layout will attach to the body

configs Array.Object

The config objects to create the windows from

tabHeight String

If in tabbed view, the height of the tab toolbar. Used to offset the active window div.

Methods

(static) getAll() → {Array.<Window>}

Returns a list of all Layout instances open.

Example:

// Close all windows:
let allWindows = windowmanager.Layout.getAll();
Returns:
Type:
Array.<Window>

(static) getAllTabbed() → {Array.<Layout>}

Returns all tab style Layout instances open.

Example:

let allTabSets = windowmanager.Layout.getAllTabbed();
Returns:
Type:
Array.<Layout>

(static) getByID(id) → {Layout|undefined}

Returns the Layout instance that has id.

Example:

// Get layout with ID:
let layout = windowmanager.Layout.getById(windowID);
Parameters:
Name Type Description
id String | Number
Returns:
Type:
Layout | undefined

_changeActiveWindow(id)

Method for changing the active window.

Parameters:
Name Type Description
id string

The id of the window to show

_createTabbedLayoutItem(title, id)

Method for creating a tab in the tabbed layout.

Parameters:
Name Type Description
title string

The title of the window being created to display in the tab's text

id string

The id of the window being created

_createTiledLayoutItem()

Method for creating a list element to add a window to.

_tabbed(configs, id)

Method for creating a tabbed layout.

Parameters:
Name Type Description
configs Array.Object

The config objects to create the windows from

id string

The id of the element to attach to, if none provided the layout will attach to the body

_tiled(configs, id)

Method for creating a tiled layout of windows.

Parameters:
Name Type Description
configs Array.Object

The config objects to create the windows from

id string

The id of the element to attach to, if none provided the layout will attach to the body

addWindow(config) → {Windowlo}

Function to add a window to the layout scheme.

Parameters:
Name Type Description
config Object

The configuration object for the window

Returns:
Type:
Windowlo

getWindow(id) → {Window}

Method to get a window by its id.

Parameters:
Name Type Description
id string

the id of the window to find.

Returns:
Type:
Window

getWindows() → {Array.Window}

Function to retrieve all windows being managed.

Returns:
Type:
Array.Window

removeWindow(id)

Function to remove a window from the layout scheme.

Parameters:
Name Type Description
id String

The id of the window to remove.