Exemple #1
0
 public NSImage iconForPath(final Path item, final Integer size, final boolean overlay) {
   if (item.attributes().isSymbolicLink()) {
     final NSImage badge = this.iconForName("aliasbadge.tiff", size);
     badge.setName("aliasbadge");
     if (item.attributes().isDirectory()) {
       return this.iconForFolder(badge, size);
     }
     return this.iconForExtension(badge, item.getExtension(), size);
   }
   if (item.attributes().isFile()) {
     if (StringUtils.isEmpty(item.getExtension())) {
       if (item.attributes().getPermission().isExecutable()) {
         return this.iconForName("executable.tiff", size);
       }
     }
     return this.iconForExtension(item.getExtension(), size);
   }
   if (item.attributes().isVolume()) {
     return this.iconForName(item.getHost().getProtocol().disk(), size);
   }
   if (item.attributes().isDirectory()) {
     if (overlay) {
       if (!item.attributes().getPermission().isExecutable()) {
         final NSImage badge = this.iconForName("privatefolderbadge.tiff", size);
         badge.setName("privatefolderbadge");
         return this.iconForFolder(badge, size);
       }
       if (!item.attributes().getPermission().isReadable()) {
         if (item.attributes().getPermission().isWritable()) {
           final NSImage badge = this.iconForName("dropfolderbadge.tiff", size);
           badge.setName("dropfolderbadge");
           return this.iconForFolder(badge, size);
         }
       }
       if (!item.attributes().getPermission().isWritable()) {
         final NSImage badge = this.iconForName("readonlyfolderbadge.tiff", size);
         badge.setName("readonlyfolderbadge");
         return this.iconForFolder(badge, size);
       }
     }
     return this.iconForFolder(size);
   }
   return this.iconForName("notfound.tiff", size);
 }
 /**
  * @param files Files to purge
  * @param recursive Recursivly for folders
  * @return Key to files
  */
 protected List<String> getInvalidationKeys(List<Path> files, boolean recursive) {
   List<String> keys = new ArrayList<String>();
   for (Path file : files) {
     if (file.isContainer()) {
       keys.add(String.valueOf(Path.DELIMITER));
     } else {
       keys.add(file.getKey());
     }
     if (file.attributes().isDirectory()) {
       if (recursive) {
         keys.addAll(this.getInvalidationKeys(file.children(), recursive));
       }
     }
   }
   return keys;
 }