private String appUri;
private JavaScriptObject versionInfo;
private String windowName;
+ private boolean standalone;
private String communicationErrorCaption;
private String communicationErrorMessage;
private String communicationErrorUrl;
id = appId;
}
+ /**
+ * @return true if the application is served by std. Vaadin servlet and is
+ * considered to be the only or main content of the host page.
+ */
+ public boolean isStandalone() {
+ return standalone;
+ }
+
public void setInitialWindowName(String name) {
windowName = name;
}
if (jsobj.portletUidlURLBase) {
this.@com.vaadin.terminal.gwt.client.ApplicationConfiguration::portletUidlURLBase = jsobj.portletUidlURLBase;
}
+ if (jsobj.standalone) {
+ this.@com.vaadin.terminal.gwt.client.ApplicationConfiguration::standalone = true;
+ }
} else {
$wnd.alert("Vaadin app failed to initialize: " + this.id);
}
return windows;
}
- public void init(String rootPanelId) {
+ public void init(String rootPanelId,
+ ApplicationConnection applicationConnection) {
DOM.sinkEvents(getElement(), Event.ONKEYDOWN | Event.ONSCROLL);
// iview is focused when created so element needs tabIndex
root.add(this);
- BrowserInfo browser = BrowserInfo.get();
-
- // set focus to iview element by default to listen possible keyboard
- // shortcuts
- if (browser.isOpera() || browser.isSafari()
- && browser.getWebkitVersion() < 526) {
- // old webkits don't support focusing div elements
- Element fElem = DOM.createInputCheck();
- DOM.setStyleAttribute(fElem, "margin", "0");
- DOM.setStyleAttribute(fElem, "padding", "0");
- DOM.setStyleAttribute(fElem, "border", "0");
- DOM.setStyleAttribute(fElem, "outline", "0");
- DOM.setStyleAttribute(fElem, "width", "1px");
- DOM.setStyleAttribute(fElem, "height", "1px");
- DOM.setStyleAttribute(fElem, "position", "absolute");
- DOM.setStyleAttribute(fElem, "opacity", "0.1");
- DOM.appendChild(getElement(), fElem);
- fElem.focus();
- } else {
+ if (applicationConnection.getConfiguration().isStandalone()) {
+ // set focus to iview element by default to listen possible keyboard
+ // shortcuts. For embedded applications this is unacceptable as we
+ // don't want to steal focus from the main page nor we don't want
+ // side-effects from focusing (scrollIntoView).
getElement().focus();
}
page.write("windowName: \""
+ JsonPaintTarget.escapeJSON(window.getName()) + "\", ");
}
+ if (isStandalone()) {
+ page.write("standalone: true, ");
+ }
page.write("themeUri:");
page.write(themeUri != null ? "\"" + themeUri + "\"" : "null");
page.write(", versionInfo : {vaadinVersion:\"");
+ widgetsetFilePath + "\")};',15000);\n" + "//]]>\n</script>\n");
}
+ /**
+ * @return true if the served application is considered to be the only or
+ * main content of the host page. E.g. various embedding solutions
+ * should override this to false.
+ */
+ protected boolean isStandalone() {
+ return true;
+ }
+
/**
*
* Method to open the body tag of the html kickstart page.