javax.faces.model.ListDataModel Java Examples

The following examples show how to use javax.faces.model.ListDataModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MovieController.java    From tomee with Apache License 2.0 6 votes vote down vote up
public PaginationHelper getPagination() {
    if (pagination == null) {
        pagination = new PaginationHelper(10) {

            @Override
            public int getItemsCount() {
                return getFacade().count();
            }

            @Override
            public DataModel createPageDataModel() {
                return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem() + getPageSize()}));
            }
        };
    }
    return pagination;
}
 
Example #2
Source File: TabRepeat.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
public DataModel getDataModel() {
	if (this.model == null) {
		Object val = this.getValue();
		if (val == null) {
			this.model = EMPTY_MODEL;
		} else if (val instanceof DataModel) {
			// noinspection unchecked
			this.model = (DataModel<Object>) val;
		} else if (val instanceof List) {
			// noinspection unchecked
			this.model = new ListDataModel<Object>((List<Object>) val);
		} else if (Object[].class.isAssignableFrom(val.getClass())) {
			this.model = new ArrayDataModel<Object>((Object[]) val);
		} else if (val instanceof ResultSet) {
			this.model = new ResultSetDataModel((ResultSet) val);
		} else {
			this.model = new ScalarDataModel<Object>(val);
		}
	}
	return this.model;
}
 
Example #3
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByProperty() {
	tree.sortByProperty(this.getSortProperty(), this.getSortAscending());

	Collection objects = tree.getSortedObjects();
	ListDataModel model = new ListDataModel((List) objects);
	QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
			model);
	this.qpDataModel = qpDataModel;
}
 
