files = f.listFiles(filter);
}
List<FileModel> models = new ArrayList<FileModel>();
for (File f : files) {
FileModel m = null;
if (f.isDirectory()) {
m = new FolderModel(f.getName(), f.getAbsolutePath());
} else {
m = new FileModel(f.getName(), f.getAbsolutePath());
m.set("size", f.length());
m.set("date", new Date(f.lastModified()));
}
if (idMap.containsKey(f)) {
m.set("id", idMap.get(f));
} else {
String id = String.valueOf(counter++);
idMap.put(f, id);
m.set("id", id);
}
models.add(m);
}