Caplin Trader 4.8.0

Interface: module:caplin/services/UserPromptService

module:caplin/services/UserPromptService

By implementing the UserPromptService interface, clients can implement their own strategy for how they deal with messages that need to be displayed to the user. The standard implementation of UserPromptService (StandardUserPromptService), merely displays the alerts within a simple DHTML dialog box.

Implementations:

Methods

alert(message, options)

Displays an alert dialog box to the user.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed.

The fCallBack function will always be passed true as its first parameter. The previous api (message,callback,caption) should still be supported by UserPromptServices.
Parameters:
Name Type Description
message String The alert message template to be displayed to the user.
options Map Parameters that affect the alert and can be referenced by the message.
Properties
Name Type Attributes Description
callback function <optional>
A call back function that will be executed once the user has closed the dialog.
caption String <optional>
The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.
code String <optional>
The code used to identify the type of alert. This will be used to translate/customise the message.
ok String <optional>
The text on the ok button.
detail String <optional>
Further details about the issue.
Implementations:
  • module:caplin/dom/alert/StandardAlertDispatcher#alert
  • module:caplin/services/providers/BrowserUserPromptService#alert
  • module:caplin/services/testing/UserPromptServiceStub#alert

confirm(message, options)

Displays a confirmation dialog box to the user.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed. The fCallBack function will be passed true as its first parameter if the user clicks the 'Ok' button, and false otherwise.

The previous api (message,callback,ok,cancel,caption) should still be supported by UserPromptServices.
Parameters:
Name Type Description
message String The alert message template to be displayed to the user.
options Map Parameters that affect the alert and can be referenced by the message.
Properties
Name Type Attributes Description
callback function <optional>
A call back function that will be executed once the user has closed the dialog.
caption String <optional>
The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.
code String <optional>
The code used to identify the type of alert. This will be used to translate/customise the message.
ok String <optional>
The text on the ok button.
cancel String <optional>
The text on the cancel button.
detail String <optional>
Further details about the issue.
Implementations:
  • module:caplin/dom/alert/StandardAlertDispatcher#confirm
  • module:caplin/services/providers/BrowserUserPromptService#confirm
  • module:caplin/services/testing/UserPromptServiceStub#confirm

isAlertShowing() → {boolean}

Used to query if an alert or confirm alert dialog is currently displayed.

Does not cover confirm dialogs only alerts.

Implementations:
  • module:caplin/dom/alert/StandardAlertDispatcher#isAlertShowing
  • module:caplin/services/providers/BrowserUserPromptService#isAlertShowing
  • module:caplin/services/testing/UserPromptServiceStub#isAlertShowing
Returns:
true if an alert/confirm alert is currently displayed, otherwise false.
Type
boolean

optionalAlert(message, options)

Displays an alert dialog box to the user, with an option to never see the alert again.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed.

The fCallBack function will always be passed true as its first parameter. The previous api (message,code,callback,caption) should still be supported by UserPromptServices.
Parameters:
Name Type Description
message String The alert message template to be displayed to the user.
options Map Parameters that affect the alert and can be referenced by the message.
Properties
Name Type Attributes Description
callback function <optional>
A call back function that will be executed once the user has closed the dialog.
caption String <optional>
The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.
code String <optional>
The code used to identify the type of alert. This will be used to translate/customise the message.
ok String <optional>
The text on the ok button.
detail String <optional>
Further details about the issue.
Implementations:
  • module:caplin/dom/alert/StandardAlertDispatcher#optionalAlert
  • module:caplin/services/providers/BrowserUserPromptService#optionalAlert
  • module:caplin/services/testing/UserPromptServiceStub#optionalAlert

optionalConfirm(message, options)

Displays a confirmation dialog box to the user, with an option to never see the confirmation again.

Since this is a non-blocking method, the fCallBack parameter should be used to provide any code that must be executed once the dialog has been closed. The fCallBack function will be passed true as its first parameter if the user clicks the 'Ok' button, and false otherwise.

The previous api (message,code,callback,ok,cancel,caption) should still be supported by UserPromptServices.
Parameters:
Name Type Description
message String The alert message template to be displayed to the user.
options Map Parameters that affect the alert and can be referenced by the message.
Properties
Name Type Attributes Description
callback function <optional>
A call back function that will be executed once the user has closed the dialog.
caption String <optional>
The text displayed as a dialog caption. Default is 'Alert' or equivalent as per alert dispatcher.
code String <optional>
The code used to identify the type of alert. This will be used to translate/customise the message.
ok String <optional>
The text on the ok button.
cancel String <optional>
The text on the cancel button.
detail String <optional>
Further details about the issue.
Implementations:
  • module:caplin/dom/alert/StandardAlertDispatcher#optionalConfirm
  • module:caplin/services/providers/BrowserUserPromptService#optionalConfirm
  • module:caplin/services/testing/UserPromptServiceStub#optionalConfirm