19 package org.turro.file.zul.control;
22 import java.util.Collection;
24 import java.util.TreeSet;
25 import org.turro.string.Strings;
33 private String searchValue;
34 private boolean path, regexp, partial;
48 this.searchValue = searchValue;
72 this.partial = partial;
76 if(Strings.isBlank(searchValue))
return false;
80 return file.getAbsolutePath().matches(
".*" + searchValue +
".*");
82 return file.getAbsolutePath().matches(searchValue);
86 return file.getName().matches(
".*" + searchValue +
".*");
88 return file.getName().matches(searchValue);
94 return file.getAbsolutePath().matches(Strings.convertToRegEx(
"*" + searchValue +
"*"));
96 return file.getAbsolutePath().matches(Strings.convertToRegEx(searchValue));
100 return file.getName().matches(Strings.convertToRegEx(
"*" + searchValue +
"*"));
102 return file.getName().matches(Strings.convertToRegEx(searchValue));
109 Set<String> subdirs =
new TreeSet<>();
110 if(folder.exists()) {
111 for(File file : folder.listFiles()) {
112 if(file.isDirectory() && !file.isHidden()) {
113 subdirs.add(file.getName());
121 Set<File> files =
new TreeSet<>();
122 if(folder.exists()) {
123 for(File file : folder.listFiles()) {
124 if(file.isFile() && !file.isHidden()) {
125 if(
matches(file)) files.add(file);
133 Set<File> files =
new TreeSet<>();
134 if(folder.exists()) {
135 for(File file : folder.listFiles()) {
136 if(!file.isHidden()) {
137 if(file.isDirectory() ||
matches(file)) files.add(file);
Collection< String > getFolders(File folder)
void setPath(boolean path)
Collection< File > getFiles(File folder)
boolean matches(File file)
void setSearchValue(String searchValue)
Collection< File > getFileList(File folder)
void setPartial(boolean partial)
void setRegexp(boolean regexp)