当前位置: 首页>>代码示例>>Java>>正文


Java IconGenerator类代码示例

本文整理汇总了Java中com.vaadin.ui.IconGenerator的典型用法代码示例。如果您正苦于以下问题:Java IconGenerator类的具体用法?Java IconGenerator怎么用?Java IconGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IconGenerator类属于com.vaadin.ui包,在下文中一共展示了IconGenerator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
@Test
public void test() {
    Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2));
    Person p2 = new Person(2, "George", LocalDate.of(1991, Month.JUNE, 19));
    Person p3 = new Person(3, "Tim", LocalDate.of(1995, Month.APRIL, 7));

    List<Person> persons = Arrays.asList(p1, p2, p3);

    ItemCaptionGenerator<Person> captionGenerator = Person::getName;
    IconGenerator<Person> iconProvider = person -> VaadinIcons.USER;
    StyleGenerator<Person> styleGenerator = person -> "test";

    FTree<Person> tree = new FTree<Person>().withCaption("My Tree", true)
                                            .withContentMode(ContentMode.HTML)
                                            .withDescription("description", ContentMode.HTML)
                                            .withCollapseListener(event -> System.out.println("collapsed"))
                                            .withExpandListener(event -> System.out.println("expanded"))
                                            .withAutoRecalculateWidth(false)
                                            .withItemCaptionGenerator(captionGenerator)
                                            .withItemClickListener(event -> System.out.println("clicked"))
                                            .withItemIconGenerator(iconProvider)
                                            .withItems(persons)
                                            .withItemCollapseAllowedProvider(person -> person.getId() > 1)
                                            .withSelectionMode(SelectionMode.MULTI)
                                            .withSelectionListener(event -> System.out.println("selected"))
                                            .withRowHeight(14)
                                            .withStyleGenerator(styleGenerator)
                                            .withWidth("50%")
                                            .withId("treeId");

    assertEquals("My Tree", tree.getCaption());
    assertEquals("treeId", tree.getId());
    assertEquals("description", tree.getDescription());
    assertFalse(tree.isAutoRecalculateWidth());
    assertEquals(1, tree.getListeners(CollapseEvent.class).size());
    assertEquals(1, tree.getListeners(ExpandEvent.class).size());
    assertEquals(1, tree.getListeners(ItemClick.class).size());
    assertTrue(tree.getSelectionModel() instanceof MultiSelectionModel);
    assertEquals(captionGenerator, tree.getItemCaptionGenerator());
    assertEquals(iconProvider, tree.getItemIconGenerator());
    assertEquals(styleGenerator, tree.getStyleGenerator());
    assertEquals(50, tree.getWidth(), 0);
    assertEquals(Unit.PERCENTAGE, tree.getWidthUnits());
    assertTrue(tree.getDataProvider() instanceof HierarchicalDataProvider);
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:46,代码来源:FTreeTest.java

示例2: setItemIconGenerator

import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
@Override
public void setItemIconGenerator(final IconGenerator<T> itemIconGenerator) {
    super.setItemIconGenerator(itemIconGenerator);
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:5,代码来源:ComboBoxMultiselect.java

示例3: withItemIconGenerator

import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
/**
 * Sets the item icon generator that is used to produce custom icons for
 * items. The generator can return <code>null</code> for items with no icon.
 *
 * @see IconGenerator
 *
 * @param iconGenerator
 *            the item icon generator to set, not <code>null</code>
 * @return this for method chaining
 * @see Tree#setItemIconGenerator(IconGenerator)
 * @throws NullPointerException
 *             if {@code itemIconGenerator} is {@code null}
 */
@SuppressWarnings("unchecked")
public default THIS withItemIconGenerator(IconGenerator<ITEM> iconGenerator) {
    ((Tree<ITEM>) this).setItemIconGenerator(iconGenerator);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:19,代码来源:FluentTree.java

示例4: withItemIconGenerator

import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
/**
 * @see IconGenerator
 * @see AbstractListing#setItemIconGenerator(IconGenerator)
 *
 * @param itemIconGenerator
 *            the item icon generator to set, not null
 * @return this for method chaining
 */
@SuppressWarnings("unchecked")
public default THIS withItemIconGenerator(IconGenerator<ITEM> itemIconGenerator) {
    ((ComboBox<ITEM>) this).setItemIconGenerator(itemIconGenerator);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:14,代码来源:FluentComboBox.java

示例5: withItemIconGenerator

import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
/**
 * @see IconGenerator
 * @see AbstractListing#setItemIconGenerator(IconGenerator)
 *
 * @param itemIconGenerator
 *            the item icon generator to set, not null
 * @return this for method chaining
 */
@SuppressWarnings("unchecked")
public default THIS withItemIconGenerator(IconGenerator<VALUE> itemIconGenerator) {
    ((CheckBoxGroup<VALUE>) this).setItemIconGenerator(itemIconGenerator);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:14,代码来源:FluentCheckBoxGroup.java

示例6: withItemIconGenerator

import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
/**
 * @see IconGenerator
 * @see RadioButtonGroup#setItemIconGenerator(IconGenerator)
 *
 * @param itemIconGenerator
 *            the item icon generator to set, not null
 * @return this for method chaining
 */
@SuppressWarnings("unchecked")
public default THIS withItemIconGenerator(IconGenerator<ITEM> itemIconGenerator) {
    ((RadioButtonGroup<ITEM>) this).setItemIconGenerator(itemIconGenerator);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:14,代码来源:FluentRadioButtonGroup.java


注:本文中的com.vaadin.ui.IconGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。