class LimitedListProgressListener implements ListProgressListener {

    @Override
    public void chunk(final Path folder, final AttributedList<Path> list) throws ListCanceledException {
        if(folder.isRoot()) {
            if(list.size() >= container) {
                // Allow another chunk until limit is reached again
                container += preferences.getInteger("browser.list.limit.container");
                throw new ListCanceledException(list);
            }
        }
        if(list.size() >= directory) {
            // Allow another chunk until limit is reached again
            directory += preferences.getInteger("browser.list.limit.directory");
            throw new ListCanceledException(list);
        }
    }

    public  LimitedListProgressListener(final ProgressListener delegate);

}