AllWindowsClosed

Version 6 by Mircea Toma
on Sep 27, 2013 10:57.


compared with
Current by Philip Breau
on Oct 11, 2013 11:46.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

 h3. @org.icefaces.bean.AllWindowsClosed
  
  
 Use the @AllWindowsClosed method annotation with session-scoped beans that need to be notified when all browser windows for that session are closed. This is useful in cases where the application wants to actively cleanup a user-session upon window close.
  
 @AllWindowClosed annotation will work correctly as long the application is configured with org.icefaces.lazyWindowScope set to false or the application uses window scoped beans in its pages. By doing so the browser will notify the server every time a window is closed and eventually when all windows are closed, @AllWindowClosed annotated methods will be called.
  
 {code:title=MySessionScopedBean.java with @AllWindowsClosed}
 package org.icefaces.demo;
  
 import javax.faces.bean.ManagedBean;
 import javax.faces.bean.SessionScoped;
 import java.io.Serializable;
  
 import org.icefaces.bean.AllWindowsClosed;
  
 @ManagedBean(name = "mySessionScopedBean")
 @SessionScoped
 public class MySessionScopedBean implements Serializable {
 ...
  
 @AllWindowsClosed
 public void allWindowsForSessionClosed(){
  //clean up code goes here
 }
 {code}
   
 In case the annotated method needs access to the current FacesContext the method can define a single parameter of type FacesContext. When the method will be invoked the current FacesContext will be passed in.
 {code}
 @AllWindowsClosed
 public void allWindowsForSessionClosed(FacesContext context){
  //do something with the context
 }
 {code}

© Copyright 2021 ICEsoft Technologies Canada Corp.