Mendix Client 3.0 API documentation


mx.ui

The mxui.wm.UserInterface subsystem provides an API to control the UserInterface.

Properties

-

Methods

startup(callback)

This method is called to startup the subsystem.

Parameters

Name Type Description
callback Function The function to be called when startup is finished.

Returns

-

shutdown()

This method is called to shutdown the subsystem.

Parameters

-

Returns

-

isLoaded()

This method is called to check whether the subsystem has been started.

Parameters

-

Returns

Type Description
Boolean true if the subsystem has been started.

isRtl()

This method is called to check whether the client is in RTL (right to left) or LTR (left to right) mode.

Parameters

-

Returns

Type Description
Boolean true if the client is in RTL mode.

newContext(widget)

This method is called to create a new context, bound to a widget.

Parameters

Name Type Description
widget mxui.widget._Widget Optional widget to bind the context to.

Returns

Type Description
mendix.lib.MxContext A newly created MxContext.

getContext(id, widget)

This method is called to get an existing context, or create a new context, bound to a widget.

Parameters

Name Type Description
id Number Id of the context to get.
widget mxui.widget._Widget Optional widget to bind the context to.

Returns

Type Description
mendix.lib.MxContext The MxContext.

destroyContext(context)

This method is called to remove a context.

Parameters

Name Type Description
context mendix.lib.MxContext Context to destroy.

Returns

-

cleanContext(id, widget)

This method is called to remove the given widget from the context its listeners. If there are no listeners left, the context will be removed.

Parameters

Name Type Description
id Number Id of the context to get.
widget mxui.widget._Widget Widget to remove from given context.

Returns

-

cleanWidgetContext(widget)

This method is called to remove the widget from all contexts. If there are no listeners left for a context, it will be removed.

Parameters

Name Type Description
widget mxui.widget._Widget Widget to remove from all contexts.

Returns

-

downloadFile(args)

This method is called to download a file or FileDocument.

Parameters

Only one of the mxobject / url parameters should be set.

Name Type Description
args.mxobject MxObject The FileDocument to download.
args.url String The url of the file to download.
args.target String What to do with the download. “internal” shows a download dialog, while “window” opens the file in another window in the browser.
args.error Function A function to handle errors (like “file not foud”).

Returns

-

info(message, args)

This method is called to show an info message to the user.

Parameters

Name Type Description
message String The message to show to the user.
args.modal Boolean Whether the message should be shown blocking, or as a toaster.

Returns

-

warn(message, args)

This method is called to show a warn message to the user.

Parameters

Name Type Description
message String The message to show to the user.
args.modal Boolean Whether the message should be shown blocking, or as a toaster.

Returns

-

error(message, args)

This method is called to show an error message to the user.

Parameters

Name Type Description
message String The message to show to the user.
args.modal Boolean Whether the message should be shown blocking, or as a toaster.

Returns

-

exception(message)

This method is called to show a blocking exception message to the user.

Parameters

Name Type Description
message String The message to show to the user.

Returns

-

validations(validations)

This method is called to show validation feedback from the Runtime to the user in a blocking popup.

Parameters

Name Type Description
validations Array mendix.lib.ov validation messages.

Returns

-

executeAction(args)

This method is called to execute an action on a registered target.

Parameters

Name Type Description
args.target String “Screen” or “XASAction”.

For target “Screen”:

Name Type Description
args.params.title String The title for the form to open.
args.params.uilocation String Where to open the form: “content”, “popup” of “modal”.
args.params.targeturl String The url of the form to open.
args.params.width Number The width of the popup (for uilocation “popup” or “modal”).
args.params.height Number The height of the popup (for uilocation “popup” or “modal”).
args.params.resizable Boolean Whether the popup may be resized by the user.
args.params.targetparams Object Params for the widgets in the form to open.

For target “XASAction”:

Name Type Description
args.params.actionname String The name of the microflow to execute.
args.params.actionparams Object Params for the action.
args.params.async Boolean Whether the action to be executed asynchronous.
args.params.progress String Location of the progress bar: “none”, “modal” or “popup”.
args.params.progressmsg String Message to show beneath the progress bar.
args.params.caller mxui.widget._Widget Caller to handle instructions from Runtime.
args.params.mxcontext mendix.lib.MxContext Context to send along with the action call.
args.params.error Function Function to handle errors.
args.params.callback Function Function to handle the response.

Returns

-

registerTarget(name, target)

This method is called to register a target on which actions can be executed via executeAction.

Parameters

Name Type Description
name String Name of the target, which should be passed to executeAction.
target Function Function to execute actions to this target.

Returns

-

getTargetScope(name)

This method is called to get a executeAction target by name.

Parameters

Name Type Description
name String Name of the target.

Returns

Type Description
Function The function associated with given target name.

getLocale()

This method is called to get the current locale.

Parameters

-

Returns

Type Description
String The current locale (eg. en_US).

getProgressIndicator(type, message)

This method is called to create a progress indicator.

Parameters

Name Type Description
type String Type of progress bar (“popup” or “modal”).
message String Message to show in the progress bar.

Returns

Type Description
Object The progress indicator, which implements a “start”, “stop”, and “error” method.

hasTranslation(key)

This method is called to chech whether translations are available for given key.

Parameters

Name Type Description
key String The key to find in the translation map. Normally this would be the declaredClass.

Returns

Type Description
Boolean Whether translations are available for given key.

translate(key, text)

This method is called to translate a system text into the current locale.

Parameters

Name Type Description
key String The key to find in the translation map. Normally this would be the declaredClass.
text String The name of the system text to translate.

Returns

Type Description
String The translation of the given system text in the current locale.