View Javadoc

1   package org.whatsitcalled.webflange.webapp.model;
2   
3   import java.util.Iterator;
4   
5   import org.apache.wicket.markup.repeater.data.IDataProvider;
6   import org.apache.wicket.model.IModel;
7   import org.whatsitcalled.webflange.ResourceFactory;
8   import org.whatsitcalled.webflange.model.Project;
9   import org.whatsitcalled.webflange.model.ProjectDAO;
10  
11  public class ProjectDataProvider implements IDataProvider{
12  
13  	protected ProjectDAO getDAO() {
14  		return ResourceFactory.getProjectDAO();
15  	}
16  
17  	public Iterator iterator(int first, int count) {
18  		return getDAO().getProjects(first, count, "name").iterator();
19  	}
20  
21  	public IModel model(Object object) {
22  		// TODO Auto-generated method stub
23  		return new ProjectDetachableModel((Project)object);
24  	}
25  
26  	public int size() {
27  		return getDAO().getProjects().size();
28  	}
29  
30  	public void detach() {
31  	}
32  
33  }