/** * Returns the current folder's children. The returned array contains {@link AbstractFile} instances, and not * CachedFile instances contrary to {@link #getCachedFiles()}. * * @return the current folder's children * @see #getCachedFiles() */ public synchronized AbstractFile[] getFiles() { int nbFiles = cachedFiles.length; AbstractFile[] files = new AbstractFile[nbFiles]; for(int i=0; i<nbFiles; i++) files[i] = cachedFiles[i]==null?null:((CachedFile)cachedFiles[i]).getProxiedFile(); return files; }
/** * Returns the file located at the given index, not including the parent file. * Returns <code>null</code> if fileIndex is lower than 0 or is greater than or equals {@link #getFileCount() getFileCount()}. * * @param fileIndex index of a file, comprised between 0 and #getFileCount() * @return the file located at the given index, not including the parent file */ public synchronized AbstractFile getFileAt(int fileIndex) { // Need to check that row index is not larger than actual number of rows // because if table has just been changed (rows have been removed), // JTable may have an old row count value and may try to repaint rows that are out of bounds. if(fileIndex>=0 && fileIndex<fileArrayIndex.length) { return ((CachedFile)cachedFiles[fileArrayIndex[fileIndex]]).getProxiedFile(); } return null; }
/** * Returns the file located at the given row index. * This method can return the parent folder file ('..') if a parent exists and rowIndex is 0. * * <p>Returns <code>null</code> if rowIndex is lower than 0 or is greater than or equals * {@link #getRowCount() getRowCount()}.</p> * * @param rowIndex a row index, comprised between 0 and #getRowCount() * @return the file located at the given row index */ public synchronized AbstractFile getFileAtRow(int rowIndex) { AbstractFile file = getCachedFileAtRow(rowIndex); if(file==null) return null; else if(file instanceof CachedFile) return ((CachedFile)file).getProxiedFile(); else return file; }
public ChangeFolderThread(AbstractFile folder, boolean findWorkableFolder, boolean changeLockedTab) { // Ensure that we work on a raw file instance and not a cached one this.folder = (folder instanceof CachedFile)?((CachedFile)folder).getProxiedFile():folder; this.folderURL = folder.getURL(); this.findWorkableFolder = findWorkableFolder; this.changeLockedTab = changeLockedTab; setPriority(Thread.MAX_PRIORITY); }