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 java.io.Serializable; |
20 |
|
import java.util.Locale; |
21 |
|
import java.util.MissingResourceException; |
22 |
|
import java.util.ResourceBundle; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
public class DecoratorAction implements Serializable |
31 |
|
{ |
32 |
|
public static final String RESOURCE_BUNDLE = "org.apache.jetspeed.decoration.resources.DecoratorActions"; |
33 |
|
|
34 |
0 |
String actionName = null; |
35 |
0 |
String actionType = null; |
36 |
0 |
String name = null; |
37 |
0 |
String link = null; |
38 |
0 |
String alt = null; |
39 |
0 |
String action = null; |
40 |
|
String target; |
41 |
|
boolean custom; |
42 |
|
|
43 |
|
public static ResourceBundle getResourceBundle(Locale locale) |
44 |
|
{ |
45 |
0 |
return getBundle(RESOURCE_BUNDLE, locale); |
46 |
|
} |
47 |
|
|
48 |
|
private static ResourceBundle getBundle(String base, Locale locale) |
49 |
|
{ |
50 |
0 |
ResourceBundle bundle = null; |
51 |
|
try |
52 |
|
{ |
53 |
0 |
if ( locale != null ) |
54 |
|
{ |
55 |
0 |
bundle = ResourceBundle.getBundle(base, locale); |
56 |
|
} |
57 |
|
else |
58 |
|
{ |
59 |
0 |
bundle = ResourceBundle.getBundle(base); |
60 |
|
} |
61 |
|
} |
62 |
0 |
catch (MissingResourceException mre) |
63 |
|
{ |
64 |
0 |
} |
65 |
0 |
return bundle; |
66 |
|
} |
67 |
|
|
68 |
|
public static String getResourceString(ResourceBundle bundle, String key, String defaultValue) |
69 |
|
{ |
70 |
0 |
String value = defaultValue; |
71 |
|
|
72 |
0 |
if ( key != null && bundle != class="keyword">null ) |
73 |
|
try |
74 |
|
{ |
75 |
0 |
value = bundle.getString(key); |
76 |
|
} |
77 |
0 |
catch (MissingResourceException mre) |
78 |
|
{ |
79 |
0 |
} |
80 |
0 |
return value; |
81 |
|
} |
82 |
|
|
83 |
|
public DecoratorAction(String actionName, String name, String alt, Locale locale, String link, String action, boolean custom, String actionType) |
84 |
0 |
{ |
85 |
0 |
ResourceBundle bundle = getBundle(RESOURCE_BUNDLE, locale); |
86 |
0 |
this.actionName = actionName; |
87 |
0 |
this.actionType = actionType; |
88 |
0 |
this.name = getResourceString(bundle,name,name); |
89 |
0 |
this.alt = getResourceString(bundle,alt,alt); |
90 |
0 |
this.link = link; |
91 |
0 |
this.action = action; |
92 |
0 |
this.custom = custom; |
93 |
0 |
} |
94 |
|
|
95 |
|
public DecoratorAction(String actionName, String name, String alt, String link, String action, boolean custom, String actionType) |
96 |
0 |
{ |
97 |
0 |
this.actionName = actionName; |
98 |
0 |
this.actionType = actionType; |
99 |
0 |
this.name = name; |
100 |
0 |
this.alt = alt; |
101 |
0 |
this.link = link; |
102 |
0 |
this.action = action; |
103 |
0 |
this.custom = custom; |
104 |
0 |
} |
105 |
|
|
106 |
|
public DecoratorAction(String name, Locale locale, String link, String action, boolean custom, String actionType) |
107 |
|
{ |
108 |
0 |
this(name,name,name,locale,link,action,custom,actionType); |
109 |
0 |
} |
110 |
|
|
111 |
|
public DecoratorAction(String name, Locale locale, String link, String action, String actionType) |
112 |
|
{ |
113 |
0 |
this(name,name,name,locale,link,action,false,actionType); |
114 |
0 |
} |
115 |
|
|
116 |
|
public DecoratorAction(String actionName, String name, String alt, String link, String actionType) |
117 |
|
{ |
118 |
0 |
this(actionName, name,alt,null,link,class="keyword">null,false,actionType); |
119 |
0 |
} |
120 |
|
|
121 |
|
public String getActionName() |
122 |
|
{ |
123 |
0 |
return this.actionName; |
124 |
|
} |
125 |
|
public void setActionName( String actionName ) |
126 |
|
{ |
127 |
0 |
this.actionName = actionName; |
128 |
0 |
} |
129 |
|
|
130 |
|
public String getActionType() |
131 |
|
{ |
132 |
0 |
return this.actionType; |
133 |
|
} |
134 |
|
public void setActionType( String actionType ) |
135 |
|
{ |
136 |
0 |
this.actionType = actionType; |
137 |
0 |
} |
138 |
|
|
139 |
|
public String getName() |
140 |
|
{ |
141 |
0 |
return this.name; |
142 |
|
} |
143 |
|
|
144 |
|
public void setName(String name) |
145 |
|
{ |
146 |
0 |
this.name = name; |
147 |
0 |
} |
148 |
|
|
149 |
|
public String getLink() |
150 |
|
{ |
151 |
0 |
return this.link; |
152 |
|
} |
153 |
|
|
154 |
|
public void setLink(String link) |
155 |
|
{ |
156 |
0 |
this.link = link; |
157 |
0 |
} |
158 |
|
|
159 |
|
public String getAlt() |
160 |
|
{ |
161 |
0 |
return this.alt; |
162 |
|
} |
163 |
|
|
164 |
|
public void setAlt(String alt) |
165 |
|
{ |
166 |
0 |
this.alt = alt; |
167 |
0 |
} |
168 |
|
|
169 |
|
public String getAction() |
170 |
|
{ |
171 |
0 |
return this.action; |
172 |
|
} |
173 |
|
|
174 |
|
public void setAction(String action) |
175 |
|
{ |
176 |
0 |
this.action = action; |
177 |
0 |
} |
178 |
|
|
179 |
|
public String getTarget() |
180 |
|
{ |
181 |
0 |
return this.target; |
182 |
|
} |
183 |
|
|
184 |
|
public void setTarget(String target) |
185 |
|
{ |
186 |
0 |
this.target = target; |
187 |
0 |
} |
188 |
|
|
189 |
|
public boolean isCustom() |
190 |
|
{ |
191 |
0 |
return custom; |
192 |
|
} |
193 |
|
|
194 |
|
public void setCustom(boolean custom) |
195 |
|
{ |
196 |
0 |
this.custom = custom; |
197 |
0 |
} |
198 |
|
} |