Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/com/google/gwt/gen2/event/shared/AbstractEvent.java

Diff revisions: vs.
  @@ -23,8 +23,7 @@
23 23 * @deprecated use the com.google.gwt.event.shared classes instead
24 24 */
25 25 @Deprecated
26 - public abstract class AbstractEvent
27 - {
26 + public abstract class AbstractEvent {
28 27 /**
29 28 * Type class used to register events with the {@link HandlerManager}.
30 29 * <p>
  @@ -36,23 +35,20 @@
36 35 * @param <EventType> event type
37 36 * @param <HandlerType> handler type
38 37 */
39 - public abstract static class Type<EventType extends AbstractEvent, HandlerType extends EventHandler>
40 - {
38 + public abstract static class Type<EventType extends AbstractEvent, HandlerType extends EventHandler> {
41 39
42 40 private int index;
43 41
44 42 /**
45 43 * Constructor.
46 44 */
47 - public Type()
48 - {
45 + public Type() {
49 46 index = HandlerManager.createKeyIndex();
50 47 }
51 48
52 49 // We override hash code to make it as efficient as possible.
53 50 @Override
54 - public final int hashCode()
55 - {
51 + public final int hashCode() {
56 52 return index;
57 53 }
58 54
  @@ -72,8 +68,7 @@
72 68 /**
73 69 * Constructor.
74 70 */
75 - protected AbstractEvent()
76 - {
71 + protected AbstractEvent() {
77 72 }
78 73
79 74 /**
  @@ -81,8 +76,7 @@
81 76 *
82 77 * @return object representing the source of this event
83 78 */
84 - public Object getSource()
85 - {
79 + public Object getSource() {
86 80 assertLive();
87 81 return source;
88 82 }
  @@ -95,8 +89,7 @@
95 89 *
96 90 * @return a string representing the event's specifics.
97 91 */
98 - public String toDebugString()
99 - {
92 + public String toDebugString() {
100 93 String name = this.getClass().getName();
101 94 name = name.substring( name.lastIndexOf( "." ) );
102 95 return name + ": source = " + source;
  @@ -109,8 +102,7 @@
109 102 * event.
110 103 */
111 104 @Override
112 - public String toString()
113 - {
105 + public String toString() {
114 106 return "An event type";
115 107 }
116 108
  @@ -119,8 +111,7 @@
119 111 * to be "dead" after their original handler manager finishes firing them. An
120 112 * event can be revived by calling {@link AbstractEvent#revive()}.
121 113 */
122 - protected void assertLive()
123 - {
114 + protected void assertLive() {
124 115 assert (!dead) : "This event has already finished being processed by its original handler manager, so you can no longer access it";
125 116 }
126 117
  @@ -136,24 +127,21 @@
136 127 *
137 128 * @return whether the event is live
138 129 */
139 - protected boolean isLive()
140 - {
130 + protected boolean isLive() {
141 131 return !dead;
142 132 }
143 133
144 134 /**
145 135 * Revives the event. Used when recycling event instances.
146 136 */
147 - protected void revive()
148 - {
137 + protected void revive() {
149 138 dead = false;
150 139 }
151 140
152 141 /**
153 142 * Kills the event. Used when recycling event instances.
154 143 */
155 - final void kill()
156 - {
144 + final void kill() {
157 145 dead = true;
158 146 source = null;
159 147 }
  @@ -164,8 +152,7 @@
164 152 * @param source the source of this event, should only be set by a
165 153 * {@link HandlerManager}
166 154 */
167 - void setSource( Object source )
168 - {
155 + void setSource( Object source ) {
169 156 this.source = source;
170 157 }
171 158 }