code: private static int _fillQueryNames(Query query, Resource directory, ResourceFilter filter, int count) throws PageException {
  	if (filter == null || filter instanceof ResourceNameFilter) {
  	    ResourceNameFilter rnf = filter == null ? null : (ResourceNameFilter) filter;
  	    String[] list = directory.list();
  	    if (list == null || list.length == 0) return count;
  	    for (int i = 0; i < list.length; i++) {
  		if (rnf == null || rnf.accept(directory, list[i])) {
  		    query.addRow(1);
  		    count++;
  		    query.setAt(KeyConstants._name, count, list[i]);
  		}
  	    }
  	}
  	else {
  	    Resource[] list = directory.listResources();
  	    if (list == null || list.length == 0) return count;
  	    for (int i = 0; i < list.length; i++) {
  		if (filter == null || filter.accept(list[i])) {
  		    query.addRow(1);
  		    count++;
  		    query.setAt(KeyConstants._name, count, list[i].getName());
  		}
  	    }
  	}
  	return count;
      }
docs: this method only exists for performance reason