Normally a dialog is opened in response of a user action.
This is the sample case we are going to describe.
Register the action and its triggering strokes or tags.
... form.registerAction("newVersionLbl", new NewVersionLblAction()); ...
Define the class implementing the action.
... protected class NewVersionLblAction implements IFormAction { private static final long serialVersionUID = 1L; @Override public IFlowState execute(IBndsFlow flow, HttpServletRequest request, String formName, ActionInfo action, Map<String, UploadedFile> files) { String msg = "Creating a new version tag ..."; ... return null; } @Override public String getLabel() { return "New version tag"; } @Override public boolean isEnabled() { return ivDs.hasWritePermissions(); } } ...
In the execute(...) method:
final AskForVersionLblDlg dlg = new AskForVersionLblDlg(ivDs.getTagsOf(), msg);
FlowContext.get().modalDialog(
dlg.asDialog(null),
new IDialogCallback() { private static final long serialVersionUID = 1L; @Override public IFlowState endDialog(IFlow flow, IFlowAsDialog dialog, IFlowEndState res) { if (res != DialogResultEnum.OK) return null; ... // go on, you can even open a new modal-dialog return null; } } );
NOTE: The dialog call-back code can switch the state of the flow where the opening dialog action has been executed by returning the IFlowState to switch to instead of null.