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.Script;
9   import org.whatsitcalled.webflange.model.ScriptDAO;
10  
11  public class ScriptDataProvider implements IDataProvider{
12  
13  	protected ScriptDAO getDAO() {
14  		return ResourceFactory.getScriptDAO();
15  	}
16  
17  	public Iterator iterator(int first, int count) {
18  		return getDAO().getScripts(first, count, "name").iterator();
19  	}
20  
21  	public IModel model(Object object) {
22  		// TODO Auto-generated method stub
23  		return new ScriptDetachableModel((Script)object);
24  	}
25  
26  	public int size() {
27  		return getDAO().getScripts().size();
28  	}
29  
30  	public void detach() {
31  	}
32  
33  }