Example #4
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevelTransferSelectedPools() {
	Collection<QuestionPoolDataIfc> objects = tree.getSortedObjects();

	// Construct the sortedList, pools need to be sorted one level at a time
	// so the hierachical structure can be maintained. Here, we start from root = 0,
	if (objects != null) {
		List<QuestionPoolDataIfc> sortedList = sortPoolByLevel(new Long("0"), objects,
				"title", true);
		ListDataModel model = new ListDataModel((List<QuestionPoolDataIfc>) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModelTransferSelected = qpDataModel;
	}
}
 
Example #5
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevelTransferPool() {
	Collection<QuestionPoolDataIfc> objects = tree.getSortedObjects();

	// Construct the sortedList, pools need to be sorted one level at a time
	// so the hierachical structure can be maintained. Here, we start from root = 0,
	if (objects != null) {
		List<QuestionPoolDataIfc> sortedList = sortPoolByLevel(new Long("0"), objects,
				getSortTransferPoolProperty(), getSortTransferPoolAscending());
		ListDataModel model = new ListDataModel((List<QuestionPoolDataIfc>) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModelTransfer = qpDataModel;
	}
}
 
Example #6
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setSubQpDataModelByLevel() {
	List subpools = (List) tree.getSortedObjects(getCurrentPool()
			.getId());
	if (subpools != null) {
		List sortedList = sortPoolByLevel(getCurrentPool().getId(),
				subpools, getSortSubPoolProperty(),
				getSortSubPoolAscending());

		ListDataModel model = new ListDataModel((List) sortedList);
		QuestionPoolDataModel subQpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.subQpDataModel = subQpDataModel;
	}
}
 
Example #7
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByPropertyCopy(String sortProperty, boolean sortAscending) {
	tree.sortByProperty(sortProperty, sortAscending);

	Collection objects = tree.getSortedObjects();
	ListDataModel model = new ListDataModel((List) objects);
	QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
			model);
	this.qpDataModelCopy = qpDataModel;
}
 
Example #8
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevelCopy(String sortProperty, boolean sortAscending) {
	Collection objects = tree.getSortedObjects();

	// construct the sortedList, pools need to be sorted one level at a time
	// so the hierachical structure can be maintained. Here, we start from root = 0,
	if (objects != null) {
		List sortedList = sortPoolByLevel(new Long("0"), objects,
				sortProperty, sortAscending);
		ListDataModel model = new ListDataModel((List) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModelCopy = qpDataModel;
	}
}
 
Example #9
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevel(Long poolId) {
	Collection objects = tree.getSortedObjects();

	if (objects != null) {
		List sortedList = sortPoolByLevel(poolId, objects,
				getSortProperty(), getSortAscending());
		ListDataModel model = new ListDataModel((List) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModel = qpDataModel;
	}
}
 
Example #10
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevel(Long poolId) {
	Collection objects = tree.getSortedObjects();

	if (objects != null) {
		List sortedList = sortPoolByLevel(poolId, objects,
				getSortProperty(), getSortAscending());
		ListDataModel model = new ListDataModel((List) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModel = qpDataModel;
	}
}
 
Example #11
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevelTransferSelectedPools() {
	Collection<QuestionPoolDataIfc> objects = tree.getSortedObjects();

	// Construct the sortedList, pools need to be sorted one level at a time
	// so the hierachical structure can be maintained. Here, we start from root = 0,
	if (objects != null) {
		List<QuestionPoolDataIfc> sortedList = sortPoolByLevel(new Long("0"), objects,
				"title", true);
		ListDataModel model = new ListDataModel((List<QuestionPoolDataIfc>) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModelTransferSelected = qpDataModel;
	}
}
 
Example #12
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevelTransferPool() {
	Collection<QuestionPoolDataIfc> objects = tree.getSortedObjects();

	// Construct the sortedList, pools need to be sorted one level at a time
	// so the hierachical structure can be maintained. Here, we start from root = 0,
	if (objects != null) {
		List<QuestionPoolDataIfc> sortedList = sortPoolByLevel(new Long("0"), objects,
				getSortTransferPoolProperty(), getSortTransferPoolAscending());
		ListDataModel model = new ListDataModel((List<QuestionPoolDataIfc>) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModelTransfer = qpDataModel;
	}
}
 
Example #13
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setSubQpDataModelByLevel() {
	List subpools = (List) tree.getSortedObjects(getCurrentPool()
			.getId());
	if (subpools != null) {
		List sortedList = sortPoolByLevel(getCurrentPool().getId(),
				subpools, getSortSubPoolProperty(),
				getSortSubPoolAscending());

		ListDataModel model = new ListDataModel((List) sortedList);
		QuestionPoolDataModel subQpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.subQpDataModel = subQpDataModel;
	}
}
 
Example #14
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByPropertyCopy(String sortProperty, boolean sortAscending) {
	tree.sortByProperty(sortProperty, sortAscending);

	Collection objects = tree.getSortedObjects();
	ListDataModel model = new ListDataModel((List) objects);
	QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
			model);
	this.qpDataModelCopy = qpDataModel;
}
 
Example #15
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByLevelCopy(String sortProperty, boolean sortAscending) {
	Collection objects = tree.getSortedObjects();

	// construct the sortedList, pools need to be sorted one level at a time
	// so the hierachical structure can be maintained. Here, we start from root = 0,
	if (objects != null) {
		List sortedList = sortPoolByLevel(new Long("0"), objects,
				sortProperty, sortAscending);
		ListDataModel model = new ListDataModel((List) sortedList);
		QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
				model);
		this.qpDataModelCopy = qpDataModel;
	}
}
 
Example #16
Source File: QuestionPoolBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void setQpDataModelByProperty() {
	tree.sortByProperty(this.getSortProperty(), this.getSortAscending());

	Collection objects = tree.getSortedObjects();
	ListDataModel model = new ListDataModel((List) objects);
	QuestionPoolDataModel qpDataModel = new QuestionPoolDataModel(tree,
			model);
	this.qpDataModel = qpDataModel;
}
 
Example #17
Source File: QueueControler.java    From jqm with Apache License 2.0 4 votes vote down vote up
public ListDataModel<Queue> getQueues()
{
    this.setWrappedData(JqmClientFactory.getClient().getQueues());
    return this;
}
 
Example #18
Source File: JobDefControler.java    From jqm with Apache License 2.0 4 votes vote down vote up
public ListDataModel<JobDef> getJobs()
{
    this.setWrappedData(JqmClientFactory.getClient().getJobDefinitions());
    return this;
}
 
Example #19
Source File: ActiveQueueControler.java    From jqm with Apache License 2.0 4 votes vote down vote up
public ListDataModel<JobInstance> getActiveJobs()
{
    List<JobInstance> jis = JqmClientFactory.getClient().getActiveJobs();
    this.setWrappedData(jis);
    return this;
}