use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.
the class ConnectionImpl method makeClientInfo.
protected String makeClientInfo() {
// timezone info is passed only on VaadinSession creation
WebBrowser webBrowser = getWebBrowserDetails();
// noinspection UnnecessaryLocalVariable
String serverInfo = String.format("Web (%s:%s/%s) %s", globalConfig.getWebHostName(), globalConfig.getWebPort(), globalConfig.getWebContextName(), webBrowser.getBrowserApplication());
return serverInfo;
}
use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.
the class ConnectionImpl method getWebBrowserDetails.
protected WebBrowser getWebBrowserDetails() {
// timezone info is passed only on VaadinSession creation
WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser();
VaadinRequest currentRequest = VaadinService.getCurrentRequest();
// it can be null in case of background/async processing of login request
if (currentRequest != null) {
webBrowser.updateRequestDetails(currentRequest);
}
return webBrowser;
}
use of com.vaadin.server.WebBrowser in project ANNIS by korpling.
the class SearchView method notifyCannotPlayMimeType.
@Override
public void notifyCannotPlayMimeType(String mimeType) {
if (mimeType == null) {
return;
}
if (mimeType.startsWith("audio/ogg") || mimeType.startsWith("video/web")) {
String browserList = "<ul>" + "<li>Mozilla Firefox: <a href=\"http://www.mozilla.org/firefox\" target=\"_blank\">http://www.mozilla.org/firefox</a></li>" + "<li>Google Chrome: <a href=\"http://www.google.com/chrome\" target=\"_blank\">http://www.google.com/chrome</a></li>" + "</ul>";
WebBrowser browser = Page.getCurrent().getWebBrowser();
// IE9 users can install a plugin
Set<String> supportedByIE9Plugin = new HashSet<>();
supportedByIE9Plugin.add("video/webm");
supportedByIE9Plugin.add("audio/ogg");
supportedByIE9Plugin.add("video/ogg");
if (browser.isIE() && browser.getBrowserMajorVersion() >= 9 && supportedByIE9Plugin.contains(mimeType)) {
Notification n = new Notification("Media file type unsupported by your browser", "Please install the WebM plugin for Internet Explorer 9 from " + "<a target=\"_blank\" href=\"https://tools.google.com/dlpage/webmmf\">https://tools.google.com/dlpage/webmmf</a> " + " or use a browser from the following list " + "(these are known to work with WebM or OGG files)<br/>" + browserList + "<br/><br /><strong>Click on this message to hide it</strong>", Notification.Type.WARNING_MESSAGE, true);
n.setDelayMsec(15000);
n.show(Page.getCurrent());
} else {
Notification n = new Notification("Media file type unsupported by your browser", "Please use a browser from the following list " + "(these are known to work with WebM or OGG files)<br/>" + browserList + "<br/><br /><strong>Click on this message to hide it</strong>", Notification.Type.WARNING_MESSAGE, true);
n.setDelayMsec(15000);
n.show(Page.getCurrent());
}
} else {
Notification.show("Media file type \"" + mimeType + "\" unsupported by your browser!", "Try to check your browsers documentation how to enable " + "support for the media type or inform the corpus creator about this problem.", Notification.Type.WARNING_MESSAGE);
}
}
use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.
the class ConnectionImpl method detectTimeZone.
protected TimeZone detectTimeZone() {
WebBrowser webBrowser = getWebBrowserDetails();
int offset = webBrowser.getTimezoneOffset() / 1000 / 60;
char sign = offset >= 0 ? '+' : '-';
int absOffset = Math.abs(offset);
String hours = StringUtils.leftPad(String.valueOf(absOffset / 60), 2, '0');
String minutes = StringUtils.leftPad(String.valueOf(absOffset % 60), 2, '0');
return TimeZone.getTimeZone("GMT" + sign + hours + minutes);
}
use of com.vaadin.server.WebBrowser in project cuba by cuba-platform.
the class CubaImage method attach.
@Override
public void attach() {
super.attach();
WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
if (webBrowser.isIE() || webBrowser.isEdge()) {
CubaImageObjectFitPolyfillExtension.get(getUI());
}
}
Aggregations