Search code examples
javagwtgwt-ext

Window close issues in gwt -ext


Hello all I am using gwt-ext in my application.In that application session time is 5 minutes. My issues is that If any window is open to render some information & in between session goes out then user logged out but the opened window is not closing in that case.

So just want to know that how close opened window while session is timed out and user is logged out.

Thanks in advance.


Solution

  • You can follow these steps to close tour any open window at sesssion time out:

    1. Whenever you make an Object of Window: assign an Id to that Window.

      window.setId("myWindow");
      
    2. The place at which you're handling session time out, place this code:

      ExtElement extElement = Ext.get("myWindow");
      if (extElement != null && Ext.getCmp(extElement) != null
          && Ext.getCmp(extElement) instanceof Window) {
          Window window = (Window) Ext.getCmp(extElement);
          window.close();
      }