< prev index next >

src/java.desktop/share/classes/java/beans/ThreadGroupContext.java

Print this page

 37  * context referenced by the specific {@link ThreadGroup}.
 38  * This is a replacement for the {@link sun.awt.AppContext}.
 39  *
 40  * @author  Sergey Malenkov
 41  */
 42 final class ThreadGroupContext {
 43 
 44     private static final WeakIdentityMap<ThreadGroupContext> contexts = new WeakIdentityMap<ThreadGroupContext>() {
 45         protected ThreadGroupContext create(Object key) {
 46             return new ThreadGroupContext();
 47         }
 48     };
 49 
 50     /**
 51      * Returns the appropriate {@code ThreadGroupContext} for the caller,
 52      * as determined by its {@code ThreadGroup}.
 53      *
 54      * @return  the application-dependent context
 55      */
 56     static ThreadGroupContext getContext() {
 57         return contexts.get(Thread.currentThread().getThreadGroup());


 58     }
 59 
 60     private volatile boolean isDesignTime;
 61     private volatile Boolean isGuiAvailable;
 62 
 63     private Map<Class<?>, BeanInfo> beanInfoCache;
 64     private BeanInfoFinder beanInfoFinder;
 65     private PropertyEditorFinder propertyEditorFinder;
 66 
 67     private ThreadGroupContext() {
 68     }
 69 
 70     boolean isDesignTime() {
 71         return this.isDesignTime;
 72     }
 73 
 74     void setDesignTime(boolean isDesignTime) {
 75         this.isDesignTime = isDesignTime;
 76     }
 77 

 37  * context referenced by the specific {@link ThreadGroup}.
 38  * This is a replacement for the {@link sun.awt.AppContext}.
 39  *
 40  * @author  Sergey Malenkov
 41  */
 42 final class ThreadGroupContext {
 43 
 44     private static final WeakIdentityMap<ThreadGroupContext> contexts = new WeakIdentityMap<ThreadGroupContext>() {
 45         protected ThreadGroupContext create(Object key) {
 46             return new ThreadGroupContext();
 47         }
 48     };
 49 
 50     /**
 51      * Returns the appropriate {@code ThreadGroupContext} for the caller,
 52      * as determined by its {@code ThreadGroup}.
 53      *
 54      * @return  the application-dependent context
 55      */
 56     static ThreadGroupContext getContext() {
 57         @SuppressWarnings("deprecation")
 58         ThreadGroup group = Thread.currentThread().getThreadGroup();
 59         return contexts.get(group);
 60     }
 61 
 62     private volatile boolean isDesignTime;
 63     private volatile Boolean isGuiAvailable;
 64 
 65     private Map<Class<?>, BeanInfo> beanInfoCache;
 66     private BeanInfoFinder beanInfoFinder;
 67     private PropertyEditorFinder propertyEditorFinder;
 68 
 69     private ThreadGroupContext() {
 70     }
 71 
 72     boolean isDesignTime() {
 73         return this.isDesignTime;
 74     }
 75 
 76     void setDesignTime(boolean isDesignTime) {
 77         this.isDesignTime = isDesignTime;
 78     }
 79 
< prev index next >