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 context, 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.

new DialogManagerClient
(params)
clients/dialogManagerClient.js, line 36

Name Type Description
params object optional

optional parameters

Name Type Description
onReady function optional

callback function indicating when client is ready

name string optional

client name for diagnostics/logging

Methods

checkIfWindowIsDialog
(cb)
clients/dialogManagerClient.js, line 379

Checks to see whether the window is a dialog.

Name Type Description
cb cb

getParametersFromInDialog
(){object}
clients/dialogManagerClient.js, line 117

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

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

hideModal
()
clients/dialogManagerClient.js, line 340

Hides the modal.

open
(type, options, onUserInput)
clients/dialogManagerClient.js, line 292

Retrieves an available dialog. If none are found, one will be created with the options passed.

Name Type Description
type string

component type

options object

options to pass into the opened window.

onUserInput function

Callback to be invoked when the user interacts with the dialog.

registerDialogCallback
(callback)
clients/dialogManagerClient.js, line 330

Used by the window that is opening a dialog. This method sets up a query/responder that the opened dialog will invoke when the user has interacted with the dialog.

Name Type Description
callback function

registerModal
()
clients/dialogManagerClient.js, line 250

Registers a window as a modal with the global dialog management store.

registerWithStore
(callback)
clients/dialogManagerClient.js, line 365

Registers the window as a dialog with the global store. If the component is incapable of being used as a dialog (this is set in the component's config), the callback is immediately invoked.

Name Type Description
callback function

respondAndExitFromInDialog
(responseParameters)
clients/dialogManagerClient.js, line 131

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 object

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

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

respondToOpener
(data)
clients/dialogManagerClient.js, line 351

Sends data back to the window that opened the dialog.

Name Type Description
data any

sendQueryToDialog
(identifier, options, onUserInput)
clients/dialogManagerClient.js, line 180

Function to initialize and open a dialog.

Name Type Description
identifier object

window identifier of the dialog.

options object

Any data to send to the dialog for its initialization

onUserInput function

callback to be invoked after the user interacts with the dialog.

showDialog
()
clients/dialogManagerClient.js, line 167

Broadcasts a message to the window that opened the dialog saying "I'm ready, please show me."

showModal
(cb)
clients/dialogManagerClient.js, line 266

Shows a semi-transparent black modal behind the dialog.

Name Type Description
cb function optional

spawnDialog
(params, inputParams, dialogResponseCallback, cb)
clients/dialogManagerClient.js, line 79

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 object

Parameters. Same as LauncherClient#spawn with the following exceptions.

Name Type Default Description
url string

URL of dialog to launch

name string optional

The name of the dialog

x number | string

Same as LauncherClient#spawn except defaults to "center".

y number | string "center" optional

Same as LauncherClient#spawn except defaults to "center".

inputParams object

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.

cb function optional

Returns response from LauncherClient#spawn

Example
FSBL.Clients.DialogManager.spawnDialog(
	{
		name: "dialogTemplate",
		height:300,
		width:400,
		url:"http://localhost/components/system/dialogs/dialog1.html"
	},
	{
		someData: 12345
	},
		function (error, responseParameters) {
			if (!error) {
				console.log(">>>> spawnDialog response: " + JSON.stringify(responseParameters));
			}
	});