本文整理了Java中com.vaadin.ui.UI.getPage()
方法的一些代码示例,展示了UI.getPage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UI.getPage()
方法的具体详情如下:
包路径:com.vaadin.ui.UI
类名称:UI
方法名:getPage
[英]Gets the object representing the page on which this UI exists.
[中]获取表示此UI所在页面的对象。
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void popstate(String uri) {
getPage().updateLocation(uri, true, true);
}
};
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void resize(int viewWidth, int viewHeight, int windowWidth,
int windowHeight) {
// TODO We're not doing anything with the view dimensions
getPage().updateBrowserWindowSize(windowWidth, windowHeight, true);
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Gets the Page to which the current uI belongs. This is automatically
* defined when processing requests to the server. In other cases, (e.g.
* from background threads), the current uI is not automatically defined.
*
* @see UI#getCurrent()
*
* @return the current page instance if available, otherwise
* <code>null</code>
*/
public static Page getCurrent() {
UI currentUI = UI.getCurrent();
if (currentUI == null) {
return null;
}
return currentUI.getPage();
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Shows a notification message.
*
* @see Notification
* @see #showNotification(String)
* @see #showNotification(String, int)
* @see #showNotification(String, String)
* @see #showNotification(String, String, int)
*
* @param notification
* The notification message to show
*
* @deprecated As of 7.0, use Notification.show instead
*/
@Deprecated
public void showNotification(Notification notification) {
getPage().showNotification(notification);
}
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void setState(String state) {
StringBuilder sb = new StringBuilder(ui.getUiRootPath());
if (!ui.getUiRootPath().endsWith("/")) {
// make sure there is a '/' between the root path and the
// navigation state.
sb.append('/');
}
sb.append(state);
URI location = ui.getPage().getLocation();
if (location != null) {
ui.getPage().pushState(location.resolve(sb.toString()));
} else {
throw new IllegalStateException(
"The Page of the UI does not have a location.");
}
}
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Creates a navigation state manager for given UI. This method should take
* into account any navigation related annotations.
*
* @param ui
* the ui
* @return the navigation state manager
*
* @since 8.2
*/
protected NavigationStateManager createNavigationStateManager(UI ui) {
if (ui.getClass().getAnnotation(PushStateNavigation.class) != null) {
return new PushStateManager(ui);
}
// Fall back to old default
return new UriFragmentManager(ui.getPage());
}
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public String getState() {
// Get the current URL
URI location = ui.getPage().getLocation();
String path = location.getPath();
if (ui.getUiPathInfo() != null
&& path.contains(ui.getUiPathInfo())) {
// Split the path from after the UI PathInfo
path = path.substring(path.indexOf(ui.getUiPathInfo())
+ ui.getUiPathInfo().length());
} else if (path.startsWith(ui.getUiRootPath())) {
// Use the whole path after UI RootPath
String uiRootPath = ui.getUiRootPath();
path = path.substring(uiRootPath.length());
} else {
throw new IllegalStateException(getClass().getSimpleName()
+ " is unable to determine the view path from the URL.");
}
if (path.startsWith("/")) {
// Strip leading '/'
path = path.substring(1);
}
return path;
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Shows a notification consisting of a bigger caption and a smaller
* description. The position and behavior of the message depends on the
* type, which is one of the basic types defined in {@link Notification} ,
* for instance Notification.TYPE_WARNING_MESSAGE.
*
* Care should be taken to avoid XSS vulnerabilities if html content is
* allowed.
*
* @see #showNotification(Notification)
* @see Notification
*
* @param caption
* The message caption
* @param description
* The message description
* @param type
* The type of message
* @param htmlContentAllowed
* Whether html in the caption and description should be
* displayed as html or as plain text
*
* @deprecated As of 7.0, use new Notification(...).show(Page).
*/
@Deprecated
public void showNotification(String caption, String description,
Notification.Type type, boolean htmlContentAllowed) {
getPage().showNotification(new Notification(caption, description, type,
htmlContentAllowed));
}
代码示例来源:origin: com.vaadin/vaadin-server
sharedParameterActionNameMap.put(actionKey, name);
sharedParameterActionValueMap.put(actionKey, value);
uI.getPage().setLocation(actionUrl.toString());
} else {
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Shows a notification message on the middle of the UI. The message
* automatically disappears ("humanized message").
*
* Care should be taken to to avoid XSS vulnerabilities as the caption is
* rendered as html.
*
* @see #showNotification(Notification)
* @see Notification
*
* @param caption
* The message
*
* @deprecated As of 7.0, use Notification.show instead but be aware that
* Notification.show does not allow HTML.
*/
@Deprecated
public void showNotification(String caption) {
Notification notification = new Notification(caption);
notification.setHtmlContentAllowed(true);// Backwards compatibility
getPage().showNotification(notification);
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Shows a notification consisting of a bigger caption and a smaller
* description on the middle of the UI. The message automatically disappears
* ("humanized message").
*
* Care should be taken to to avoid XSS vulnerabilities as the caption and
* description are rendered as html.
*
* @see #showNotification(Notification)
* @see Notification
*
* @param caption
* The caption of the message
* @param description
* The message description
*
* @deprecated As of 7.0, use new Notification(...).show(Page) instead but
* be aware that HTML by default not allowed.
*/
@Deprecated
public void showNotification(String caption, String description) {
Notification notification = new Notification(caption, description);
notification.setHtmlContentAllowed(true);// Backwards compatibility
getPage().showNotification(notification);
}
代码示例来源:origin: com.vaadin/vaadin-server
eventActionDestinationMap.put(actionKey, name);
eventActionValueMap.put(actionKey, value);
uI.getPage().setLocation(actionUrl.toString());
} else {
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Shows a notification message the UI. The position and behavior of the
* message depends on the type, which is one of the basic types defined in
* {@link Notification}, for instance Notification.TYPE_WARNING_MESSAGE.
*
* Care should be taken to to avoid XSS vulnerabilities as the caption is
* rendered as html.
*
* @see #showNotification(Notification)
* @see Notification
*
* @param caption
* The message
* @param type
* The message type
*
* @deprecated As of 7.0, use Notification.show instead but be aware that
* Notification.show does not allow HTML.
*/
@Deprecated
public void showNotification(String caption, Notification.Type type) {
Notification notification = new Notification(caption, type);
notification.setHtmlContentAllowed(true);// Backwards compatibility
getPage().showNotification(notification);
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Shows a notification consisting of a bigger caption and a smaller
* description. The position and behavior of the message depends on the
* type, which is one of the basic types defined in {@link Notification} ,
* for instance Notification.TYPE_WARNING_MESSAGE.
*
* Care should be taken to to avoid XSS vulnerabilities as the caption and
* description are rendered as html.
*
* @see #showNotification(Notification)
* @see Notification
*
* @param caption
* The caption of the message
* @param description
* The message description
* @param type
* The message type
*
* @deprecated As of 7.0, use new Notification(...).show(Page) instead but
* be aware that HTML by default not allowed.
*/
@Deprecated
public void showNotification(String caption, String description,
Notification.Type type) {
Notification notification = new Notification(caption, description,
type);
notification.setHtmlContentAllowed(true);// Backwards compatibility
getPage().showNotification(notification);
}
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void setNavigator(Navigator navigator) {
if (popStateListenerRegistration != null) {
popStateListenerRegistration.remove();
popStateListenerRegistration = null;
}
if (navigator != null) {
popStateListenerRegistration = ui.getPage().addPopStateListener(
event -> navigator.navigateTo(getState()));
}
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Load and initialize the mobile drag-drop-polyfill if needed and not yet
* done so.
*/
private void loadMobileHtml5DndPolyfill() {
if (mobileHtml5DndPolyfillLoaded) {
return;
}
if (!getPage().getWebBrowser().isTouchDevice()) {
return;
}
mobileHtml5DndPolyfillLoaded = true;
String vaadinLocation = getSession().getService().getStaticFileLocation(
VaadinService.getCurrentRequest()) + "/VAADIN/";
getPage().addDependency(new Dependency(Type.JAVASCRIPT,
vaadinLocation + ApplicationConstants.MOBILE_DND_POLYFILL_JS));
getRpcProxy(PageClientRpc.class).initializeMobileHtml5DndPolyfill();
}
代码示例来源:origin: com.vaadin/vaadin-server
getPage().init(request);
&& getPage().getLocation() != null) {
String uiRootPath = getPage().getLocation().getPath();
代码示例来源:origin: com.vaadin/vaadin-server
dependencies.addAll(ui.getPage().getPendingDependencies());
dependencies.addAll(Dependency.findDependencies(newConnectorTypes,
manager, new FilterContext(session)));
代码示例来源:origin: com.vaadin/vaadin-server
Page page = getPage();
代码示例来源:origin: OpenNMS/opennms
@Override
public void attach(AttachEvent attachEvent) {
getUI().getPage().getStyles().add(".preview { width:225px; }");
}
});
内容来源于网络,如有侵权,请联系作者删除!