com.vaadin.ui.UI.setContent()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中com.vaadin.ui.UI.setContent()方法的一些代码示例,展示了UI.setContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UI.setContent()方法的具体详情如下:
包路径:com.vaadin.ui.UI
类名称:UI
方法名:setContent

UI.setContent介绍

暂无

代码示例

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Set the content of the window. For a {@link LegacyWindow}, the content
 * must be a {@link ComponentContainer}.
 *
 * @param content
 */
@Override
public void setContent(Component content) {
  if (!(content instanceof ComponentContainer)) {
    throw new IllegalArgumentException(
        "The content of a LegacyWindow must be a ComponentContainer");
  }
  super.setContent(content);
}

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * Creates a new UI with the given component (often a layout) as its
 * content.
 *
 * @param content
 *            the component to use as this UIs content.
 *
 * @see #setContent(Component)
 */
public UI(Component content) {
  registerRpc(rpc);
  registerRpc(debugRpc);
  registerRpc(windowOrderRpc);
  setSizeFull();
  setContent(content);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

protected void redirectAfterLogout(String loggedOutUrl) {
  if (!Strings.isNullOrEmpty(loggedOutUrl)) {
    AppUI currentUi = AppUI.getCurrent();
    // it can be null if we handle request in a custom RequestHandler
    if (currentUi != null) {
      currentUi.setContent(null);
      currentUi.getPage().setLocation(loggedOutUrl);
    } else {
      VaadinResponse response = VaadinService.getCurrentResponse();
      try {
        ((VaadinServletResponse) response).getHttpServletResponse().
            sendRedirect(loggedOutUrl);
      } catch (IOException e) {
        log.error("Error on send redirect to client", e);
      }
    }
    VaadinSession vaadinSession = VaadinSession.getCurrent();
    for (UI ui : vaadinSession.getUIs()) {
      if (ui != currentUi) {
        ui.access(() -> {
          ui.setContent(null);
          ui.getPage().setLocation(loggedOutUrl);
        });
      }
    }
  }
}

相关文章