KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > WindowContext


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server;
10
11 import org.apache.log4j.Logger;
12 import org.jboss.portal.server.output.cache.TimedContent;
13 import org.jboss.portal.server.plugins.mode.Mode;
14 import org.jboss.portal.server.plugins.windowstate.WindowState;
15 import org.jboss.portal.server.user.AbstractServerObjectContext;
16
17 /**
18  * The user state of a window.
19  *
20  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
21  * @version $Revision: 1.2 $
22  */

23 public class WindowContext extends AbstractServerObjectContext
24 {
25
26    /** The logger. */
27    private static final Logger log = Logger.getLogger(WindowContext.class);
28
29    /** The cached result of a previous invocation - we don't replicate. */
30    private transient TimedContent cachedResult = null;
31
32    /** The mode. */
33    private Mode mode;
34
35    /** The window state. */
36    private WindowState windowState;
37
38    public WindowContext(ServerObjectID id)
39    {
40       this(id, Mode.VIEW, WindowState.NORMAL);
41    }
42
43    public WindowContext(ServerObjectID id, Mode mode, WindowState windowState)
44    {
45       super(id);
46       this.mode = mode;
47       this.windowState = windowState;
48    }
49
50    /**
51     * Return the mode on this context.
52     */

53    public Mode getMode()
54    {
55       return mode;
56    }
57
58    /**
59     * Set the mode on this context.
60     */

61    public void setMode(Mode mode)
62    {
63       this.mode = mode;
64    }
65
66    /**
67     * Return the window state of this context.
68     */

69    public WindowState getWindowState()
70    {
71       return windowState;
72    }
73
74    /**
75     * Set the window state on this context.
76     */

77    public void setWindowState(WindowState windowState)
78    {
79       this.windowState = windowState;
80    }
81
82    /**
83     * Return cached content if any.
84     */

85    public TimedContent getCachedResult()
86    {
87       return cachedResult;
88    }
89
90    /**
91     * Cache content for future reuse.
92     */

93    public void setCachedResult(TimedContent cachedResult)
94    {
95       this.cachedResult = cachedResult;
96    }
97 }
98
Popular Tags