View Javadoc

1   package org.whatsitcalled.webflange.webapp.model;
2   
3   import java.io.File;
4   import java.util.Arrays;
5   import java.util.Iterator;
6   import java.util.List;
7   
8   import org.apache.wicket.markup.repeater.data.IDataProvider;
9   import org.apache.wicket.model.IModel;
10  import org.whatsitcalled.webflange.ResourceFactory;
11  import org.whatsitcalled.webflange.model.Script;
12  
13  public class DataFileDataProvider implements IDataProvider{
14  
15  	public Iterator iterator(int first, int count) {
16  		File[] files = ResourceFactory.getFileManager().getUploadFolder().listFiles();
17  		List<File> fileList = Arrays.asList(files);
18  		return fileList.subList(first, first+count).iterator();
19  	}
20  
21  	public IModel model(Object object) {
22  		// TODO Auto-generated method stub
23  		return new DataFileDetachableModel((File)object);
24  	}
25  
26  	public int size() {
27  		return ResourceFactory.getFileManager().getUploadFolder().listFiles().length;
28  	}
29  
30  	public void detach() {
31  	}
32  
33  }