public class CustomPrinterIconCache extends Object
Constructor and Description |
---|
CustomPrinterIconCache(File cacheDirectory)
Create a new icon cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all persisted and non-persisted state from this cache.
|
Icon |
getIcon(PrinterId printerId)
Get the
Icon to be used as a custom icon for the printer. |
void |
onCustomPrinterIconLoaded(PrinterId printerId,
Icon icon)
Handle that a custom icon for a printer was loaded
|
void |
removeOldFiles(int numFilesToKeep)
Remove old icons so that only between numFilesToKeep and twice as many icons are left.
|
public CustomPrinterIconCache(File cacheDirectory)
public Icon getIcon(PrinterId printerId)
Icon
to be used as a custom icon for the printer. If not available request
the icon to be loaded.printerId
- the printer the icon belongs toIcon
if already available or null if icon is not loaded yetpublic void removeOldFiles(int numFilesToKeep)
numFilesToKeep
- the number of icons to keeppublic void onCustomPrinterIconLoaded(PrinterId printerId, Icon icon)
printerId
- the id of the printer the icon belongs toicon
- the icon that was loadedpublic void clear()