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

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

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

Element.getThemeList介绍

[英]Gets the set of the theme names applied to the corresponding element in theme attribute. The set returned can be modified to add or remove the theme names, changes to the set will be reflected in the attribute value.

Despite the name implying a list being returned, the return type is actually a Set since the in-browser return value behaves like a Set in Java.
[中]获取应用于主题属性中相应元素的主题名称集。可以修改返回的集合以添加或删除主题名称,对集合的更改将反映在属性值中。
尽管名称暗示返回列表,但返回类型实际上是一个集合,因为浏览器中的返回值的行为类似于Java中的集合。

代码示例

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

/**
 * Gets the set of theme names used for this element. The returned set can
 * be modified to add or remove theme names. The contents of the set is also
 * reflected in the value of the <code>theme</code> attribute.
 *
 * @see Element#getThemeList()
 *
 * @return a list of theme names, never <code>null</code>
 */
default ThemeList getThemeNames() {
  return getElement().getThemeList();
}

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

/**
 * Gets the set of the theme names applied to the corresponding element in
 * {@code theme} attribute. The set returned can be modified to add or
 * remove the theme names, changes to the set will be reflected in the
 * attribute value.
 * <p>
 * Despite the name implying a list being returned, the return type is
 * actually a {@link Set} since the in-browser return value behaves like a
 * {@link Set} in Java.
 *
 * @return a list of theme names, never {@code null}
 */
default ThemeList getThemeList() {
  return getElement().getThemeList();
}

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

@Override
public DefaultFlexComponentConfigurator<C> withThemeName(String themName) {
  component.getElement().getThemeList().add(themName);
  return this;
}

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

@Override
public BaseComponentConfigurator withThemeName(String themName) {
  component.getElement().getThemeList().add(themName);
  return this;
}

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

/**
 * An action which toggles {@code theme} on the target based on its
 * highlight state.
 *
 * @param <C>
 *            the target type
 * @param theme
 *            the theme to toggle
 * @return the highlight action
 */
public static <C extends HasElement> HighlightAction<C> toggleTheme(
    String theme) {
  return (component, highlight) -> component.getElement().getThemeList()
      .set(theme, highlight);
}

代码示例来源:origin: spring-guides/gs-crud-with-vaadin

@Autowired
public CustomerEditor(CustomerRepository repository) {
  this.repository = repository;
  add(firstName, lastName, actions);
  // bind using naming convention
  binder.bindInstanceFields(this);
  // Configure and style components
  setSpacing(true);
  save.getElement().getThemeList().add("primary");
  delete.getElement().getThemeList().add("error");
  addKeyPressListener(Key.ENTER, e -> save());
  // wire action buttons to save, delete and reset
  save.addClickListener(e -> save());
  delete.addClickListener(e -> delete());
  cancel.addClickListener(e -> editCustomer(customer));
  setVisible(false);
}

相关文章

微信公众号

最新文章

更多