Components API

ContextHelpIconClickHandler

It is a handler that is invoked when the user clicks on a special ? icon near the field. Click handler has priority over the context help text. That is, no tooltip with context help text will be shown if the handler is set.

In the following example, we will consider creating an input dialog that is called in the ContextHelpIconClickHandler. The dialog collects data to form an address string.

@Autowired
private TextField<String> addressField;

@Autowired
private Dialogs dialogs;

@Install(to = "addressField", subject = "contextHelpIconClickHandler")
private void addressFieldContextHelpIconClickHandler(
        HasContextHelp.ContextHelpIconClickEvent event) {
    dialogs.createInputDialog(this)
            .withCaption("Get values")
            .withParameters(
                    InputParameter.stringParameter("city")
                            .withCaption("City:")
                            .withRequired(true),
                    InputParameter.stringParameter("street")
                            .withCaption("Street:"),
                    InputParameter.stringParameter("building")
                            .withCaption("Building:"),
                    InputParameter.intParameter("zip")
                            .withCaption("Zip:")
            )
            .withActions(DialogActions.OK_CANCEL)
            .withCloseListener(closeEvent -> {
                if (closeEvent.closedWith(DialogOutcome.OK)) {
                    String city = closeEvent.getValue("city");
                    String street = closeEvent.getValue("street");
                    String building = closeEvent.getValue("building");
                    Integer zip = closeEvent.getValue("zip");
                    addressField.setValue(city + ", " + street + ", " +
                            building + ", " + zip);
                }
            })
            .show();
}
context help handler