@Test public void testIconForPathFolder() throws Exception { final Path f = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final NSImageIconCache cache = new NSImageIconCache(); NSImage icon = cache.fileIcon(f, 16); assertNotNull(icon); assertTrue(icon.isValid()); assertFalse(icon.isTemplate()); }
@Override public NSImage fileIcon(final Local file, final Integer size) { NSImage icon = null; if(file.exists()) { icon = this.load(file.getAbsolute(), size); if(null == icon) { return this.cache(file.getName(), this.convert(file.getName(), NSWorkspace.sharedWorkspace().iconForFile(file.getAbsolute()), size), size); } } if(null == icon) { return this.iconNamed("notfound.tiff", size); } return icon; }
NSImageIconCache implements IconCache<NSImage> { @Override public NSImage fileIcon(final Local file, final Integer size) { NSImage icon = null; if(file.exists()) { icon = this.load(file.getAbsolute(), size); if(null == icon) { return this.cache(file.getName(), this.convert(file.getName(), NSWorkspace.sharedWorkspace().iconForFile(file.getAbsolute()), size), size); } } if(null == icon) { return this.iconNamed("notfound.tiff", size); } return icon; } }
NSImageIconCache implements IconCache<NSImage> { @Override public NSImage fileIcon(final Local file, final Integer size) { NSImage icon = null; if(file.exists()) { icon = this.load(file.getAbsolute(), size); if(null == icon) { return this.cache(file.getName(), this.convert(file.getName(), NSWorkspace.sharedWorkspace().iconForFile(file.getAbsolute()), size), size); } } if(null == icon) { return this.iconNamed("notfound.tiff", size); } return icon; }  }
NSImageIconCache implements IconCache<NSImage> { @Override public NSImage fileIcon(final Local file, final Integer size) { NSImage icon = null; if(file.exists()) { icon = this.load(file.getAbsolute(), size); if(null == icon) { return this.cache(file.getName(), this.convert(file.getName(), NSWorkspace.sharedWorkspace().iconForFile(file.getAbsolute()), size), size); } } if(null == icon) { return this.iconNamed("notfound.tiff", size); } return icon; }  @Override NSImage documentIcon(final String extension, final Integer size); @Override NSImage documentIcon(final String extension, final Integer size, final NSImage badge); @Override NSImage folderIcon(final Integer size); @Override NSImage folderIcon(final Integer size, final NSImage badge); @Override NSImage iconNamed(final String name, final Integer width, final Integer height); @Override NSImage fileIcon(final Local file, final Integer size); @Override NSImage applicationIcon(final Application app, final Integer size); @Override NSImage fileIcon(final Path file, final Integer size); @Override NSImage aliasIcon(final String extension, final Integer size); }
NSImageIconCache implements IconCache<NSImage> { @Override public NSImage fileIcon(final Local file, final Integer size) { NSImage icon = null; if(file.exists()) { icon = this.load(file.getAbsolute(), size); if(null == icon) { return this.cache(file.getName(), this.convert(file.getName(), NSWorkspace.sharedWorkspace().iconForFile(file.getAbsolute()), size), size); } } if(null == icon) { return this.iconNamed("notfound.tiff", size); } return icon; }  @Override NSImage documentIcon(final String extension, final Integer size); @Override NSImage documentIcon(final String extension, final Integer size, final NSImage badge); @Override NSImage folderIcon(final Integer size); @Override NSImage folderIcon(final Integer size, final NSImage badge); @Override NSImage iconNamed(final String name, final Integer width, final Integer height); @Override NSImage fileIcon(final Local file, final Integer size); @Override NSImage applicationIcon(final Application app, final Integer size); @Override NSImage fileIcon(final Path file, final Integer size); @Override NSImage aliasIcon(final String extension, final Integer size);  }