Revision: 10370
Author: rj...@google.com
Date: Fri Jun 17 11:00:00 2011
Log: Integrate r10342 into GWT 2.4 branch.
http://code.google.com/p/google-web-toolkit/source/detail?r=10370
Modified:
/releases/2.4/user/src/com/google/gwt/activity/shared/ActivityManager.java
/releases/2.4/user/src/com/google/gwt/event/shared/LegacyHandlerWrapper.java
/releases/2.4/user/src/com/google/gwt/event/shared/ResettableEventBus.java
/releases/2.4/user/src/com/google/gwt/place/shared/PlaceController.java
/releases/2.4/user/src/com/google/gwt/place/shared/PlaceHistoryHandler.java
/releases/2.4/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
=======================================
---
/releases/2.4/user/src/com/google/gwt/activity/shared/ActivityManager.java
Fri Jun 3 09:52:12 2011
+++
/releases/2.4/user/src/com/google/gwt/activity/shared/ActivityManager.java
Fri Jun 17 11:00:00 2011
@@ -15,14 +15,14 @@
*/
package com.google.gwt.activity.shared;
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.ResettableEventBus;
import com.google.gwt.event.shared.UmbrellaException;
import com.google.gwt.place.shared.PlaceChangeEvent;
import com.google.gwt.place.shared.PlaceChangeRequestEvent;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
+import com.google.web.bindery.event.shared.EventBus;
+import com.google.web.bindery.event.shared.HandlerRegistration;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -32,8 +32,7 @@
* {@link PlaceChangeEvent} events. Each activity can start itself
* asynchronously, and provides a widget to be shown when it's ready to
run.
*/
-public class ActivityManager implements PlaceChangeEvent.Handler,
- PlaceChangeRequestEvent.Handler {
+public class ActivityManager implements PlaceChangeEvent.Handler,
PlaceChangeRequestEvent.Handler {
/**
* Wraps our real display to prevent an Activity from taking it over if
it is
@@ -55,13 +54,18 @@
}
private static final Activity NULL_ACTIVITY = new AbstractActivity() {
- public void start(AcceptsOneWidget panel, EventBus eventBus) {
+ public void start(AcceptsOneWidget panel,
com.google.gwt.event.shared.EventBus eventBus) {
}
};
private final ActivityMapper mapper;
private final EventBus eventBus;
+
+ /*
+ * Note that we use the legacy class from com.google.gwt.event.shared,
because
+ * we can't change the Activity interface.
+ */
private final ResettableEventBus stopperedEventBus;
private Activity currentActivity = NULL_ACTIVITY;
@@ -136,7 +140,7 @@
startingNext = true;
caughtOnStart = tryStart();
}
-
+
if (caughtOnStart != null || caughtOnCancel != null || caughtOnStop !=
null) {
Set<Throwable> causes = new LinkedHashSet<Throwable>();
if (caughtOnStop != null) {
@@ -202,12 +206,12 @@
private Throwable tryStart() {
Throwable caughtOnStart = null;
try {
- /* Wrap the actual display with a per-call instance
- * that protects the display from canceled or stopped activities,
and which
- * maintains our startingNext state.
+ /*
+ * Wrap the actual display with a per-call instance that protects the
+ * display from canceled or stopped activities, and which maintains
our
+ * startingNext state.
*/
- currentActivity.start(new ProtectedDisplay(currentActivity),
- stopperedEventBus);
+ currentActivity.start(new ProtectedDisplay(currentActivity),
stopperedEventBus);
} catch (Throwable t) {
caughtOnStart = t;
}
@@ -236,10 +240,9 @@
private void updateHandlers(boolean activate) {
if (activate) {
- final HandlerRegistration placeReg = eventBus.addHandler(
- PlaceChangeEvent.TYPE, this);
- final HandlerRegistration placeRequestReg = eventBus.addHandler(
- PlaceChangeRequestEvent.TYPE, this);
+ final HandlerRegistration placeReg =
eventBus.addHandler(PlaceChangeEvent.TYPE, this);
+ final HandlerRegistration placeRequestReg =
+ eventBus.addHandler(PlaceChangeRequestEvent.TYPE, this);
this.handlerRegistration = new HandlerRegistration() {
public void removeHandler() {
=======================================
---
/releases/2.4/user/src/com/google/gwt/event/shared/LegacyHandlerWrapper.java
Mon Apr 18 16:25:25 2011
+++
/releases/2.4/user/src/com/google/gwt/event/shared/LegacyHandlerWrapper.java
Fri Jun 17 11:00:00 2011
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not
* use this file except in compliance with the License. You may obtain a
copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,10 +15,14 @@
*/
package com.google.gwt.event.shared;
-class LegacyHandlerWrapper implements HandlerRegistration {
+/**
+ * Wrapper class to ease the transition to
+ * {@link com.google.web.bindery.event.shared.HandlerRegistration}.
+ */
+public class LegacyHandlerWrapper implements HandlerRegistration {
private final com.google.web.bindery.event.shared.HandlerRegistration
real;
-
-
LegacyHandlerWrapper(com.google.web.bindery.event.shared.HandlerRegistration
real) {
+
+ public
LegacyHandlerWrapper(com.google.web.bindery.event.shared.HandlerRegistration
real) {
this.real = real;
}
=======================================
---
/releases/2.4/user/src/com/google/gwt/event/shared/ResettableEventBus.java
Thu May 12 14:09:51 2011
+++
/releases/2.4/user/src/com/google/gwt/event/shared/ResettableEventBus.java
Fri Jun 17 11:00:00 2011
@@ -25,10 +25,7 @@
*/
public class ResettableEventBus extends EventBus {
private static class TestableResettableEventBus extends
com.google.web.bindery.event.shared.ResettableEventBus {
- /**
- * @param wrappedBus
- */
- public TestableResettableEventBus(EventBus wrappedBus) {
+ private
TestableResettableEventBus(com.google.web.bindery.event.shared.EventBus
wrappedBus) {
super(wrappedBus);
}
@@ -40,7 +37,7 @@
private final TestableResettableEventBus real;
- public ResettableEventBus(EventBus wrappedBus) {
+ public ResettableEventBus(com.google.web.bindery.event.shared.EventBus
wrappedBus) {
real = new TestableResettableEventBus(wrappedBus);
}
=======================================
--- /releases/2.4/user/src/com/google/gwt/place/shared/PlaceController.java
Mon Apr 18 13:47:45 2011
+++ /releases/2.4/user/src/com/google/gwt/place/shared/PlaceController.java
Fri Jun 17 11:00:00 2011
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not
* use this file except in compliance with the License. You may obtain a
copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,11 +16,11 @@
package com.google.gwt.place.shared;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.ClosingEvent;
import com.google.gwt.user.client.Window.ClosingHandler;
+import com.google.web.bindery.event.shared.EventBus;
import java.util.logging.Logger;
@@ -49,7 +49,7 @@
public interface Delegate {
/**
* Adds a {@link ClosingHandler} to the Delegate.
- *
+ *
* @param handler a {@link ClosingHandler} instance
* @return a {@link HandlerRegistration} instance
*/
@@ -57,7 +57,7 @@
/**
* Called to confirm a window closing event.
- *
+ *
* @param message a warning message
* @return true to allow the window closing
*/
@@ -70,6 +70,26 @@
private final Delegate delegate;
private Place where = Place.NOWHERE;
+
+ /**
+ * Legacy method tied to the old location for {@link EventBus}.
+ *
+ * @deprecated use {@link #PlaceController(EventBus)}
+ */
+ @Deprecated
+ public PlaceController(com.google.gwt.event.shared.EventBus eventBus) {
+ this((EventBus) eventBus);
+ }
+
+ /**
+ * Legacy method tied to the old location for {@link EventBus}.
+ *
+ * @deprecated use {@link #PlaceController(EventBus, Delegate)}
+ */
+ @Deprecated
+ public PlaceController(com.google.gwt.event.shared.EventBus eventBus,
Delegate delegate) {
+ this((EventBus) eventBus, delegate);
+ }
/**
* Create a new PlaceController with a {@link DefaultDelegate}. The
@@ -113,13 +133,13 @@
/**
* Request a change to a new place. It is not a given that we'll
actually get
- * there. First a {@link PlaceChangeRequestEvent} will be posted to the
- * event bus. If any receivers post a warning message to that event, it
will
- * be presented to the user via {@link Delegate#confirm(String)} (which
is
+ * there. First a {@link PlaceChangeRequestEvent} will be posted to the
event
+ * bus. If any receivers post a warning message to that event, it will be
+ * presented to the user via {@link Delegate#confirm(String)} (which is
* typically a call to {@link Window#confirm(String)}). If she cancels,
the
* current location will not change. Otherwise, the location changes and
a
* {@link PlaceChangeEvent} is posted announcing the new place.
- *
+ *
* @param newPlace a {@link Place} instance
*/
public void goTo(Place newPlace) {
@@ -145,8 +165,7 @@
}
private String maybeGoTo(Place newPlace) {
- PlaceChangeRequestEvent willChange = new PlaceChangeRequestEvent(
- newPlace);
+ PlaceChangeRequestEvent willChange = new
PlaceChangeRequestEvent(newPlace);
eventBus.fireEvent(willChange);
String warning = willChange.getWarning();
return warning;
=======================================
---
/releases/2.4/user/src/com/google/gwt/place/shared/PlaceHistoryHandler.java
Mon Apr 18 13:47:45 2011
+++
/releases/2.4/user/src/com/google/gwt/place/shared/PlaceHistoryHandler.java
Fri Jun 17 11:00:00 2011
@@ -18,9 +18,10 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.LegacyHandlerWrapper;
import com.google.gwt.user.client.History;
+import com.google.web.bindery.event.shared.EventBus;
+import com.google.web.bindery.event.shared.HandlerRegistration;
import java.util.logging.Logger;
@@ -35,7 +36,7 @@
* Default implementation of {@link Historian}, based on {@link History}.
*/
public static class DefaultHistorian implements Historian {
- public HandlerRegistration addValueChangeHandler(
+ public com.google.gwt.event.shared.HandlerRegistration
addValueChangeHandler(
ValueChangeHandler<String> valueChangeHandler) {
return History.addValueChangeHandler(valueChangeHandler);
}
@@ -62,7 +63,7 @@
* @param valueChangeHandler the handler
* @return the registration used to remove this value change handler
*/
- HandlerRegistration addValueChangeHandler(
+ com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(
ValueChangeHandler<String> valueChangeHandler);
/**
@@ -116,31 +117,43 @@
public void handleCurrentHistory() {
handleHistoryToken(historian.getToken());
}
+
+ /**
+ * Legacy method tied to the old location for {@link EventBus}.
+ *
+ * @deprecated use {@link #register(PlaceController, EventBus, Place)}
+ */
+ @Deprecated
+ public com.google.gwt.event.shared.HandlerRegistration
register(PlaceController placeController,
+ com.google.gwt.event.shared.EventBus eventBus, Place defaultPlace) {
+ return new LegacyHandlerWrapper(register(placeController, (EventBus)
eventBus, defaultPlace));
+ }
/**
* Initialize this place history handler.
*
* @return a registration object to de-register the handler
*/
- public HandlerRegistration register(PlaceController placeController,
- EventBus eventBus, Place defaultPlace) {
+ public HandlerRegistration register(PlaceController placeController,
EventBus eventBus,
+ Place defaultPlace) {
this.placeController = placeController;
this.defaultPlace = defaultPlace;
- final HandlerRegistration placeReg = eventBus.addHandler(
- PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() {
+ final HandlerRegistration placeReg =
+ eventBus.addHandler(PlaceChangeEvent.TYPE, new
PlaceChangeEvent.Handler() {
public void onPlaceChange(PlaceChangeEvent event) {
Place newPlace = event.getNewPlace();
historian.newItem(tokenForPlace(newPlace), false);
}
});
- final HandlerRegistration historyReg =
historian.addValueChangeHandler(new ValueChangeHandler<String>() {
- public void onValueChange(ValueChangeEvent<String> event) {
- String token = event.getValue();
- handleHistoryToken(token);
- }
- });
+ final HandlerRegistration historyReg =
+ historian.addValueChangeHandler(new ValueChangeHandler<String>() {
+ public void onValueChange(ValueChangeEvent<String> event) {
+ String token = event.getValue();
+ handleHistoryToken(token);
+ }
+ });
return new HandlerRegistration() {
public void removeHandler() {
=======================================
---
/releases/2.4/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
Thu Jun 9 11:31:51 2011
+++
/releases/2.4/user/src/com/google/web/bindery/requestfactory/vm/RequestFactorySource.java
Fri Jun 17 11:00:00 2011
@@ -31,7 +31,7 @@
* initialized with an explicit
* {@link com.google.web.bindery.requestfactory.shared.RequestTransport
* RequestTransport} via the
- * {@link
RequestFactory#initialize(com.google.gwt.event.shared.EventBus,
com.google.web.bindery.requestfactory.shared.RequestTransport)
+ * {@link
RequestFactory#initialize(com.google.web.bindery.event.shared.EventBus,
com.google.web.bindery.requestfactory.shared.RequestTransport)
* initialize(EventBus, RequestTransport} method.
*
* @param <T> the RequestFactory type
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors