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

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

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

Element.getNode介绍

暂无

代码示例

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

/**
 * Get the enabled state of the element.
 * <p>
 * Object may be enabled by itself by but if its ascendant is disabled then
 * it's considered as (implicitly) disabled.
 *
 *
 * @return {@code true} if node is enabled, {@code false} otherwise
 */
public boolean isEnabled() {
  return getNode().isEnabled();
}

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

/**
 * Checks whether this element represents a text node.
 *
 * @return <code>true</code> if this element is a text node; otherwise
 *         <code>false</code>
 */
public boolean isTextNode() {
  return getStateProvider().isTextNode(getNode());
}

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

/**
 * Gets the element visibility value.
 *
 * @return {@code true} if the element is visible, {@code false} otherwise
 */
public boolean isVisible() {
  return getStateProvider().isVisible(getNode());
}

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

/**
 * Gets the shadow root of the element, if any.
 *
 * @return an optional shadow root node, or an empty optional if no shadow
 *         root has been attached
 */
public Optional<ShadowRoot> getShadowRoot() {
  StateNode shadowRoot = getStateProvider().getShadowRoot(getNode());
  if (shadowRoot == null) {
    return Optional.empty();
  }
  return Optional.of(ShadowRoot.get(shadowRoot));
}

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

/**
 * Gets the style instance for managing element inline styles.
 *
 * @return the style object for the element
 */
public Style getStyle() {
  return getStateProvider().getStyle(getNode());
}

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

@Override
public void removeChild(StateNode node, Element child) {
  ElementChildrenList childrenFeature = getChildrenFeature(node);
  int pos = childrenFeature.indexOf(child.getNode());
  if (pos == -1) {
    throw new IllegalArgumentException("Not in the list");
  }
  childrenFeature.remove(pos);
}

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

@Override
public void appendVirtualChild(StateNode node, Element child, String type,
    String payload) {
  if (node.hasFeature(VirtualChildrenList.class)) {
    node.getFeature(VirtualChildrenList.class).append(child.getNode(),
        type, payload);
  } else {
    throw new UnsupportedOperationException();
  }
}

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

private void setupTemplate(Element owner, SimpleValueRendering rendering,
    DataKeyMapper<SOURCE> keyMapper) {
  owner.getNode()
      .runWhenAttached(ui -> ui.getInternals().getStateTree()
          .beforeClientResponse(owner.getNode(),
              context -> setupTemplateWhenAttached(owner,
                  rendering, keyMapper)));
}

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

/**
 * Runs the given action right before the next response during which this
 * element is attached.
 *
 * @param action
 *            the action to run
 */
private void runBeforeAttachedResponse(SerializableConsumer<UI> action) {
  getNode().runWhenAttached(
      ui -> ui.getInternals().getStateTree().beforeClientResponse(
          getNode(), context -> action.accept(context.getUI())));
}

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

/**
 * Sets the element visibility value.
 *
 * @param visible
 *            the element visibility value
 * @return this element
 */
public Element setVisible(boolean visible) {
  getStateProvider().setVisible(getNode(), visible);
  return getSelf();
}

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

@Override
public void insertChild(StateNode node, int index, Element child) {
  assert index >= 0;
  assert index <= getChildCount(node); // == if adding as last
  getChildrenFeature(node).add(index, child.getNode());
}

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

private Element setRawProperty(String name, Serializable value) {
  verifySetPropertyName(name);
  if ("innerHTML".equals(name)) {
    removeAllChildren();
  }
  getStateProvider().setProperty(getNode(), name, value, true);
  return this;
}

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

@Override
  public void accept(UI ui) {
    if (this == deferredJob) {
      String appId = ui.getInternals().getAppId();
      int nodeId = container.getNode().getId();
      String template = String.format(
          "<flow-component-renderer appid=\"%s\" nodeid=\"%s\"></flow-component-renderer>",
          appId, nodeId);
      templateElement.setProperty("innerHTML", template);
    }
  }
}

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

/**
 * Creates an element using the given tag name.
 *
 * @param tag
 *            the tag name of the element. Must be a non-empty string and
 *            can contain letters, numbers and dashes ({@literal -})
 */
public Element(String tag) {
  super(createStateNode(tag), BasicElementStateProvider.get());
  assert getNode() != null;
  assert getStateProvider() != null;
}

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

private void runBeforeClientResponse(SerializableConsumer<UI> command) {
    getElement().getNode().runWhenAttached(ui -> ui
        .beforeClientResponse(this, context -> command.accept(ui)));
  }
}

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

private void attachComponentTemplate() {
    deferredJob = new AttachComponentTemplate();
    getElement().getNode().runWhenAttached(ui -> ui
        .beforeClientResponse(this, context -> deferredJob.accept(ui)));
  }
}

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

private void ensureAttached() {
    if (getElement().getNode().getParent() == null) {
      UI ui = getCurrentUI();
      ui.beforeClientResponse(ui, context -> {
        ui.add(this);
        autoAddedToTheUi = true;
      });
    }
  }
}

代码示例来源:origin: com.vaadin/flow-component-demo-helpers

private void showTab(String tabUrl) {
  Div tab = tabComponents.get(tabUrl);
  if (tab != null) {
    container.removeAll();
    container.add(tab);
    navBar.setActive(getTabUrl(tabUrl));
    tab.getElement().getNode().runWhenAttached(ui -> ui.getPage()
        .executeJavaScript("Prism.highlightAll();"));
  }
}

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

@Override
protected void onAttach(AttachEvent attachEvent) {
  getElement().getNode().runWhenAttached(ui -> ui.beforeClientResponse(
      this,
      context -> ui.getPage().executeJavaScript(
          "$0.addEventListener('items-changed', "
              + "function(){ this.$server.updateSelectedTab(true); });",
          getElement())));
}

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

private static void execJS(Component component, String js) {
  StateNode node = component.getElement().getNode();
  node.runWhenAttached(ui -> ui.getInternals().getStateTree()
      .beforeClientResponse(node, context -> ui.getPage()
          .executeJavaScript(js, component.getElement())));
}

相关文章

微信公众号

最新文章

更多