• Back to Glue42 Enterprise Docs
Glue42 enterprise documentation

Reference Documentation

  • Back to Glue42 Enterprise Docs
Press/
  • Glue
  • Application Preferences
  • AppManager
  • Channels
  • Connection
  • Cookies
  • Displays
  • Hotkeys
  • Intents
  • Interop
  • Layouts
  • Logger
  • Metrics
  • Notifications
  • Pub Sub
  • Shared Contexts
  • Themes
  • Windows
  • Workspaces

Layouts

5.18.2

The Layouts API allows you to save the arrangement and context of any set of applications running in Glue42 Enterprise as a named Layout and later restore it. You can also choose a default Global Layout which Glue42 Enterprise will load upon startup.

The Layouts library supports different types of Layouts - e.g., Global, Application Default, Workspace.

The Layouts API is accessible through the glue.layouts object.

APIobject

Description

Layouts API.

Methods

  • clearDefaultGlobal
  • export
  • get
  • getAll
  • getCurrentLayout
  • getDefaultGlobal
  • hibernate
  • import
  • list
  • onAdded
  • onChanged
  • onRemoved
  • onRenamed
  • onRestored
  • onSaveRequested
  • remove
  • rename
  • restore
  • resume
  • save
  • setDefaultGlobal
  • updateAppContextInCurrent
  • updateDefaultContext
  • updateMetadata

clearDefaultGlobalmethod

Signature

() => Promise<void>

Description

Clears the default global layout

exportmethod

Signature

(layoutType: LayoutType) => Promise<Layout[]>

Description

Returns all layouts in the system.

Parameters

Name Type Required Description
layoutType LayoutType

getmethod

Signature

(name: string, type: LayoutType) => Promise<Layout>

Description

Fetches a saved layout or returns undefined if a layout with the provided name and type does not exist.

Parameters

Name Type Required Description
name string

Name of the layout to fetch.

type LayoutType

Type of the layout to fetch.

getAllmethod

Signature

(type: LayoutType) => Promise<LayoutSummary[]>

Description

Returns a lightweight, summarized version of all layouts of the provided type.

Parameters

Name Type Required Description
type LayoutType

Type of the layouts to fetch.

getCurrentLayoutmethod

Signature

() => Promise<Layout>

Description

Returns the last restored global layout

getDefaultGlobalmethod

Signature

() => Promise<Layout>

Description

Returns the default global layout (might be undefined)

hibernatemethod

Signature

(name: string, options: HibernationOptions) => Promise<void>

Description

Hibernates a layout.

Available since version 4.8 and Glue42 3.9

Parameters

Name Type Required Description
name string

The name of the layout

options HibernationOptions

Options for hibernating a layout.

importmethod

Signature

(layouts: Layout[], mode: "replace" | "merge") => Promise<void>

Description

Imports one or more layouts.

Parameters

Name Type Required Description
layouts Layout[]

Layouts to import.

mode "replace" | "merge"

Mode for importing the layouts - replace or merge.

listmethod

Signature

() => Layout[]

Description

Lists all layouts.

onAddedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a new layout is added.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the layout as a parameter and returns an unsubscribe function.

onChangedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a layout is changed.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the layout as a parameter and returns an unsubscribe function.

onRemovedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a layout is removed.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the layout as a parameter and returns an unsubscribe function.

onRenamedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a layout is renamed.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the layout as a parameter and returns an unsubscribe function.

onRestoredmethod

Signature

(callback: (Layout: Layout) => void) => UnsubscribeFunction

Description

Notifies when a global layout is restored

Parameters

Name Type Required Description
callback (Layout: Layout) => void

onSaveRequestedmethod

Signature

(callback: (info?: SaveRequestContext) => SaveRequestResponse) => () => void

Description

Subscribes for layout save requests.

Parameters

Name Type Required Description
callback (info?: SaveRequestContext) => SaveRequestResponse

The callback passed as an argument will be invoked when a layout save is requested. You have the option to save data (context) which will be restored when the layout is restored. Returns an unsubscribe function.

