예제 #1
0
    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);
    }
예제 #2
0
 public void onFileNavigation(FileSystemItem file) {
   if (file.isDirectory()) {
     navigateToDirectory(file);
   } else {
     navigateToFile(file);
   }
 }
예제 #3
0
  public ImageResource getIconForFile(FileSystemItem file) {
    if (file.isDirectory()) {
      if (file.isPublicFolder()) return ICONS.iconPublicFolder();
      else return ICONS.iconFolder();
    }

    return getIconForFilename(file.getName());
  }
예제 #4
0
  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());
  }
예제 #5
0
  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);
    }
  }