1 /* 
  2  * Lancaster University 
  3  * Computing Department 
  4  *  
  5  * Created by Eduardo Figueiredo 
  6  * Date: 22 Jun 2007 
  7  *  
  8  */ 
  9 package ubc.midp.mobilephoto.core.ui.controller; 
 10  
 11  
 12  
 13 /** 
 14  * @author Eduardo Figueiredo 
 15  * [EF] Purpose have unique data (by now currentScreenName, currentStoreName) 
 16  * in order to make them consistent for all controllers. 
 17  */ 
 18 public class ScreenSingleton { 
 19    
 20   private static ScreenSingleton instance; 
 21  
 22   //Keep track of the navigation so we can go 'back' easily 
 23   private String currentScreenName; 
 24    
 25   //Keep track of the current photo album being viewed 
 26   //Ie. name of the currently active J2ME record store 
 27   private String currentStoreName = "My Photo Album"; 
 28    
 29    
 30   private ScreenSingleton() { 
 31   } 
 32  
 33   /** 
 34    * @return the instance 
 35    */ 
 36   public static ScreenSingleton getInstance() { 
 37     if (instance == null) instance = new ScreenSingleton(); 
 38     return instance; 
 39   } 
 40  
 41   /** 
 42    * @param currentScreenName the currentScreenName to set 
 43    */ 
 44   public void setCurrentScreenName(String currentScreenName) { 
 45     this.currentScreenName = currentScreenName; 
 46   } 
 47  
 48   /** 
 49    * @return the currentScreenName 
 50    */ 
 51   public String getCurrentScreenName() { 
 52     return currentScreenName; 
 53   } 
 54  
 55   /** 
 56    * @param currentStoreName the currentStoreName to set 
 57    */ 
 58   public void setCurrentStoreName(String currentStoreName) { 
 59     this.currentStoreName = currentStoreName; 
 60   } 
 61  
 62   /** 
 63    * @return the currentStoreName 
 64    */ 
 65   public String getCurrentStoreName() { 
 66     return currentStoreName; 
 67   } 
 68 }    
    |