CWebDialogApi
This is a helper class. It is used to display and handle web dialogs.
It is located in the plugin NY_
Constructor
The constructor requires your target, as the messages are sent to the microservice with this target. This means that the microservice also receives your target address and can send messages to your target.
The second parameter is the client address, or more precisely the address of the WebSocketServer that has the connection to the browser. This allows the microservice to directly manipulate the DOM tree in the browser and receive events from the browser.
public CWebDialogApi(@NotNull final ITarget aTarget, @NotNull final CTargetAddress aRemote Skin ClientAddress);
showDialog
The method sends the CRecordShowWebDialog message via the microservice registry to the factory, which creates an instance of the dialog and displays it in the browser.
The caller receives the CRecordShowWebDialog message in response. If successful, the address of the instance of the dialog created is also provided.
public void showWebDialog(@NotNull final IId aMicroServiceId, final byte[] aSessionToken, @NotNull final String aParentWidgetId, final CStringProperties aParams) throws CException;
Parameter
- aMicroServiceId: The microservice ID under which the dialog was registered in the microservice registry.
- aSessionToken: Is returned at login. Every application started by this user receives the token.
- aParentWidgetId: The ID of an HTML element in which the dialog should store its HTML code. This is usually an empty DIV element.
- aParams: A map with key-value pairs that is specific to the dialog. Other parameters can also be specified here, which the caller receives back when the dialog is closed.
dismissWebDialog
The dialog created can be closed again by the program (and not just by the user).
public void dismissWebDialog(@NotNull final CTargetAddress aAddress) throws CException;
Parameter
- aAddress: The target address of the dialog is required. This is provided by the response of the CRecordShowWebDialog message.
showMessage
This method is called by the dialog. It indicates that the dialog has been closed.
public void notifyDismissed(@NotNull final CTargetAddress aParentAddress, @NotNull final IId aMicroServiceId, final int aReason, final CStringProperties aResults) throws CException
Parameter
- aParentAddress: The address of the dialog owner.
- aMicroServiceId: The ID with which the microservice was registered at the microservice registry. This allows the recipient, who may have several dialogs open, to distinguish between the dialogs.
- aReason: The reason that led to the dialog being closed.
- aResults: The parameter map that the dialog received when it was opened, enriched with dialog-specific result values.
These messages belong to the web dialog API:
Record | Description |
---|---|
CRecordShowWebDialog | Create a web dialog. |
CRecordWebDismissDialog | Close a web dialog programmatically. |
CRecordWebNotifyDialogDismissed | A notification indicating that a web dialog has been closed. |