removemethod

Signature

(type: string, name: string) => Promise<void>

Description

Removes a layout

Parameters

Name Type Required Description
type string

Type of the layout to remove.

name string

Name of the layout to remove.

renamemethod

Signature

(layout: Layout, newName: string) => Promise<void>

Description

Renames a layout.

Parameters

Name Type Required Description
layout Layout

Existing layout to rename.

newName string

The new name of the layout.

restoremethod

Signature

(options: RestoreOptions) => Promise<void>

Description

Restores a layout.

Parameters

Name Type Required Description
options RestoreOptions

Options for restoring a layout.

resumemethod

Signature

(name: string, context: any, options: ResumeOptions) => Promise<void>

Description

Resumes a layout.

Available since version 4.8 and Glue42 3.9

Parameters

Name Type Required Description
name string

The name of the layout.

context any

The context of the layout

options ResumeOptions

savemethod

Signature

(layout: NewLayoutOptions) => Promise<Layout>

Description

Saves a new layout.

Parameters

Name Type Required Description
layout NewLayoutOptions

Options for saving a layout.

setDefaultGlobalmethod

Signature

(name: string) => Promise<void>

Description

Sets a new default global layout

Parameters

Name Type Required Description
name string

updateAppContextInCurrentmethod

Signature

(context: object) => Promise<void>

Description

Updates the context saved for your application in the currently loaded layout

Parameters

Name Type Required Description
context object

the new context

updateDefaultContextmethod

Signature

(context: object) => Promise<void>

Description

Updates the context that will be saved as a default context for the current window.

Available since version Glue42 3.10

Parameters

Name Type Required Description
context object

New context that will be saved as a default window context.

updateMetadatamethod

Signature

(layout: Layout) => Promise<void>

Description

Updates the metadata of a layout.

Parameters

Name Type Required Description
layout Layout

Existing layout to update.

Configurationobject

Description

Layouts library configuration object.

Properties

Property Type Default Required Description
autoSaveWindowContext boolean | LayoutType[] false

If true, the context of the current window will be saved. Since Glue42 Enterprise 3.13.1 you can also specify a list of Layout types for which to save the window context.

Available since version 3.10
mode Mode

Layouts mode.

HibernationOptionsobject

Description

Options object for hibernating layouts.

Properties

Property Type Default Required Description
context object

Context object that will be passed to the restored apps. It will be merged with the saved context object.

metadata any

Metadata to be saved with the layout.

Layoutobject

Description

Describes a layout and its state.

Properties

Property Type Default Required Description
components LayoutComponent[]

Array of component objects describing the applications that are saved in the layout.

context any

Context object passed when the layout was saved.

metadata any

Metadata passed when the layout was saved.

name string

Name of the layout. The name is unique per layout type.

type LayoutType

Type of the layout.

version number

Version of the layout

LayoutComponentobject

Description

Saved component (single window application or activity) with its state (bounds, context).

Properties

Property Type Default Required Description
componentType ComponentType

Type of the component - can be application or activity.

state any

Object describing the application bounds, name, context, etc.

type string

LayoutSummaryobject

Properties

Property Type Default Required Description
context any

Context object passed when the layout was saved.

metadata any

Metadata passed when the layout was saved.

name string

Name of the layout. The name is unique per layout type.

type LayoutType

Type of the layout.

NewLayoutOptionsobject

Description

Object describing the layout that you want to save.

Properties

Property Type Default Required Description
activityId string

Only if the layout type is Activity. Will save the layout of the activity with the provided ID. If not passed, will use the activity that the calling application participates in. If the current application is not in an activity, an error will be thrown.

context any

Context (application specific data) to be saved with the layout. Used to transfer data to the applications when restoring a layout.

ignoreInstances string[]

Only if the layout type is Global. Will ignore those instances.

instances string[]

Only if the layout type is Global. Will save those instances.

metadata any

Metadata to be saved with the layout.

name string

Name of the layout.

type LayoutType "Global"

