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


Java LazyList.CountProvider方法代码示例

本文整理汇总了Java中org.vaadin.viritin.LazyList.CountProvider方法的典型用法代码示例。如果您正苦于以下问题:Java LazyList.CountProvider方法的具体用法?Java LazyList.CountProvider怎么用?Java LazyList.CountProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.vaadin.viritin.LazyList的用法示例。


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

示例1: getTestComponent

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {

    MGrid<Person> g = new MGrid<>(
            new LazyList.PagingProvider<Person>() {
                private static final long serialVersionUID = -9072230332041322210L;

                @Override
                public List<Person> findEntities(int firstRow) {
                    return Service.findAll(firstRow,
                            LazyList.DEFAULT_PAGE_SIZE);
                }
            },
            new LazyList.CountProvider() {
                private static final long serialVersionUID = -6915320247020779461L;

                @Override
                public int size() {
                    return (int) Service.count();
                }
            }
    );
    
    return g;
}
 
开发者ID:viritin,项目名称:viritin,代码行数:26,代码来源:GridLazyLoading.java

示例2: loadFrom

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
/**
 * Set a new strategies how to load options.
 *
 * @param filterablePagingProvider the paging provider that gives the actual
 * options in pages
 * @param filterableCountProvider the count provider to give the total about
 * of options with current filter
 * @param pageLength the length of the pages that component should use to
 * access providers
 */
public void loadFrom(FilterablePagingProvider<T> filterablePagingProvider, FilterableCountProvider filterableCountProvider, int pageLength) {
    this.fpp = filterablePagingProvider;
    this.fcp = filterableCountProvider;
    // Need to re-create the piggybackList & set container, some refactoring should be done here
    piggybackLazyList = new LazyList<>(new LazyList.PagingProvider<T>() {

        private static final long serialVersionUID = 1027614132444478021L;

        @Override
        public List<T> findEntities(int firstRow) {
            return fpp.findEntities(firstRow,
                    getCurrentFilter());
        }
    },
            new LazyList.CountProvider() {
        private static final long serialVersionUID = -7339189124024626177L;

        @Override
        public int size() {
            return fcp.size(getCurrentFilter());
        }
    }, pageLength);
    setBic(new DummyFilterableListContainer<T>(getType(),
            piggybackLazyList));
    getSelect().setContainerDataSource(getBic());
}
 
开发者ID:viritin,项目名称:viritin,代码行数:37,代码来源:LazyComboBox.java

示例3: getTestComponent

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
@Override
public Component getTestComponent() {
    pagingProvider = new LazyList.PagingProvider<Person>() {
        private static final long serialVersionUID = -9072230332041322210L;
        
        @Override
        public List<Person> findEntities(int firstRow) {
            return Service.findByFirstName(firstNameFilter, firstRow,
                    LazyList.DEFAULT_PAGE_SIZE);
        }
    };
    countProvider = new LazyList.CountProvider() {
        private static final long serialVersionUID = -6915320247020779461L;
        
        @Override
        public int size() {
            return (int) Service.countByFirstName(firstNameFilter);
        }
    };

    MGrid<Person> g = new MGrid<>(Person.class)
            .lazyLoadFrom(pagingProvider, countProvider);

    Grid.HeaderRow filteringHeader = g.appendHeaderRow();

    // Add new TextFields to each column which filters the data from
    // that column
    String columnId = "firstName";
    TextField filter = new MTextField()
            .withFullWidth().withStyleName(ValoTheme.TEXTFIELD_TINY)
            .withInputPrompt("Filter");
    filter.addTextChangeListener(event -> {
        firstNameFilter = event.getText();
        g.refreshRows();
    });
    filteringHeader.getCell(columnId).setComponent(filter);
    filteringHeader.getCell(columnId).setStyleName("filter-header");
    
    return g;
}
 
开发者ID:viritin,项目名称:viritin,代码行数:41,代码来源:GridLazyLoadingAndFiltering.java

示例4: lazyLoadFrom

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
/**
 * Makes the table lazy load its content with given strategy.
 *
 * @param pageProvider the interface via entities are fetched
 * @param countProvider the interface via the count of items is detected
 * @return this MTable object
 */
public MTable<T> lazyLoadFrom(
        SortableLazyList.SortablePagingProvider<T> pageProvider,
        LazyList.CountProvider countProvider) {
    setBeans(new SortableLazyList(pageProvider, countProvider,
            DEFAULT_PAGE_SIZE));
    return this;
}
 
开发者ID:viritin,项目名称:viritin,代码行数:15,代码来源:MTable.java

示例5: lazyLoadFrom

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
/**
 * Makes the table lazy load its content with given strategy.
 *
 * @param pageProvider the interface via entities are fetched
 * @param countProvider the interface via the count of items is detected
 * @return this MTable object
 */
public MGrid<T> lazyLoadFrom(
        SortableLazyList.MultiSortablePagingProvider<T> pageProvider,
        LazyList.CountProvider countProvider) {
    setRows(new SortableLazyList(pageProvider, countProvider,
            DEFAULT_PAGE_SIZE));
    ensureSortListener();
    return this;
}
 
开发者ID:viritin,项目名称:viritin,代码行数:16,代码来源:MGrid.java

示例6: MTable

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
/**
 * A shorthand to create MTable using SortableLazyList.
 *
 * @param rowType the type of entities listed in the table
 * @param pageProvider the interface via entities are fetched
 * @param countProvider the interface via the count of items is detected
 * @param pageSize the page size (aka maxResults) that is used in paging.
 */
public MTable(Class<T> rowType,
        SortableLazyList.SortablePagingProvider<T> pageProvider,
        LazyList.CountProvider countProvider, int pageSize) {
    this(rowType);
    lazyLoadFrom(pageProvider, countProvider, pageSize);
}
 
开发者ID:viritin,项目名称:viritin,代码行数:15,代码来源:MTable.java

示例7: MGrid

import org.vaadin.viritin.LazyList; //导入方法依赖的package包/类
/**
 * A shorthand to create MGrid using LazyList. By default page size of
 * LazyList.DEFAULT_PAGE_SIZE (30) is used.
 *
 * @param pageProvider the interface via entities are fetched
 * @param countProvider the interface via the count of items is detected
 */
public MGrid(LazyList.PagingProvider<T> pageProvider,
        LazyList.CountProvider countProvider) {
    this(new LazyList<T>(pageProvider, countProvider, DEFAULT_PAGE_SIZE));
}
 
开发者ID:viritin,项目名称:viritin,代码行数:12,代码来源:MGrid.java


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