1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.jetspeed.decoration; |
18 |
|
|
19 |
|
import javax.portlet.PortletMode; |
20 |
|
import javax.portlet.WindowState; |
21 |
|
|
22 |
|
public class DecoratorActionTemplate |
23 |
|
{ |
24 |
|
protected static final String ACTION_TYPE_MODE = "mode"; |
25 |
|
protected static final String ACTION_TYPE_STATE = "state"; |
26 |
|
protected static final String ACTION_TYPE_BOTH = "both"; |
27 |
|
|
28 |
|
private String action; |
29 |
|
private PortletMode mode; |
30 |
|
private PortletMode customMode; |
31 |
|
private WindowState state; |
32 |
|
private WindowState customState; |
33 |
|
|
34 |
|
private String actionType; |
35 |
|
|
36 |
|
public DecoratorActionTemplate(String action, PortletMode mode, PortletMode customMode, WindowState state, WindowState customState) |
37 |
0 |
{ |
38 |
0 |
this.action = action; |
39 |
0 |
this.mode = mode; |
40 |
0 |
this.customMode = customMode; |
41 |
0 |
this.state = state; |
42 |
0 |
this.customState = customState; |
43 |
0 |
if ( mode != null ) |
44 |
|
{ |
45 |
0 |
this.actionType = ( state != null ) ? ACTION_TYPE_BOTH : ACTION_TYPE_MODE; |
46 |
|
} |
47 |
0 |
else if ( state != null ) |
48 |
|
{ |
49 |
0 |
this.actionType = ACTION_TYPE_STATE; |
50 |
|
} |
51 |
0 |
} |
52 |
|
|
53 |
|
public DecoratorActionTemplate(String action, PortletMode mode, WindowState state) |
54 |
|
{ |
55 |
0 |
this(action,mode,mode,state,state); |
56 |
0 |
} |
57 |
|
|
58 |
|
public DecoratorActionTemplate(PortletMode mode, PortletMode customMode) |
59 |
|
{ |
60 |
0 |
this(mode.toString(), mode, customMode, null, class="keyword">null); |
61 |
0 |
} |
62 |
|
|
63 |
|
public DecoratorActionTemplate(PortletMode mode) |
64 |
|
{ |
65 |
0 |
this(mode,mode); |
66 |
0 |
} |
67 |
|
|
68 |
|
public DecoratorActionTemplate(WindowState state, WindowState customState) |
69 |
|
{ |
70 |
0 |
this(state.toString(), null, class="keyword">null, state, customState); |
71 |
0 |
} |
72 |
|
|
73 |
|
public DecoratorActionTemplate(WindowState state) |
74 |
|
{ |
75 |
0 |
this(state,state); |
76 |
0 |
} |
77 |
|
|
78 |
|
public String getAction() |
79 |
|
{ |
80 |
0 |
return action; |
81 |
|
} |
82 |
|
|
83 |
|
public String getActionType() |
84 |
|
{ |
85 |
0 |
return actionType; |
86 |
|
} |
87 |
|
|
88 |
|
public PortletMode getCustomMode() |
89 |
|
{ |
90 |
0 |
return customMode; |
91 |
|
} |
92 |
|
|
93 |
|
public WindowState getCustomState() |
94 |
|
{ |
95 |
0 |
return customState; |
96 |
|
} |
97 |
|
|
98 |
|
public PortletMode getMode() |
99 |
|
{ |
100 |
0 |
return mode; |
101 |
|
} |
102 |
|
|
103 |
|
public WindowState getState() |
104 |
|
{ |
105 |
0 |
return state; |
106 |
|
} |
107 |
|
|
108 |
|
public int hashCode() |
109 |
|
{ |
110 |
0 |
return action.hashCode(); |
111 |
|
} |
112 |
|
|
113 |
|
public boolean equals(Object o) |
114 |
|
{ |
115 |
0 |
if ( o != null && o instanceof DecoratorActionTemplate) |
116 |
|
{ |
117 |
0 |
return action.equals(((DecoratorActionTemplate)o).action); |
118 |
|
} |
119 |
0 |
return false; |
120 |
|
} |
121 |
|
|
122 |
|
public void setAction(String action) |
123 |
|
{ |
124 |
0 |
this.action = action; |
125 |
0 |
} |
126 |
|
|
127 |
|
public void setActionType( String actionType ) |
128 |
|
{ |
129 |
0 |
this.actionType = actionType; |
130 |
0 |
} |
131 |
|
|
132 |
|
public void setCustomMode(PortletMode customMode) |
133 |
|
{ |
134 |
0 |
this.customMode = customMode; |
135 |
0 |
} |
136 |
|
|
137 |
|
public void setCustomState(WindowState customState) |
138 |
|
{ |
139 |
0 |
this.customState = customState; |
140 |
0 |
} |
141 |
|
|
142 |
|
public void setMode(PortletMode mode) |
143 |
|
{ |
144 |
0 |
this.mode = mode; |
145 |
0 |
} |
146 |
|
|
147 |
|
public void setState(WindowState state) |
148 |
|
{ |
149 |
0 |
this.state = state; |
150 |
0 |
} |
151 |
|
} |