Search code examples
javamavengwtgxt

What is the Gxt 3.1.1 way to implement Dialog.getHideButton() as was supported in Gxt 3.0.0?


I have the following piece of code for a project originally built on gxt 3.0.0 framework.

msgBoxInterim.addHideHandler(new HideHandler() {
                    public void onHide(HideEvent event) {
                        if(event != null && event.getSource() != null) {
                            Dialog btn = (Dialog) event.getSource();                            




                                if (btn != null && btn.getHideButton() != null && btn.getHideButton().getItemId() != null &&
                                        btn.getHideButton().getItemId().equalsIgnoreCase("OK")) {

                                callService();
                                timer.cancel();
                                logoffTimer.cancel();
                                interimTimer.cancel();

This code's intention to use a dialog's getHideButton is not supported in Gxt 3.1.1 and its throwing cant find getHideButton() error. What is the way to implement the same functionality in gxt 3.1.1 ? Please support by code snippets. Thanks


Solution

  • This should work:

    Dialog dialog = new Dialog();
    dialog.addDialogHideHandler(new DialogHideHandler() {
      @Override
      public void onDialogHide(DialogHideEvent event) {
        if (event.getHideButton().equals(PredefinedButton.OK)) {
          // user clicks ok
        } else if (event.getHideButton().equals(PredefinedButton.CANCEL)) {
          // user clicks cancel
        }
      }
    });