1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.component.behavior;
20
21 import java.util.Collection;
22
23 import javax.faces.component.UIComponent;
24 import javax.faces.context.FacesContext;
25
26
27
28
29
30
31
32 public abstract class ClientBehaviorContext
33 {
34
35 public static ClientBehaviorContext createClientBehaviorContext(FacesContext context,
36 UIComponent component,
37 String eventName,
38 String sourceId,
39 Collection<Parameter> parameters)
40 {
41
42 if(context == null)
43 {
44 throw new NullPointerException("context argument must not be null");
45 }
46 if(component == null)
47 {
48 throw new NullPointerException("component argument must not be null");
49 }
50 if(eventName == null)
51 {
52 throw new NullPointerException("eventName argument must not be null");
53 }
54
55 return new ClientBehaviorContextImpl(context,component,eventName,sourceId, parameters);
56 }
57
58 public abstract UIComponent getComponent();
59
60 public abstract String getEventName();
61
62 public abstract FacesContext getFacesContext();
63
64 public abstract Collection<Parameter> getParameters();
65
66 public abstract String getSourceId();
67
68
69
70
71
72
73
74 public static class Parameter
75 {
76 private String _name;
77 private Object _value;
78
79 public Parameter(String name, Object value)
80 {
81 if (name == null)
82 {
83 throw new NullPointerException("name");
84 }
85
86 _name = name;
87 _value = value;
88 }
89
90 public String getName()
91 {
92 return _name;
93 }
94
95 public Object getValue()
96 {
97 return _value;
98 }
99 }
100
101 private static final class ClientBehaviorContextImpl extends ClientBehaviorContext
102 {
103 private FacesContext _facesContext;
104 private UIComponent _component;
105 private String _eventName;
106 private String _sourceId;
107 private Collection<ClientBehaviorContext.Parameter> _parameters;
108
109 public ClientBehaviorContextImpl(FacesContext context, UIComponent component, String eventName,
110 String sourceId, Collection<ClientBehaviorContext.Parameter> parameters)
111 {
112 _facesContext = context;
113 _component = component;
114 _eventName = eventName;
115 _sourceId = sourceId;
116 _parameters = parameters;
117 }
118
119 @Override
120 public UIComponent getComponent()
121 {
122 return _component;
123 }
124
125 @Override
126 public String getEventName()
127 {
128 return _eventName;
129 }
130
131 @Override
132 public FacesContext getFacesContext()
133 {
134 return _facesContext;
135 }
136
137 @Override
138 public Collection<Parameter> getParameters()
139 {
140 return _parameters;
141 }
142
143 @Override
144 public String getSourceId()
145 {
146 return _sourceId;
147 }
148 }
149 }