</thead><tbody>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.root.LazyInitRoots/?restartApplication&lazyCreate#lazyCreate</td>
+ <td>/run/com.vaadin.tests.components.root.LazyInitRoots/normalPath?restartApplication#normalFragment</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsrootLazyInitRoots::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Lazy create root: lazyCreate</td>
+ <td>NormalRoot<br />pathInfo: /normalPath<br />parameters: [restartApplication]<br />uri fragment: normalFragment</td>
</tr>
<tr>
<td>open</td>
- <td>/run/com.vaadin.tests.components.root.LazyInitRoots/?restartApplication&lazyInit#lazyInit</td>
+ <td>/run/com.vaadin.tests.components.root.LazyInitRoots/lazyCreatePath?lazyCreate#lazyCreateFragment</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsrootLazyInitRoots::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>Lazy init root: lazyInit</td>
+ <td>LazyCreateRoot<br />pathInfo: /lazyCreatePath<br />parameters: [lazyCreate]<br />uri fragment: lazyCreateFragment</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.root.LazyInitRoots/eagerPath/?eagerInit#eagerFragment</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsrootLazyInitRoots::/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>EagerInitRoot<br />pathInfo: /eagerPath/<br />parameters: [eagerInit]<br />uri fragment: null</td>
</tr>
-
</tbody></table>
</body>
</html>
import com.vaadin.terminal.WrappedRequest.BrowserDetails;
import com.vaadin.tests.components.AbstractTestApplication;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Link;
import com.vaadin.ui.Root;
private static class EagerInitRoot extends Root {
@Override
public void init(WrappedRequest request) {
- BrowserDetails browserDetails = request.getBrowserDetails();
- getContent().addComponent(
- new Label("Lazy init root: " + browserDetails));
+ addComponent(getRequestInfo("EagerInitRoot", request));
}
}
throws RootRequiresMoreInformationException {
if (request.getParameter("lazyCreate") != null) {
// Root created on second request
- final BrowserDetails browserDetails = request.getBrowserDetails();
+ BrowserDetails browserDetails = request.getBrowserDetails();
if (browserDetails == null
|| browserDetails.getUriFragment() == null) {
throw new RootRequiresMoreInformationException();
Root root = new Root() {
@Override
protected void init(WrappedRequest request) {
- addComponent(new Label("Lazy create root: "
- + browserDetails.getUriFragment()));
+ addComponent(getRequestInfo("LazyCreateRoot", request));
}
};
return root;
}
} else if (request.getParameter("eagerInit") != null) {
- // Root inited on second request
+ // Root inited on first request
return new EagerInitRoot();
} else {
// The standard root
Root root = new Root() {
@Override
protected void init(WrappedRequest request) {
+ addComponent(getRequestInfo("NormalRoot", request));
+
Link lazyCreateLink = new Link("Open lazyCreate root",
new ExternalResource(getURL()
+ "?lazyCreate#lazyCreate"));
}
}
+ public static Label getRequestInfo(String name, WrappedRequest request) {
+ String info = name;
+ info += "<br />pathInfo: " + request.getRequestPathInfo();
+ info += "<br />parameters: " + request.getParameterMap().keySet();
+ info += "<br />uri fragment: "
+ + request.getBrowserDetails().getUriFragment();
+ return new Label(info, ContentMode.XHTML);
+ }
+
@Override
protected String getTestDescription() {
return "BrowserDetails should be available in Application.getRoot if RootRequiresMoreInformation has been thrown and in Root.init if the root has the @RootInitRequiresBrowserDetals annotation";