protected int doCompare(FileSystemItem arg0, FileSystemItem arg1) { int ascendingResult = activeSortColumnAscending_ ? 1 : -1; if (arg0.isDirectory() && !arg1.isDirectory()) return ascendingResult * sortFactor_; else if (arg1.isDirectory() && !arg0.isDirectory()) return -ascendingResult * sortFactor_; else return doItemCompare(arg0, arg1); }
public void onFileNavigation(FileSystemItem file) { if (file.isDirectory()) { navigateToDirectory(file); } else { navigateToFile(file); } }
public ImageResource getIconForFile(FileSystemItem file) { if (file.isDirectory()) { if (file.isPublicFolder()) return ICONS.iconPublicFolder(); else return ICONS.iconFolder(); } return getIconForFilename(file.getName()); }
public final int compareTo(FileSystemItem other) { // If we ever need to compare files that don't share the same // parent, then maybe we would need to compare parent directory // before anything else. if (isDirectory() ^ other.isDirectory()) return isDirectory() ? -1 : 1; return String.CASE_INSENSITIVE_ORDER.compare(getPath(), other.getPath()); }
void openFile(String filePath) { // get the file system item FileSystemItem file = FileSystemItem.createFile(filePath); // don't open directories (these can sneak in if the user // passes a directory on the command line) if (!file.isDirectory()) { // open the file. pass false for second param to prevent // the default handler (the browser) from taking it fileTypeRegistry_.openFile(file, false); } }