1 23 package org.enhydra.barracuda.config; 24 25 import java.io.*; 26 import java.util.*; 27 import java.lang.ref.*; 28 import java.net.*; 29 import javax.servlet.*; 30 import javax.servlet.http.*; 31 32 import org.w3c.dom.*; 33 import org.w3c.dom.html.*; 34 35 import org.enhydra.barracuda.config.events.*; 36 import org.enhydra.barracuda.config.xmlc.*; 37 import org.enhydra.barracuda.core.comp.*; 38 import org.enhydra.barracuda.core.util.dom.*; 39 import org.enhydra.barracuda.core.event.*; 40 import org.enhydra.barracuda.core.event.helper.*; 41 import org.enhydra.barracuda.core.forms.*; 42 import org.enhydra.barracuda.core.view.*; 43 import org.enhydra.barracuda.core.util.http.*; 44 import org.enhydra.barracuda.plankton.data.*; 45 46 47 55 public class MasterScreenFactory { 56 57 public static final String KEY = MasterScreenFactory.class.getName()+".Key"; 58 59 public MasterScreen getInstance(EventGateway eg, ControlEventContext context, Locale locale) { 60 ReferenceFactory rf = new LocalReferenceFactory(getRootGateway(eg), locale); 62 MasterScreen screen = (MasterScreen) SessionServices.getObjectFromCache(context, KEY+locale, rf); 63 return screen; 64 } 65 66 protected EventGateway getRootGateway(EventGateway eg) { 67 EventGateway egParent = eg.getParent(); 68 if (egParent==null) return eg; 69 else return getRootGateway(egParent); 70 } 71 72 class LocalReferenceFactory implements ReferenceFactory { 73 EventGateway egRoot = null; 74 Locale locale = null; 75 76 public LocalReferenceFactory(EventGateway iegRoot, Locale ilocale) { 77 egRoot = iegRoot; 78 locale = ilocale; 79 } 80 81 public Reference getObjectReference() { 82 return new SoftReference(new MasterScreen(egRoot, locale)); 83 } 84 } 85 } 86 87 88 89 | Popular Tags |