@Test public void testIconForFileTxtType() throws Exception { final Local f = new FinderLocal(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString() + ".txt"); final NSImageIconCache cache = new NSImageIconCache(); NSImage icon = cache.fileIcon(f, 16); assertNull(icon); LocalTouchFactory.get().touch(f); icon = cache.fileIcon(f, 16); assertNotNull(icon); assertTrue(icon.isValid()); assertFalse(icon.isTemplate()); f.delete(); }
@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);  }