KickJava   Java API By Example, From Geeks To Geeks.

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


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.jboss.portal.server.plugins.mode.Mode;
12 import org.jboss.portal.server.plugins.windowstate.WindowState;
13
14 /**
15  * A URL for a window.
16  *
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
18  * @version $Revision: 1.4 $
19  */

20 public class WindowURL extends ServerURL
21 {
22
23    public static final int TYPE_ACTION = 0;
24    public static final int TYPE_RENDER = 1;
25    public static final int TYPE_NAVIGATION = 2;
26
27    private int type;
28    private Mode mode;
29    private WindowState windowState;
30
31    public WindowURL(ServerObjectID target)
32    {
33       super(target);
34       this.mode = null;
35       this.windowState = null;
36    }
37
38    public int getType()
39    {
40       return type;
41    }
42
43    public void setType(int type)
44    {
45       switch(type)
46       {
47          case TYPE_ACTION:
48             setControlParameter("type", "action");
49             break;
50          case TYPE_RENDER:
51             setControlParameter("type", "render");
52             break;
53          case TYPE_NAVIGATION:
54             setControlParameter("type", "nav");
55             break;
56          default:
57             throw new IllegalArgumentException JavaDoc("Bad type");
58       }
59       this.type = type;
60    }
61
62    /**
63     *
64     */

65    public void setMode(Mode mode)
66    {
67       this.mode = mode;
68       setControlParameter("mode", mode != null ? mode.toString() : null);
69    }
70
71    /**
72     *
73     */

74    public Mode getMode()
75    {
76       return mode;
77    }
78
79    /**
80     *
81     */

82    public void setWindowState(WindowState windowState)
83    {
84       this.windowState = null;
85       setControlParameter("windowstate", windowState != null ? windowState.toString() : null);
86    }
87
88    /**
89     *
90     */

91    public WindowState getWindowState()
92    {
93       return windowState;
94    }
95    
96    public boolean isIdempotent()
97    {
98       return type == TYPE_RENDER;
99    }
100 }
101
Popular Tags