com.vaadin.flow.dom.Element.appendVirtualChild()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(257)

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

Element.appendVirtualChild介绍

暂无

代码示例

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

  1. /**
  2. * Adds a new {@link BrowserWindowResizeListener} to this UI. The listener
  3. * will be notified whenever the browser window within which this UI resides
  4. * is resized.
  5. *
  6. * @param resizeListener
  7. * the listener to add, not {@code null}
  8. * @return a registration object for removing the listener
  9. *
  10. * @see BrowserWindowResizeListener#browserWindowResized(BrowserWindowResizeEvent)
  11. * @see Registration
  12. */
  13. public Registration addBrowserWindowResizeListener(
  14. BrowserWindowResizeListener resizeListener) {
  15. Objects.requireNonNull(resizeListener);
  16. if (resizeReceiver == null) {
  17. // lazy creation which is done only one time since there is no way
  18. // to remove virtual children
  19. resizeReceiver = new ResizeEventReceiver();
  20. ui.getElement().appendVirtualChild(resizeReceiver.getElement());
  21. }
  22. if (resizeReceiver.windowResizeListenersSize == 0) {
  23. // JS resize listener may be completely disabled if there are not
  24. // listeners
  25. executeJavaScript(LazyJsLoader.WINDOW_LISTENER_JS, resizeReceiver);
  26. }
  27. return resizeReceiver.addListener(resizeListener);
  28. }

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

  1. private void initBaseElementsAndListeners() {
  2. getElement().appendChild(templateElement);
  3. getElement().appendVirtualChild(container);
  4. getElement().addEventListener("opened-changed", event -> {
  5. if (autoAddedToTheUi && !isOpened()) {
  6. getElement().removeFromParent();
  7. autoAddedToTheUi = false;
  8. }
  9. });
  10. }

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

  1. ui.getElement().appendVirtualChild(windowSizeReceiver.getElement());
  2. try {
  3. ui.getPage().executeJavaScript(

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

  1. owner.appendVirtualChild(container);
  2. rendering.setContainer(container);
  3. String templateInnerHtml;

代码示例来源:origin: com.vaadin/vaadin-context-menu-flow

  1. /**
  2. * Creates an empty context menu.
  3. */
  4. public ContextMenuBase() {
  5. container = new Element("div");
  6. getElement().appendVirtualChild(container);
  7. // Workaround for: https://github.com/vaadin/flow/issues/3496
  8. getElement().setProperty("opened", false);
  9. // Don't open the overlay immediately with any event, let
  10. // contextMenuConnector.js make a server round-trip first.
  11. setOpenOn("none");
  12. getElement().addEventListener("opened-changed", event -> {
  13. if (autoAddedToTheUi && !isOpened()) {
  14. getElement().removeFromParent();
  15. autoAddedToTheUi = false;
  16. }
  17. });
  18. addAttachListener(event -> resetContent());
  19. }

相关文章