1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.trinidad.event;
20
21 import javax.faces.component.UIComponent;
22
23 import javax.faces.event.FacesEvent;
24 import javax.faces.event.FacesListener;
25
26
27
28
29
30
31
32
33 public class FocusEvent extends FacesEvent
34 {
35
36
37
38
39
40
41 public FocusEvent(UIComponent source, Object oldKey, Object newKey)
42 {
43 super(source);
44 _oldKey = oldKey;
45 _newKey = newKey;
46 }
47
48
49
50
51
52
53 public FocusEvent(UIComponent source)
54 {
55 this(source, null, null);
56 }
57
58 public Object getOldKey()
59 {
60 return _oldKey;
61 }
62
63 public Object getNewKey()
64 {
65 return _newKey;
66 }
67
68 @Override
69 public void processListener(FacesListener listener)
70 {
71 ((FocusListener) listener).processFocus(this);
72 }
73
74 @Override
75 public boolean isAppropriateListener(FacesListener listener)
76 {
77 return (listener instanceof FocusListener);
78 }
79
80 @Override
81 public int hashCode()
82 {
83 return (getComponent() == null) ? 0 : getComponent().hashCode();
84 }
85
86 @Override
87 public boolean equals(Object o)
88 {
89 if (o instanceof FocusEvent)
90 {
91 FocusEvent that = (FocusEvent)o;
92 return (this.getComponent().equals(that.getComponent()));
93 }
94
95 return false;
96 }
97
98 @Override
99 public String toString()
100 {
101 StringBuffer sb = new StringBuffer();
102 sb.append(getClass().getName());
103 sb.append("[component=");
104 sb.append(getComponent());
105 sb.append(",oldKey=");
106 sb.append(getOldKey());
107 sb.append(",newKey=");
108 sb.append(getNewKey());
109 sb.append(']');
110 return sb.toString();
111 }
112
113 private final Object _oldKey;
114 private final Object _newKey;
115 private static final long serialVersionUID = 1L;
116 }