com.mucommander.ui.icon
Class CustomFileIconProvider

java.lang.Object
  extended by com.mucommander.ui.icon.CustomFileIconProvider
All Implemented Interfaces:
FileIconProvider

public class CustomFileIconProvider
extends java.lang.Object
implements FileIconProvider

This FileIconProvider returns icons from the IconManager's custom file icon set, based on files' extension and type. No caching is performed by this class as IconManager already takes care of this.

Author:
Maxence Bernard

Field Summary
static java.lang.String ARCHIVE_ICON_NAME
          Icon for supported archives (browsable)
static java.lang.String FILE_ICON_NAME
          Default icon for files without a known extension
static java.lang.String FOLDER_ICON_NAME
          Icon for directories
static java.lang.String MAC_OS_X_APP_ICON_NAME
          Icon for Mac OS X's applications
static java.lang.String NETWORK_ICON_NAME
          Icon for the root of remote (non-local) locations
static java.lang.String NOT_ACCESSIBLE_FILE
          Icon for not accessible files (used for quick-lists)
static java.lang.String PARENT_FOLDER_ICON_NAME
          Icon for parent folder (..)
static java.lang.String SYMLINK_ICON_NAME
          Transparent icon symbolizing symlinks, painted over an existing icon
 
Constructor Summary
CustomFileIconProvider()
           
 
Method Summary
 javax.swing.Icon getFileIcon(AbstractFile file, java.awt.Dimension preferredResolution)
          Returns an icon for the given file, or null if it couldn't be retrieved, either because the given file doesn't exist or for any other reason.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOLDER_ICON_NAME

public static final java.lang.String FOLDER_ICON_NAME
Icon for directories

See Also:
Constant Field Values

FILE_ICON_NAME

public static final java.lang.String FILE_ICON_NAME
Default icon for files without a known extension

See Also:
Constant Field Values

ARCHIVE_ICON_NAME

public static final java.lang.String ARCHIVE_ICON_NAME
Icon for supported archives (browsable)

See Also:
Constant Field Values

PARENT_FOLDER_ICON_NAME

public static final java.lang.String PARENT_FOLDER_ICON_NAME
Icon for parent folder (..)

See Also:
Constant Field Values

SYMLINK_ICON_NAME

public static final java.lang.String SYMLINK_ICON_NAME
Transparent icon symbolizing symlinks, painted over an existing icon

See Also:
Constant Field Values

MAC_OS_X_APP_ICON_NAME

public static final java.lang.String MAC_OS_X_APP_ICON_NAME
Icon for Mac OS X's applications

See Also:
Constant Field Values

NETWORK_ICON_NAME

public static final java.lang.String NETWORK_ICON_NAME
Icon for the root of remote (non-local) locations

See Also:
Constant Field Values

NOT_ACCESSIBLE_FILE

public static final java.lang.String NOT_ACCESSIBLE_FILE
Icon for not accessible files (used for quick-lists)

See Also:
Constant Field Values
Constructor Detail

CustomFileIconProvider

public CustomFileIconProvider()
Method Detail

getFileIcon

public javax.swing.Icon getFileIcon(AbstractFile file,
                                    java.awt.Dimension preferredResolution)
Description copied from interface: FileIconProvider
Returns an icon for the given file, or null if it couldn't be retrieved, either because the given file doesn't exist or for any other reason.

The specified Dimension is used as a hint at the preferred icon's resolution; there is absolutely no guarantee that the returned Icon will indeed have this resolution. This dimension is only used to choose between different resolutions should more than one resolution be available, and return the one that most closely matches the specified one.
The implementation is not expected to perform any rescaling (either up or down), this method should only return icons in their 'native' resolutions, using the preferred resolution to choose between different native dimensions. For example, if this provider is able to create icons both in 16x16 and 32x32 resolutions, and a 48x48 resolution is preferred, the 32x32 resolution should be favored as it is closer to 32x32.

Specified by:
getFileIcon in interface FileIconProvider
Parameters:
file - the AbstractFile instance for which an icon is requested
preferredResolution - the preferred icon resolution
Returns:
an icon for the requested file


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard