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


Java LazyDataModel类代码示例

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


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

示例1: init

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
@PostConstruct
private void init(){
    //initialize user acc
    userAcc = usb.getUser();
    model = new LazyDataModel<Job>() {
        private static final long serialVersionUID = 1L;

        @Override
        public List<Job> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
            List<Job> jobs;
            int count;
            if (showAll && isAdminPrivileges()){
                jobs = jobFacade.findAllJobsPaginated(first, pageSize);
                count = jobFacade.count();
            } else {
                jobs = jobFacade.findUserJobsPaginated(userAcc, first, pageSize);//sorting and filtering will not be used
                count = (int)(long)jobFacade.countUserJobs(userAcc);
            }
            model.setRowCount(count);
            return jobs;
        }
    
        
    };
}
 
开发者ID:vodev,项目名称:vocloud,代码行数:26,代码来源:JobListBean.java

示例2: init

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
@PostConstruct
private void init() {
    ssapModels = new HashMap<>();
    ssapStatistics = new HashMap<>();
    model = new LazyDataModel<DownloadJob>() {
        private static final long serialVersionUID = 1L;

        @Override
        public List<DownloadJob> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
            List<DownloadJob> jobs = djf.findAllJobsPaginated(first, pageSize);//sorting and filtering will not be used
            model.setRowCount(djf.count());
            return jobs;
        }

    };
}
 
开发者ID:vodev,项目名称:vocloud,代码行数:17,代码来源:DownloadQueueBean.java

示例3: init

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
@PostConstruct
public void init() {
    logger.debug("Fetching the first page of entities ...");
    dataModel = new LazyDataModel<Person>() {
        @Override
        public List<Person> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
            PersonQuery personQuery = getQuery(sortField, sortOrder, filters);
            QuerySearchResult<Person> querySearchResult = persistenceService.fetch(personQuery, first, pageSize);

            List<Person> result = querySearchResult.getRecords();

            if (logger.isDebugEnabled()) {
                logger.debug("Fetched {} entities", result.size());
            }

            return result;
        }
    };

    PersonQuery personQuery = getQuery(null, null, null);
    long count = persistenceService.count(personQuery);
    logger.debug("Found a total of {} entities", count);
    dataModel.setRowCount(Long.valueOf(count).intValue());
}
 
开发者ID:satrapu,项目名称:church-management-jee,代码行数:25,代码来源:PersonList.java

示例4: getLazyEntities

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
/**
 * Getter for lazyEntities.
 * 
 * @return Primefaces lazy data model for use with a lazy p:dataTable component.
 */
public LazyDataModel<T> getLazyEntities() {
	if (lazyEntities == null) {
		count();
		lazyEntities = new PrimefacesLazyEntityDataModel<T>(getListingService().getDAO()) {
			/** Serialization id. */
			private static final long serialVersionUID = 1117380513193004406L;

			/**
			 * @see org.primefaces.model.LazyDataModel#load(int, int, java.lang.String, org.primefaces.model.SortOrder,
			 *      java.util.Map)
			 */
			@Override
			public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
				firstEntityIndex = first;
				lastEntityIndex = first + pageSize;
				retrieveEntities();
				return entities;
			}
		};
		lazyEntities.setRowCount((int) entityCount);
	}

	return lazyEntities;
}
 
开发者ID:nemo-ufes,项目名称:nemo-utils,代码行数:30,代码来源:ListingController.java

示例5: fetchLazySSAPModel

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
public LazyDataModel<SSAPDownloadJobItem> fetchLazySSAPModel(final DownloadJob job) {
    if (job == null) {
        throw new IllegalArgumentException("passed job argument is null");
    }
    if (!(job instanceof SSAPDownloadJob)){
        return null;//no lazy data model
    }
    LazyDataModel<SSAPDownloadJobItem> tmpModel = ssapModels.get(job);
    if (tmpModel == null) {
        //create new one
        tmpModel = new LazyDataModel<SSAPDownloadJobItem>() {
            private static final long serialVersionUID = 1L;

            @Override
            public List<SSAPDownloadJobItem> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
                List<SSAPDownloadJobItem> jobs = djf.findAllSSAPItemsPaginated(job, first, pageSize);
                this.setRowCount((int) djf.countSSAPItems(job));
                return jobs;
            }
        };
        ssapModels.put(job, tmpModel);
        int finished = (int) djf.countFinishedSSAPItems(job);
        int failed = (int) djf.countFailedSSAPItems(job);
        ssapStatistics.put(job, new Statistics(finished, failed));
    }
    return tmpModel;
}
 
开发者ID:vodev,项目名称:vocloud,代码行数:28,代码来源:DownloadQueueBean.java

示例6: loadProductsModel

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
private void loadProductsModel() {
	products = new LazyDataModel<Product>() {
		private static final long serialVersionUID = 2895456264073910183L;

		@Override
		public List<Product> load(int first, int pageSize, String sortField, SortOrder sortOrder,
				Map<String, Object> filters) {
			return getProducts(first, pageSize);
		}

		@Override
		public List<Product> load(int first, int pageSize, List<SortMeta> multiSortMeta, Map<String, Object> filters) {
			return getProducts(first, pageSize);
		}

		private List<Product> getProducts(int first, int pageSize) {
			List<Product> products = new ArrayList<>();

			for (Product product : productMgt.getProductsList(first, pageSize)) {
				product = productMgt.loadCategories(product);
				products.add(product);
			}

			return products;
		}

	};

	int produtosCount = productMgt.getTotalProducts();
	products.setRowCount(produtosCount);
}
 
开发者ID:raphaelazzolini,项目名称:mercurius,代码行数:32,代码来源:ProductsAdminMBean.java

示例7: lazyLoad

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
public void lazyLoad() {
	lazyModel = new LazyDataModel<Product>() {
		@Override
		public List<Product> load(int first, int pageSize,
				String sortField, SortOrder sortOrder,
				Map<String, Object> filters) {
			String sortOrderValue = null;
			if (sortField == null) {
				sortField = "prodname";
			}
			if (sortOrder.ASCENDING.equals("A")) {
				sortOrderValue = "ASC";
			} else if (sortOrder.DESCENDING.equals("D")) {
				sortOrderValue = "DSC";
			} else {
				sortOrderValue = "ASC";
			}

			productsInfo = dao.getAllProducts(first, pageSize, sortField,
					sortOrderValue, filters);
			// rowCount
			int dataSize = productsInfo.size();
			this.setRowCount(dataSize);
			// paginate
			if (dataSize > pageSize) {
				try {
					return productsInfo.subList(first,first + pageSize);
				} catch (IndexOutOfBoundsException e) {
					return productsInfo.subList(first,first + (dataSize % pageSize));
				}
			} else {
				return productsInfo;
			}
		}
	};
}
 
开发者ID:sudheerj,项目名称:primefaces-blueprints,代码行数:37,代码来源:HealthkartController.java

示例8: lazyLoad

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
public void lazyLoad() {
    lazyModel = new LazyDataModel<UserPost>() {
        @Override
        public List<UserPost> load(int first, int pageSize,
                                  String sortField, SortOrder sortOrder,
                                  Map<String, Object> filters) {
        String sortOrderValue = null;
        if (sortField == null) {
            sortField = "prodname";
        }
        if (sortOrder.ASCENDING.equals("A")) {
            sortOrderValue = "ASC";
        } else if (sortOrder.DESCENDING.equals("D")) {
            sortOrderValue = "DSC";
        } else {
            sortOrderValue = "ASC";
        }
        myPosts = getAllMyPosts();
        //productsInfo = dao.getAllProducts(first, pageSize, sortField, sortOrderValue, filters);
        // rowCount
        int dataSize = myPosts.size();
        this.setRowCount(dataSize);
        // paginate
        if (dataSize > pageSize) {
            try {
                return myPosts.subList(first,first + pageSize);
            } catch (IndexOutOfBoundsException e) {
                return myPosts.subList(first,first + (dataSize % pageSize));
            }
        } else {
            return myPosts;
        }
        }
    };
}
 
开发者ID:sudheerj,项目名称:primefaces-blueprints,代码行数:36,代码来源:UserController.java

示例9: init

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
@PostConstruct
public void init() {

	lazyAccSummaryDataModel = new LazyDataModel<AccountSummary>() {
		@Override
		public List<AccountSummary> load(int first, int pageSize,
				String sortField, SortOrder sortOrder,
				Map<String, Object> filters) {

			String sortOrderValue = null;
			if (sortField == null) {
				sortField = "investorName";
			}
			if (sortOrder.ASCENDING.equals("A")) {
				sortOrderValue = "ASC";
			} else if (sortOrder.DESCENDING.equals("D")) {
				sortOrderValue = "DSC";
			} else {
				sortOrderValue = "default";
			}

			accountsInfo = dao.getAllAccounts(first, pageSize, sortField,
					sortOrderValue, filters);
			this.setRowCount(20);
			return accountsInfo;
		}
	};
}
 
开发者ID:sudheerj,项目名称:primefaces-blueprints,代码行数:29,代码来源:AccountSummaryController.java

示例10: getSupportedCompliances

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
public List<String> getSupportedCompliances(){
	if(((LazyDataModel)data.getValue()).getRowIndex()<0){
		return Collections.EMPTY_LIST;
	}
	
	DataSet ds = (DataSet) ((LazyDataModel)data.getValue()).getRowData();
	List<String> result = new ArrayList<String>();
	for(Compliance compliance: dataSetService.getSupportedCompliances()){
		if(ds.getComplianceUUIDs().contains(compliance.getUuid())){
			result.add(compliance.getName());
		}
	}
	return result;
}
 
开发者ID:PE-INTERNATIONAL,项目名称:soda4lca,代码行数:15,代码来源:ListDatasetsBean.java

示例11: testFindWithPrecondition

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
@Test
	public void testFindWithPrecondition(){
		SearchParameters sp = new SearchParameters();
		sp.addFilter(Node_.status.getName(), NodeStatus.NOT_APPROVED);
		
		LazyDataModel<Node> model = new ILCDLazyDataModel<Node>(nodeService, sp);
		model.setPageSize(2);
//		Assert.assertEquals(7, model.getRowCount());
	}
 
开发者ID:PE-INTERNATIONAL,项目名称:soda4lca,代码行数:10,代码来源:ILCDLazyDataModelTest.java

示例12: getActiveJobs

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
public LazyDataModel<JobInstance> getActiveJobs()
{
    System.out.println("1");
    List<JobInstance> jis = JqmClientFactory.getClient().getActiveJobs();
    System.out.println("2 - " + jis.size());
    this.setWrappedData(jis);
    System.out.println("3");
    this.setRowCount(jis.size());
    return this;
}
 
开发者ID:enioka,项目名称:jqm,代码行数:11,代码来源:JobInstanceControler.java

示例13: getListaEntidadesPaginada

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
/**
 * @return lista paginada
 */
public LazyDataModel<T> getListaEntidadesPaginada() {
	if (listaEntidadesPaginada == null) {
		carregarListaPaginada();
	}
	return listaEntidadesPaginada;
}
 
开发者ID:marciopalheta,项目名称:cursosandroid,代码行数:10,代码来源:GenericMB.java

示例14: init

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
@PostConstruct
public void init() {
    @SuppressWarnings("unchecked")
    final Class<T> clazz = entityClass;
    data = new LazyDataModel<T>() {
        private static final long serialVersionUID = 1L;

        @Override
        public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
            return persistenceService.fetch(clazz, first, pageSize);
        }
    };

    data.setRowCount((int) persistenceService.count(entityClass));
}
 
开发者ID:satrapu,项目名称:home-budget,代码行数:16,代码来源:EntityList.java

示例15: getLazyDataModel

import org.primefaces.model.LazyDataModel; //导入依赖的package包/类
public LazyDataModel<Modelo> getLazyDataModel() {
	if (lazyDataModel == null) {
		String jpql = "select m from Modelo m";
		lazyDataModel = new QueryDataModel<Modelo>(jpql);
	}

	return lazyDataModel;
}
 
开发者ID:joedayz,项目名称:javaee7-samples,代码行数:9,代码来源:ModeloBean.java


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