When developing desktop based or similar applications, it becomes headache to synchronize data between different pages. Say when Delete is clicked in context menu of some node of tree, Grid and some other panels need to be notified. Here is one simple way for accessing data of other panels. We have singleton session object (only one object at runtime) at each client’s runtime. So when we have some data that need to be used in other pages, we can put those objects in the session map and access it from the other class. Here is how we can create class that gives singleton instance of session map.
import java.util.HashMap; public class SessionFactory { private static HashMap session; private SessionFactory(){ } public static HashMap getSessionInstance(){ if(session==null){ session = new HashMap(); } return session; } }