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 cbundefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/AType Literal -
getParametersFromInDialog()
-
Called from within dialog window to get the parameters passed in
spawnDialogas"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 typestring Component type to open. The
typemust be a key in the finsemble.components configuration object.optionsany Options to pass into the opened window.
onUserInputStandardErrorCallback 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 cbStandardErrorCallback -
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 cbundefined | Type Literal optional Name Type Description N/AType Literal -
respondAndExitFromInDialog(responseParameters)
-
Called within the dialog window to pass back a dialog response. This results in the
spawnDialogcallback function (i.e.,dialogResponseCallback) being invoked withresponseParameterspassed in.Name Type Description responseParametersany 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 dataany 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 identifierWindowIdentifier 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 componentTypeoptional The type of component
uuidoptional uuid is deprecated
waitForReadyoptional windowNamestring The name of the physical HTML window, or a reference to a native window that was launched with Assimilation service
windowTypeoptional optionsany Any data to send to the dialog for its initialization.
onUserInputStandardErrorCallback 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 cbundefined | Type Literal optional The callback to be invoked after the method completes successfully.
Name Type Description N/AType Literal -
spawnDialog(params, inputParams, dialogResponseCallback, cb)
-
Spawns a dialog window.
parameters passed here in
params.inputParamscan be retrieved in the dialog window by callinggetParametersFromInDialog.Name Type Description paramsSpawnParams Parameters. Same as
LauncherClient#spawnwith the following exceptions.inputParamsany Object or any data type needed by your dialog.
dialogResponseCallbackStandardErrorCallback called when response received back from dialog window (typically on dialog completion). `responseParameters` is defined by the dialog.
cbStandardErrorCallback optional Returns response from
LauncherClient#spawnExample
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)); } });