當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。