Thanks for the fast replies. I don't have the code in a public place somewhere but the code below shows the general setup of presenters/views. Note that the Window, Shortcut and Desktop classes are GXT components. The Shortcut class is modified to store the name token of the corresponding AppPresenter. So, my main problem is that the first time I click on the shortcut, the AppPresenter is revealed as expected. In the setInSlot() of the AppView, the widget (which is a GXT window) is added to the Desktop component and then shown. Since this action was triggered by a place request, the URL is updated to the "!app" name token. When I close the GXT window, my idea was to catch the window's HideEvent and issue a place request for the desktop "!desktop". This works but when I click the shortcut again, only the URL is updated but the AppPresenter's revealInParent() is not called, and neither is the setInSlot() of the DesktopView. I tried adding a onReveal() in the AppPresenter to see whether it is called, but it is not. So, that's my situation right now. I don't know maybe you see something funny here. Perhaps the DesktopPresenter should be a place?
////////////////////////////////////////////////////////////////////////
public class MainPresenter
extends Presenter<MainPresenter.MyView, MainPresenter.MyProxy> {
@ProxyStandard
public interface MyProxy extends Proxy<MainPresenter> {}
public interface MyView extends View {}
@ContentSlot
public static final Type<RevealContentHandler<?>>
TYPE_SetMainContent = new Type<~>();
@Inject
public MainPresenter(EventBus bus, MyView view, MyProxy proxy) {
super(bus, view, proxy);
}
@Override
public void revealInParent() {
RevealRootContentEvent.fire(this, this);
}
}
////////////////////////////////////////////////////////////////////////
public class MainView extends ViewImpl implements MainPresenter.MyView {
private Viewport viewport = new Viewport();
public MainView() {
}
@Override
public void setInSlot(Object slot, Widget widget) {
if(slot == MainPresenter.TYPE_SetMainContent) {
viewport.clear();
viewport.add(widget);
} else {
super.setInSlot(slot, widget);
}
}
@Override
public Widget asWidget() {
return viewport;
}
}
////////////////////////////////////////////////////////////////////////
public class DesktopPresenter
extends Presenter<DesktopPresenter.MyView, DesktopPresenter.MyProxy> {
@ProxyCodeSplit
@NameToken("!desktop");
public interface MyProxy extends ProxyPlace<DesktopPresenter> {}
public interface MyView extends ViewImpl {
Desktop getDesktop();
}
@ContentSlot
public final static Type<RevealContentHandler<?>>
TYPE_SetDesktopContent = new Type<~>();
private final PlaceManager manager;
@Inject
public DesktopPresenter(
EventBus bus, MyView view, MyProxy proxy, PlaceManager manager) {
super(bus, view, proxy);
this.manager = manager;
}
@Override
protected void revealInParent() {
RevealContentEvent.fire(
this, MainPresenter.TYPE_SetMainContent, this);
}
@Override
protected void onBind() {
super.onBind();
Shortcut shortcut = new Shortcut("!app");
shortcut.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
Shortcut s = (Shortcut) event.getSource();
manager.revealPlace(new PlaceRequest(s.getNameToken()));
}
});
getView().getDesktop().addShortcut(shortcut);
}
}
////////////////////////////////////////////////////////////////////////
public class DesktopView extends ViewImpl implements DesktopPresenter.MyView {
private Desktop desktop = new Desktop();
public DesktopView() {
}
@Override
public void setInSlot(Object slot, Widget widget) {
if(slot == DesktopPresenter.TYPE_SetDesktopContent) {
if(widget instanceof Window) {
desktop.add(widget);
desktop.show(widget);
}
} else {
super.setInSlot(slot, widget);
}
}
@Override
public Desktop getDesktop() {
return desktop;
}
@Override
public Widget asWidget() {
return desktop;
}
}
////////////////////////////////////////////////////////////////////////
public class AppPresenter
extends Presenter<AppPresenter.MyView, AppPresenter.MyProxy> {
@ProxyCodeSplit
@NameToken("!app");
public interface MyProxy extends ProxyPlace<AppPresenter> {}
public interface MyView extends ViewImpl {
Window getWindow();
}
private final PlaceManager manager;
@Inject
public AppPresenter(
EventBus bus, MyView view, MyProxy proxy, PlaceManager manager) {
super(bus, view, proxy);
this.manager = manager;
}
@Override
protected void onBind() {
super.onBind();
getView().getWindow().addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent event) {
manager.revealPlace(new PlaceRequest("!desktop"));
}
});
}
@Override
protected void revealInParent() {
RevealContentEvent.fire(
this, DesktopPresenter.TYPE_SetDesktopContent, this);
}
}
////////////////////////////////////////////////////////////////////////
public class AppView extends ViewImpl implements AppPresenter.MyView {
private Window window = new Window();
public AppView() {
}
@Override
public Window getWindow() {
return window;
}
@Override
public Widget asWidget() {
return window;