Type of the layout.

RestoreOptionsobject

Description

Options object for restoring layouts.

Properties

Property Type Default Required Description
activityIdToJoin string

Only if the type is Activity. If set, the activity will be restored and joined to the specified activity. If not set, a new activity instance will be created from the saved layout.

closeMe boolean true

If true, will close the current application. If closeRunningInstanceis set to false,closeMes default will change tofalse` too.

closeRunningInstance boolean

Deprecated. Use closeRunningInstances instead.

closeRunningInstances boolean

Only if the type is Global. If false, will not close all visible running instances before restoring the layout. Exceptions are applications which are configured as shell, service, autoStart, ignoreFromLayouts (Glue42 Toolbar is shell). The default is true.

context unknown

Context object that will be passed to the restored apps. It will be merged with the saved context object.

ignoreActivityWindowTypes string[]

Only if the type is Activity and activityId is set. With this you can specify that certain window types should not be restored.

name string

Name of the layout to restore.

reuseWindows boolean

Only if the type is Activity. If true (default), will try to reuse existing windows when restoring the layout.

setActivityContext boolean

Only if the type is Activity. If true (default), will set the activity context upon restore.

timeout number

Restore timeout option.

type string "Global"

Type of the layout to restore.

RestoreSplashOptionsobject

Description

Options for the restore splash screen.

Properties

Property Type Default Required Description
animationColor string

Animation color.

backgroundColor string

Background color.

text string

Text for the splash screen.

textColor string

Text color.

ResumeOptionsobject

Properties

Property Type Default Required Description
cleanUp boolean

Whether to stop any already running apps before resuming the layout.

SaveRequestContextobject

Properties

Property Type Default Required Description
context unknown
layoutName string
layoutType LayoutType

SaveRequestResponseobject

Description

Object returned as a result to a save layout request.

Properties

Property Type Default Required Description
activityContext object

The window can return activity context if it is an owner window of the activity. On restore, this context will be merged with the activity context passed when restoring the layout.

windowContext object

Context object specific to the application.

ComponentTypeenumeration

Description

Type of the layout component - activity or application.

  • "activity"
  • "application"

ImportModeenumeration

Description

Controls the import behavior. If replace (default), all existing layouts will be removed. If merge, the layouts will be added to the existing ones.

  • "replace"
  • "merge"

LayoutTypeenumeration

Description

The supported Layout types are "Global", "ApplicationDefault" and "Workspace". The "Activity" and "Swimlane" types are legacy Layout types and shouldn't be used. In a Global Layout, all running applications and their state is saved. By default, hidden windows are ignored. The Application Default Layout describes the default Layout for an application instance - the last saved window bounds, state and context. The Workspace Layout describes the arrangement of the Workspace elements, its bounds and individual window context.

  • "Global"
  • "Activity"
  • "ApplicationDefault"
  • "Swimlane"
  • "Workspace"

Modeenumeration

Description

Library initialization mode:

  • slim - in this mode the application will be able to store custom data when a layout is saved and will not track layout events. It will not be able to manage layouts - create, delete, rename.
  • full - in this mode the application will be able to store custom data when a layout is saved and will track layout events. It will be able to manage layouts - create, delete, rename.
  • fullWaitSnapshot - same as full, only the library will notify that it is ready when it receives the snapshot of the layouts. In full mode, ready() is called when the library has successfully subscribed to a stream (a little earlier).
  • "slim"
  • "full"
  • "fullWaitSnapshot"

  • © 2022 Glue42
  • Home
  • Privacy policy
  • Contact Sales
  • Glue42.com
  • Tick42.com
  • Overview
  • API
  • Configuration
  • HibernationOptions
  • Layout
  • LayoutComponent
  • LayoutSummary
  • NewLayoutOptions
  • RestoreOptions
  • RestoreSplashOptions
  • ResumeOptions
  • SaveRequestContext
  • SaveRequestResponse
  • ComponentType
  • ImportMode
  • LayoutType
  • Mode
Navigate
Go