Input dialog is often used to collect a single value and do something with it.
It would be cool if we had a way to let user confirm/submit the primary action of the dialog by hitting ENTER and to having to resort to grabbing a mouse and licking the OK button.
Example input dialog
dialogs.createInputDialog(this)
.withCaption("Qty")
.withParameters(
InputParameter
.intParameter("qty")
.withCaption("Qty caption")
.withDefaultValue(outstandingQty)
.withRequired(true)
)
.withActions(DialogActions.OK) // primary / only action
.withCloseListener(closeEvent -> {
if (closeEvent.closedWith(DialogOutcome.OK)) {
Integer qty = closeEvent.getValue("qty");
doSomethingWithInputValue(qty);
}
})
.show();
How to make it listen to enter and execute primary action?