Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/support/NonDomHandlerManager.java

Diff revisions: vs.
  @@ -14,20 +14,20 @@
14 14 private final List<H> handlers = new ArrayList<H>();
15 15 private final Object source;
16 16
17 - public NonDomHandlerManager(Object source) {
17 + public NonDomHandlerManager( Object source ) {
18 18 this.source = source;
19 19 }
20 20
21 21 @Override
22 - public void fireEvent(GwtEvent<?> event) {
23 - if (!(event instanceof NonDomEvent)) {
24 - throw new IllegalStateException("NonDomHandlerManager can currently only dispatch Events than implement NonDomEvent");
22 + public void fireEvent( GwtEvent<?> event ) {
23 + if ( !(event instanceof NonDomEvent) ) {
24 + throw new IllegalStateException( "NonDomHandlerManager can currently only dispatch Events than implement NonDomEvent" );
25 25 }
26 - NonDomEvent<H> ndEvent = ObjectUtils.cast(event);
27 - ndEvent.setSource(source);
28 - for (H handler : handlers) {
29 - if (handler != null) {
30 - ndEvent.dispatch(handler);
26 + NonDomEvent<H> ndEvent = ObjectUtils.cast( event );
27 + ndEvent.setSource( source );
28 + for ( H handler : handlers ) {
29 + if ( handler != null ) {
30 + ndEvent.dispatch( handler );
31 31 }
32 32 }
33 33 }
  @@ -36,28 +36,29 @@
36 36 * Adds a handler.
37 37 *
38 38 * @param handler the handler
39 + *
39 40 * @return the handler registration
40 41 */
41 - public HandlerRegistration addHandler(H handler) {
42 - if (handler == null) {
42 + public HandlerRegistration addHandler( H handler ) {
43 + if ( handler == null ) {
43 44 return null;
44 45 }
45 46 int index = handlers.size();
46 - handlers.add(handler);
47 - return new IndexHandlerRegistration(index);
47 + handlers.add( handler );
48 + return new IndexHandlerRegistration( index );
48 49 }
49 50
50 51 private class IndexHandlerRegistration implements HandlerRegistration {
51 52 private final int index;
52 53
53 - private IndexHandlerRegistration(int index) {
54 + private IndexHandlerRegistration( int index ) {
54 55 this.index = index;
55 56 }
56 57
57 58 @Override
58 59 public void removeHandler() {
59 - if (index < handlers.size()) {
60 - handlers.set(index, null);
60 + if ( index < handlers.size() ) {
61 + handlers.set( index, null );
61 62 }
62 63 }
63 64 }