本文整理汇总了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);
}
示例2: setItemIconGenerator
import com.vaadin.ui.IconGenerator; //导入依赖的package包/类
@Override
public void setItemIconGenerator(final IconGenerator<T> itemIconGenerator) {
super.setItemIconGenerator(itemIconGenerator);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}