Class: DialogManagerClient

Dialog Manager Client

The Dialog Manager client simplifies interacting with dialog windows, by spawning them and getting data back from them. In this contex, a dialog window is simply a child window spawned to interact with the user, such as a confirmation dialog. Functions are provided here for both the parent-window side and the dialog/child-window side.

FSBL.Clients.DialogManager is always pre-initialized with one instance of the Dialog Manager in the Finsemble Library (making it essentially, a singleton when referenced in the same window). This means component developers directly access the Dialog Manager without using the constructor (e.g., FSBL.Clients.DialogManager.spawnDialog(...);) -- the constructor is not exposed to components.

Methods

getParametersFromInDialog
(dialogID){object}

clients/dialogManagerClient.js, line 114

Called within dialog window to get the parameters passed in spawnDialog's "inputParams"

Name Type Description
dialogID any

identifies dialog to be terminated

Returns:
Type Description
object inputParams parameters pass to dialog
Example
var dialogData = FSBL.Clients.DialogManager.getParametersFromInDialog();

respondAndExitFromInDialog
(responseParameters)

clients/dialogManagerClient.js, line 128

Called within dialog window to pass back dialog response and terminal window. This results in the spawnDialog callback function (i.e. dialogResponseCallback) being invoked with responseParameters passed in.

Name Type Description
responseParameters any

parameters returned to parent (i.e. window that spawned the dialog)

Example
FSBL.Clients.DialogManager.respondAndExitFromInDialog({ choice: response });

spawnDialog
(params, inputParams, dialogResponseCallback)

clients/dialogManagerClient.js, line 66

Spawns a Dialog window.

parameters pass here in inputParams can be retrieved in the dialog window by calling getParametersFromInDialog.

TODO
  • allow dialogs to be permanent components instead of ad-hoc.
  • support paramter to make the dialog modal
Name Type Description
params LauncherClient~windowDescriptor

the window descriptor representing a component or URL for the dialog

inputParams any

Object or any data type needed by your dialog.

dialogResponseCallback function

called when response received back from dialog window (typically on dialog completion). responseParameters is defined by the dialog.

Returns:
dialogID can be used to kill a spawned dialog prematurely
Example
FSBL.Clients.DialogManager.spawnDialog(
	{
		name: "dialogTemplate",
		defaultHeight:300,
		defaultWidth:400,
		url:"http://localhost/components/system/dialogs/dialog1.html"
	},
	{
		someData: 12345
	},
		function (error, responseParameters) {
			if (!error) {
				console.log(">>>> spawnDialog response: " + JSON.stringify(responseParameters));
			}
	});