Skip to content

Commit a29f130

Browse files
Merge pull request #287 from clavelm/issue286
RootPresenter.RootView : add and use the protected method getAppRootPane...
2 parents 8c233a4 + 6591f2f commit a29f130

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/RootPresenter.java

+17-5
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,35 @@ public void setInSlot(Object slot, IsWidget content) {
8282
if (usingRootLayoutPanel) {
8383
// TODO Next 3 lines are a dirty workaround for
8484
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
85-
RootPanel.get().clear();
85+
getAppRootPanel().clear();
8686
RootLayoutPanel.get().clear();
87-
RootPanel.get().add(RootLayoutPanel.get());
87+
getAppRootPanel().add(RootLayoutPanel.get());
8888
if (content != null) {
8989
RootLayoutPanel.get().add(content);
9090
}
9191
} else {
9292
// TODO Next 2 lines are a dirty workaround for
9393
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
9494
RootLayoutPanel.get().clear();
95-
RootPanel.get().clear();
95+
getAppRootPanel().clear();
9696
if (content != null) {
97-
RootPanel.get().add(content);
97+
getAppRootPanel().add(content);
9898
}
9999
}
100100
}
101101

102-
private void setUsingRootLayoutPanel(boolean usingRootLayoutPanel) {
102+
/**
103+
* Return the RootPanel on which to add the content.
104+
* <p />
105+
* It returns the default RootPanel.
106+
* It can be overriden to return another RootPanel to allow embeding the application.
107+
* @return the RootPanel on which to add the content
108+
*/
109+
protected RootPanel getAppRootPanel() {
110+
return RootPanel.get();
111+
}
112+
113+
private void setUsingRootLayoutPanel(final boolean usingRootLayoutPanel) {
103114
this.usingRootLayoutPanel = usingRootLayoutPanel;
104115
}
105116

@@ -175,6 +186,7 @@ public void onRevealRootContent(
175186
setInSlot(rootSlot, revealContentEvent.getContent());
176187
}
177188

189+
@Override
178190
public void onRevealRootLayoutContent(
179191
final RevealRootLayoutContentEvent revealContentEvent) {
180192
getView().setUsingRootLayoutPanel(true);

0 commit comments

Comments
 (0)