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