@FunctionalInterface public static interface HTMLDialog.OnSubmit
HTMLDialog
annotation:
@The example returns a lambda function which gets automatically converted intoModel
(className = "AskCtrl", targetId = "", properties = { @Property
(name = "ok", type = boolean.class) }) public final class AskQuestion implementsActionListener
{ @HTMLDialog
(url = "dialog.html", className = "AskPages") staticHTMLDialog
.OnSubmit showHelloWorld(boolean checked) { AskCtrl model = new AskCtrl(checked).applyBindings(); return (buttonId) -> { // called when user presses a buttonSystem
.out.println("User selected: " + buttonId); // return false to prevent dialog from closing return true; }; } @Override
public void actionPerformed(ActionEvent
e) { // shows dialog with a question, checkbox is checked by default // AskPages is automatically generated class AskPages.showHelloWorld(true); } }
OnSubmit
instance.Modifier and Type | Method and Description |
---|---|
boolean |
onSubmit(String button)
Callback when a button is pressed.
|
boolean onSubmit(String button)
button
- the ID of the pressed button or null
on canceltrue
to close the dialog, false
to ignore
the button press and leave the dialog open