1 package org.andromda.cartridges.jsf2.metafacades;
2
3 import org.andromda.cartridges.jsf2.JSFGlobals;
4 import org.andromda.utils.StringUtilsHelper;
5
6
7
8
9
10
11 public class JSFEventLogicImpl
12 extends JSFEventLogic
13 {
14 private static final long serialVersionUID = 34L;
15
16
17
18
19 public JSFEventLogicImpl(Object metaObject, String context)
20 {
21 super(metaObject, context);
22 }
23
24
25
26
27
28 protected String handleGetMessageKey()
29 {
30 String triggerKey = StringUtilsHelper.toResourceMessageKey(getName());
31 if (!this.isNormalizeMessages())
32 {
33 final JSFAction action = (JSFAction)this.getAction();
34 if (action != null)
35 {
36 final JSFView view = (JSFView)action.getInput();
37 if (view != null)
38 {
39 triggerKey = view.getMessageKey() + '.' + triggerKey;
40 }
41 }
42 }
43 return triggerKey;
44 }
45
46
47
48
49
50 protected String handleGetMessageValue()
51 {
52 return StringUtilsHelper.toPhrase(this.getName());
53 }
54
55
56
57
58
59 protected String handleGetResetMessageValue()
60 {
61 return "Reset";
62 }
63
64
65
66
67
68 protected String handleGetResetMessageKey()
69 {
70 return this.getMessageKey() + ".reset.message";
71 }
72
73
74
75
76
77 private boolean isNormalizeMessages()
78 {
79 final String normalizeMessages = (String)getConfiguredProperty(JSFGlobals.NORMALIZE_MESSAGES);
80 return Boolean.valueOf(normalizeMessages).booleanValue();
81 }
82 }