/** * Returns <code>true</code> if the specified file matches the association. * @param file file to match against the association. * @return <code>true</code> if the specified file matches the association, <code>false</code> otherwise. */ public boolean accept(AbstractFile file) {return fileFilter.match(file);}
/** * Calls {@link #match(com.mucommander.commons.file.AbstractFile)} on each of the registered filters, and returns * <code>true</code> if all of them matched the given file, <code>false</code> if one of them didn't. * * <p>If this {@link ChainedFileFilter} contains no filter, this method will always return <code>true</code>.</p> * * @param file the file to test against the registered filters * @return if the file was matched by all filters, false if one of them didn't */ public boolean accept(AbstractFile file) { int nbFilters = filters.size(); for(int i=0; i<nbFilters; i++) if(!filters.elementAt(i).match(file)) return false; return true; } }
/** * Calls {@link #match(com.mucommander.commons.file.AbstractFile)} on each of the registered filters, and returns * <code>true</code> if one of them matched the given file, <code>false</code> if none of them did. * * <p>If this {@link ChainedFileFilter} contains no filter, this method will always return <code>true</code>.</p> * * @param file the file to test against the registered filters * @return if the file was matched by one filter, false if none of them did */ public boolean accept(AbstractFile file) { int nbFilters = filters.size(); if(nbFilters==0) return true; for(int i=0; i<nbFilters; i++) if((filters.elementAt(i)).match(file)) return true; return false; } }
@Override protected boolean getFileTableCondition(FileTable fileTable) { AbstractFile selectedFile = fileTable.getSelectedFile(false, true); boolean enable = selectedFile!=null; if(enable && filter!=null) enable = filter.match(selectedFile); return enable; } }
/** * Marks/unmarks the files that match the given {@link FileFilter}. * * @param filter the FileFilter to match the files against * @param marked if true, matching files will be marked, if false, they will be unmarked */ public synchronized void setFilesMarked(FileFilter filter, boolean marked) { int nbFiles = getRowCount(); for(int i=parent==null?0:1; i<nbFiles; i++) { if(filter.match(getCachedFileAtRow(i))) setRowMarked(i, marked); } }