* Any handlers attached to the provided event bus will be de-registered when
* the activity is stopped, so activities will rarely need to hold on to the
@@ -60,5 +61,5 @@ public interface Activity {
* @param panel the panel to display this activity's widget when it is ready
* @param eventBus the event bus
*/
- void start(AcceptsOneWidget panel, EventBus eventBus);
+ void start(ActivityDisplay Drop-in replacement for {@link com.google.gwt.activity.shared.ActivityManager}. Note: wraps {@link org.gwtproject.activity.shared.ActivityManager} rather than
+ * extending it which prevents casting between {@link ActivityManager} and
+ * {@link WidgetActivityManager}. Two alternatives exist:
+ * Any handlers attached to the returned event bus will be de-registered when
+ * the current activity is stopped.
+ *
+ * @return the event bus used by the current activity
+ */
+ public EventBus getActiveEventBus() {
+ return delegate.getActiveEventBus();
+ }
+
+ /**
+ * Sets the display for the receiver, and has the side effect of starting or
+ * stopping its monitoring the event bus for place change events.
+ *
+ * If you are disposing of an ActivityManager, it is important to call
+ * setDisplay(null) to get it to de-register from the event bus, so that it can
+ * be garbage collected.
+ *
+ * @param display an instance of AcceptsOneWidget
+ */
+ public void setDisplay(AcceptsOneWidget display) {
+ delegate.setDisplay(display == null ? null : display::setWidget);
+ }
+
+}
diff --git a/src/main/java/org/gwtproject/user/client/ui/IsWidget.java b/src/main/java/org/gwtproject/activity/widget/shared/WidgetActivityMapper.java
similarity index 57%
rename from src/main/java/org/gwtproject/user/client/ui/IsWidget.java
rename to src/main/java/org/gwtproject/activity/widget/shared/WidgetActivityMapper.java
index e0266ac..d56b9d8 100644
--- a/src/main/java/org/gwtproject/user/client/ui/IsWidget.java
+++ b/src/main/java/org/gwtproject/activity/widget/shared/WidgetActivityMapper.java
@@ -1,32 +1,30 @@
/*
* 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
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.gwtproject.user.client.ui;
+package org.gwtproject.activity.widget.shared;
-import com.google.gwt.user.client.ui.Widget;
+import org.gwtproject.activity.shared.ActivityMapper;
+import org.gwtproject.place.shared.Place;
+import org.gwtproject.user.client.ui.IsWidget;
/**
- * Extended by view interfaces that are likely to be implemented by Widgets.
- * Provides access to that widget, if it exists, without compromising the
- * ability to provide a mock view instance in JRE unit tests.
+ * Drop-in replacement for {@link com.google.gwt.activity.shared.ActivityMapper}.
*/
-@FunctionalInterface
-public interface IsWidget {
+public interface WidgetActivityMapper extends ActivityMappernull
to clear display
+ *
+ * @see WidgetActivityDisplay
+ */
+ void show(V view);
+
+}
diff --git a/src/main/java/org/gwtproject/activity/shared/ActivityManager.java b/src/main/java/org/gwtproject/activity/shared/ActivityManager.java
index faba5f5..8e6104c 100644
--- a/src/main/java/org/gwtproject/activity/shared/ActivityManager.java
+++ b/src/main/java/org/gwtproject/activity/shared/ActivityManager.java
@@ -21,8 +21,6 @@
import org.gwtproject.event.shared.UmbrellaException;
import org.gwtproject.place.shared.PlaceChangeEvent;
import org.gwtproject.place.shared.PlaceChangeRequestEvent;
-import org.gwtproject.user.client.ui.AcceptsOneWidget;
-import org.gwtproject.user.client.ui.IsWidget;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -31,21 +29,24 @@
* Manages {@link Activity} objects that should be kicked off in response to
* {@link PlaceChangeEvent} events. Each activity can start itself
* asynchronously, and provides a widget to be shown when it's ready to run.
+ *
+ * @param null
to remove the widget
- *
- * @see SimplePanel
- */
- void setWidget(IsWidget w);
}
diff --git a/src/main/java/org/gwtproject/activity/widget/shared/CachingWidgetActivityMapper.java b/src/main/java/org/gwtproject/activity/widget/shared/CachingWidgetActivityMapper.java
new file mode 100644
index 0000000..5cfa79a
--- /dev/null
+++ b/src/main/java/org/gwtproject/activity/widget/shared/CachingWidgetActivityMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.gwtproject.activity.widget.shared;
+
+import org.gwtproject.activity.shared.CachingActivityMapper;
+import org.gwtproject.place.shared.Place;
+import org.gwtproject.user.client.ui.IsWidget;
+
+/**
+ * Drop-in replacement for {@link com.google.gwt.activity.shared.CachingActivityMapper}.
+ */
+public class CachingWidgetActivityMapper extends CachingActivityMapper
+ *
+ */
+public class WidgetActivityManager implements PlaceChangeEvent.Handler,
+ PlaceChangeRequestEvent.Handler {
+
+ private final ActivityManager