Class: DialogManagerClient
Dialog Manager Client (Finsemble Flow)
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 when developing Finsemble components, you directly access the Dialog Manager without using the constructor (e.g., FSBL.Clients.DialogManager.spawnDialog(...);
). The constructor is not exposed to components.
Methods
-
checkIfWindowIsDialog(cb)
-
Checks to see whether the window is a dialog, setting this.isDialog to true or false
Name Type Description cb
undefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal -
getParametersFromInDialog()
-
Called from within dialog window to get the parameters passed in
spawnDialog
as"inputParams"
. For example, if your dialog has a configurable title, you would pass it in tospawnDialog
, and retrieve the value usinggetParametersFromInDialog
.Example
var dialogData = FSBL.Clients.DialogManager.getParametersFromInDialog();
-
hideModal()
-
Hides the dialog's modal.
-
open(type, options, onUserInput)
-
Retrieves an available dialog. If none are found, one will be created with the options passed.
Resolves to an error string if the dialog could not be opened, or null if it was successfully opened.
Name Type Description type
string Component type to open. The
type
must be a key in the finsemble.components configuration object.options
any Options to pass into the opened window.
onUserInput
StandardErrorCallback Callback to be invoked when the user interacts with the dialog.
-
registerDialogCallback(cb)
-
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 cb
StandardErrorCallback -
registerModal()
-
Registers this window as a modal with the global dialog management store and setting it up as a "scrim" - taking up the entire size of the monitor and being invisible or lightly opaque.
Sometimes, clicking anywhere on this window will dismiss the modal.
-
registerWithStore(cb)
-
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.
Note: This method will check to see whether the calling window is a dialog.
Name Type Description cb
undefined | Type Literal optional Name Type Description N/A
Type Literal -
respondAndExitFromInDialog(responseParameters)
-
Called within the dialog window to pass back a dialog response. This results in the
spawnDialog
callback function (i.e.,dialogResponseCallback
) being invoked withresponseParameters
passed in.Name Type Description responseParameters
any The parameters returned to parent (i.e., window that spawned the dialog).
Example
FSBL.Clients.DialogManager.respondAndExitFromInDialog({ choice: response });
-
respondToOpener(data)
-
Sends data back to the window that opened the dialog. Will hide the modal unless
{ hideModalOnClose: false }
is passed in as the first argument.Name Type Description data
any Data desired to be handed back to the window that requested the dialog.
-
sendQueryToDialog(identifier, options, onUserInput)
-
Function to initialize and open a dialog.
Name Type Description identifier
WindowIdentifier An object that includes all the potential identifications for a window. For instance, one can try and obtain a reference for a window if some of these values are known.
Name Type Description componentType
optional The type of component
uuid
optional uuid is deprecated
waitForReady
optional windowName
string The name of the physical HTML window, or a reference to a native window that was launched with Assimilation service
windowType
optional options
any Any data to send to the dialog for its initialization.
onUserInput
StandardErrorCallback Callback to be invoked after the user interacts with the dialog.
-
showDialog()
-
Broadcasts a message to the window that opened the dialog saying "I'm ready, please show me."
-
showModal(cb)
-
Shows a semi-transparent black modal behind the dialog.
Name Type Description cb
undefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/A
Type Literal -
spawnDialog(params, inputParams, dialogResponseCallback, cb)
-
Spawns a dialog window.
parameters passed here in
params.inputParams
can be retrieved in the dialog window by callinggetParametersFromInDialog
.Name Type Description params
SpawnParams Parameters. Same as
LauncherClient#spawn
with the following exceptions.inputParams
any Object or any data type needed by your dialog.
dialogResponseCallback
StandardErrorCallback called when response received back from dialog window (typically on dialog completion). `responseParameters` is defined by the dialog.
cb
StandardErrorCallback 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 }, (error, responseParameters) => { if (!error) { console.log(">>>> spawnDialog response: " + JSON.stringify(responseParameters)); } });