Class: WindowClient
Window Client (Finsemble Workspaces)
The Window Client is primarily responsible for managing the windowState
(the window's bounds) and componentState
(data inside of your component).
The reference below is provided in case you'd like to manually trigger events.
Methods
-
bringToFront(cb)
-
Brings the window to the top of all other windows.
Name Type Description cb
StandardErrorCallback optional Example
FSBL.Clients.WindowClient.bringWindowToFront();
-
bringWindowToFront(cb)
-
Brings the window to the top of all other windows
This is a non-promisifed version for backward compatibility. Please use WindowClient.bringToFront()
Name Type Description cb
StandardErrorCallback optional -
cancelTilingOrTabbing(params, cb)
-
This is used to cancel a tabbing or tiling operation.
Name Type Description params
Name Type Description windowIdentifier
windowIdentifier optional The Finsemble identifier for the window.
cb
undefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal -
close(params, cb)
-
Closes window. Defaults are to remove the window from the workspace if the user presses the X button, but not if the window is closed via an app-level request (e.g., switching workspaces, so all windows need to close).
Name Type Description params
Name Type Description closeWindow
boolean Whether to close the window. On shutdown this method is called, but the Window Service actually closes the window.
ignoreParent
optional Whether or not to update the parent (stack) window when closing.
removeFromWorkspace
boolean Whether to remove the window from the workspace.
userInitiated
optional Whether the user clicked the X, or if the system asked the window to close.
cb
StandardErrorCallback optional The callback to be invoked after the method completes successfully.
Example
//Close window and remove from workspace (e.g., user closes the window). FSBL.Clients.WindowClient.close({ removeFromWorkspace: true, closeWindow: true }); //Close window and keep in workspace (e.g., application requests that all windows close themselves). FSBL.Clients.WindowClient.close({ removeFromWorkspace: false, closeWindow: false });
-
ejectFromGroup()
-
Ejects the window from the docking group
-
fitToDOM(params, cb)
-
Automatically resizes the height of the window to fit the full DOM of the current window.
Name Type Description params
Type Literal | null optional Name Type Description N/A
Type Literal Name Type Description maxHeight
Maximum height to make the window.
maxWidth
Maximum width to make the window.
padding
cb
undefined | Type Literal optional Optional callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal -
formGroup()
-
Forms a group with any window that is touching the border of this window.
-
getBounds(cb)
-
Returns the object defining bounds for the current window including the position of the left and right edges measured in pixels from the left edge of the monitor, the top and bottom edges measured in pixels from the top edge, and the width and height of the component in pixels. Please note that this method differs from the right and bottom coordinates passed to LauncherClient.spawn(); those are measured from the right and bottom edges of the screen.
Name Type Description cb
StandardErrorCallback The callback to be invoked after the method completes successfully.
-
getComponentState(params, cb)
-
Given a field, this function retrieves app state. If no params are given, the full state is returned.
Name Type Description params
Name Type Description field
optional Field to retrieve.
fields
string[] optional Fields to retrieve.
windowName
optional Window whose component state you are retrieving. If null, the default is to the calling window.
cb
StandardErrorCallback optional The callback to be invoked after the method completes successfully.
Example
The example below shows how we retrieve data to restore the layout in our charts.
FSBL.Clients.WindowClient.getComponentState({ field: 'myChartLayout', }, function (err, state) { importLayout(state); }); FSBL.Clients.WindowClient.getComponentState({ fields: ['myChartLayout', 'chartType'], }, function (err, state) { var chartType = state['chartType']; var myChartLayout = state['myChartLayout']; });
-
getCurrentWindow()
-
Returns a reference to the current window for the component.
-
getSpawnData()
-
Retrieves data that was set with LauncherClient.spawn.
-
getWindowIdentifier()
-
Returns the window identifier for the current component.
-
getWindowNameForDocking()
-
Gets the window name of current window or the parent, if tabbed. The code that manages window movement will not see a child window if it's part of a stacked window. This function will return the window name that the Window Service cares about for window movement.
-
getWindowTitle()
-
Retrieves the window's title.
Example
var windowTitle = FSBL.Clients.WindowClient.getWindowTitle();
-
maximize(cb)
-
Maximizes the window taking into account any claimed space on the monitor.
Name Type Description cb
StandardErrorCallback optional Optional callback to be invoked after the method completes successfully.
Example
FSBL.Clients.WindowClient.maximize();
-
minimize(cb)
-
Minimizes window.
Name Type Description cb
StandardErrorCallback optional Optional callback to be invoked after the method completes successfully.
Example
FSBL.Clients.WindowClient.minimize();
-
modifyReload()
-
Modifies the built in page reload to also reload any views along with the default behavior.
-
removeComponentState(params, cb)
-
Given a field, this function removes it from app state.
Name Type Description params
Object of data to be removed
Name Type Description field
optional The key name of the field to be saved. Required if not using `fields`.
fields
optional An array of objects with `field` keys to be removed.
windowName
optional The name of the window to remove component state from
cb
StandardErrorCallback optional The callback to be invoked after the method completes successfully.
Example
The example below shows how we would remove our chart layout when it no longer needed.
// remove unused state value FSBL.Clients.WindowClient.removeComponentState({ field: 'myChartLayout'}); FSBL.Clients.WindowClient.removeComponentState({ fields: [{field:'myChartLayout'}, {field:'chartType'}]);
-
restore(cb)
-
Restores window from a maximized or minimized state.
Name Type Description cb
StandardErrorCallback optional Optional callback to be invoked after the method completes successfully.
Example
FSBL.Clients.WindowClient.restore();
-
sendIdentifierForTilingOrTabbing(params, cb)
-
This is used to let Finsemble know which window is being dragged.
params.windowIdentifier
must be the identifier of the tab being dragged. This is only used if the identifier is unknown whenstartTilingOrTabbing
is called.Name Type Description params
The
windowIdentifier
is required.Name Type Description windowIdentifier
windowIdentifier The Finsemble identifier for the target window.
cb
undefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal -
setAlwaysOnTop(alwaysOnTop, cb)
-
Sets whether window is always on top. By default, this is false.
Name Type Description alwaysOnTop
boolean The new mode for the window's alwaysOnTop option to be set to.
cb
StandardErrorCallback optional Optional callback to be invoked after the method completes successfully.
Example
FSBL.Clients.WindowClient.setAlwaysOnTop(true);
-
setComponentState(params, cb)
-
Given a field, this function sets and persists app state.
Name Type Description params
Object of data to be saved
Name Type Description field
optional The key name of the field to be saved. Required if not using `fields`.
fields
optional An array of objects with `field` and `value` keys to be saved.
value
T optional Value of the data being saved. Required if not using `fields`.
windowName
optional Name of the component whose state you are setting. Defaults to the calling window.
cb
StandardErrorCallback optional The callback to be invoked after the method completes successfully.
Example
The example below shows how we save our chart layout when it changes.
var s = stx.exportLayout(true); //saving layout' FSBL.Clients.WindowClient.setComponentState({ field: 'myChartLayout', value: s }); FSBL.Clients.WindowClient.setComponentState({ fields: [{field:'myChartLayout', value: s }, {field:'chartType', value: 'mountain'}]);
-
setShape(params, callback)
-
Defines areas of the window that will be displayed and clickable. All other areas of the window will be transparent. Can be used to create click-through areas of a window.
Name Type Description params
Array optional Optional. Takes an array of rectangle Objects for the areas of the window that will be displayed and clickable. Passing in an empty array or omitting this parameter will cause the full area of the window to be displayed and clickable. A rectangle is defined as: { x: x coordinate for the origin of the rectangle (integer) y: x coordinate for the origin of the rectangle (integer) width: width of the rectangle (integer) height: height of the rectangle (integer) }
callback
Function -
setTaskbarIconOverlay(url)
-
_This feature is experimental. The signature may change in the future._
Sets an overlay image on the MS Windows taskbar, for instance to indicate activity. (This is sometimes referred to as a "badge").
The url must point to a 16x16 png image. Images of other sizes or types will not display.
Note: MacOS does not support taskbar overlay images. This function is safe to call on MacOS but will not perform any function.
Name Type Description url
string | null The url of the icon to use. Pass null to remove the overlay icon.
-
setWindowTitle(title)
-
Deprecated. Please simply set the application's `document.title` element to change the title that appears in the windowTitleBar. Or, set `components["Window Manager"].title` in the app's manifest.
Old documentation: This function sets the window's title in the windowTitleBar component, and in the DOM's title element. This is useful to set the title dynamically based on state information: you can keep the window's title in sync with a piece of data (e.g., a Symbol). This title will not persist between sessions automatically; use setComponentState/getComponentState to persist the title.
Name Type Description title
string Window title.
Example
The code shows how you would change your window title.
FSBL.Clients.WindowClient.setWindowTitle("My Component's New Title");
-
showAtMousePosition()
-
Moves the window so that it's centered above the user's mouse.
-
startMovingWindow(event)
-
Begin programmatically moving the window; the first parameter is a mouse event. Until `stopMovingWindow` is invoked, the window will follow the user's mouse. This should be invoked inside of a `mouseDown` event handler.
Name Type Description event
MouseEvent -
startTilingOrTabbing(params, cb)
-
This is used by the Finsemble window title bar when a tab is dragged for tiling or tabbing.
Name Type Description params
params.windowIdentifier
is required.Name Type Description windowIdentifier
windowIdentifier The Finsemble identifier for the target window.
cb
undefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal -
stopMovingWindow()
-
Stops moving a window that was sent in motion via `startMovingWindow`.
-
stopTilingOrTabbing(params, cb)
-
This function is used by the Finsemble window title bar to end tiling or tabbing.
Name Type Description params
Name Type Description action
optional allowDropOnSelf
optional Determines whether a tab can be dropped on the window where the drag originated.
mousePosition
optional Where the pointer is on the screen
cb
undefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal