|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.ui.icon.FileIcons
public class FileIcons
FileIcons provides several methods to retrieve file icons for a given file:
getSystemFileIcon(AbstractFile): returns a system icon, provided by the underlying OS/desktop manager.
Under supported platforms, those file icons are the same as the ones displayed in the default file manager.getCustomFileIcon(AbstractFile): returns a custom icon, fetched from the muCommander icon set and
based on the file's kind (archive, folder...) and extension.getFileIcon(AbstractFile) returns either a system icon or a custom icon, depending on the current
system icons policy. The default policy is DEFAULT_SYSTEM_ICONS_POLICY and can be changed using
setSystemIconsPolicy(String).AbstractFile files: local files, remote files,
archives entries... The
It is important to note that not all platforms have proper support for system file icons.
The hasProperSystemIcons() method can be used to determine if the current platform properly supports system
icons. Non-supported platforms may return no icon (null values), or icons that do not resemble the
system ones.
| Field Summary | |
|---|---|
static float |
DEFAULT_SCALE_FACTOR
Default icon scale factor (no rescaling) |
static java.lang.String |
DEFAULT_SYSTEM_ICONS_POLICY
Default policy for system icons |
static java.lang.String |
USE_SYSTEM_ICONS_ALWAYS
Always use system file icons |
static java.lang.String |
USE_SYSTEM_ICONS_APPLICATIONS
Use system file icons only for applications |
static java.lang.String |
USE_SYSTEM_ICONS_NEVER
Never use system file icons |
| Constructor Summary | |
|---|---|
FileIcons()
|
|
| Method Summary | |
|---|---|
static javax.swing.Icon |
getCustomFileIcon(AbstractFile file)
Shorthand for getCustomFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension) called with the
icon dimension returned by getIconDimension(). |
static javax.swing.Icon |
getCustomFileIcon(AbstractFile file,
java.awt.Dimension iconDimension)
Returns an icon of the specified dimension for the given file. |
static FileIconProvider |
getCustomFileIconProvider()
Returns the FileIconProvider instance that provides 'custom' file icons. |
static javax.swing.Icon |
getFileIcon(AbstractFile file)
Shorthand for getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension) called with the
icon dimension returned by getIconDimension(). |
static javax.swing.Icon |
getFileIcon(AbstractFile file,
java.awt.Dimension iconDimension)
Returns an icon for the given file and of the specified dimension. |
static java.awt.Dimension |
getIconDimension()
Returns the dimension of file icons currently returned by this class, which is the base icon dimension (16x16) multiplied by the current scale factor. |
static float |
getScaleFactor()
Returns the current icon scale factor, initialized by default to DEFAULT_SCALE_FACTOR. |
static javax.swing.Icon |
getSystemFileIcon(AbstractFile file)
Shorthand for getSystemFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension) called with the
icon dimension returned by getIconDimension(). |
static javax.swing.Icon |
getSystemFileIcon(AbstractFile file,
java.awt.Dimension iconDimension)
Returns an icon of the specified dimension for the given file. |
static FileIconProvider |
getSystemFileIconProvider()
Returns the FileIconProvider instance that provides 'system' file icons. |
static java.lang.String |
getSystemIconsPolicy()
Returns the current system icons policy, controlling when system file icons should be used instead of custom file icons, see constant fields for possible values. |
static boolean |
hasProperSystemIcons()
Returns true if the current platform is able to retrieve system icons that match the ones used in
the OS's default file manager. |
static void |
setCustomFileIconProvider(FileIconProvider fip)
Sets the FileIconProvider instance that provides 'custom' file icons. |
static void |
setScaleFactor(float factor)
Sets the current icon scale factor. |
static void |
setSystemFileIconProvider(FileIconProvider fip)
Sets the FileIconProvider instance that provides 'custom' file icons. |
static void |
setSystemIconsPolicy(java.lang.String policy)
Sets the system icons policy, controlling when system file icons should be used instead of custom file icons. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String USE_SYSTEM_ICONS_NEVER
public static final java.lang.String USE_SYSTEM_ICONS_APPLICATIONS
public static final java.lang.String USE_SYSTEM_ICONS_ALWAYS
public static final java.lang.String DEFAULT_SYSTEM_ICONS_POLICY
public static final float DEFAULT_SCALE_FACTOR
| Constructor Detail |
|---|
public FileIcons()
| Method Detail |
|---|
public static javax.swing.Icon getFileIcon(AbstractFile file)
getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension) called with the
icon dimension returned by getIconDimension().
file - the AbstractFile instance for which an icon will be returned
getSystemIconsPolicy()
public static javax.swing.Icon getFileIcon(AbstractFile file,
java.awt.Dimension iconDimension)
system icons policy.
Returns null if the icon couldn't be retrieved, either because the file doesn't exist or for
any other reason.
file - the AbstractFile instance for which an icon will be returnediconDimension - the icon's dimension
getSystemIconsPolicy()public static javax.swing.Icon getCustomFileIcon(AbstractFile file)
getCustomFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension) called with the
icon dimension returned by getIconDimension().
file - the file for which an icon is to be returned
public static javax.swing.Icon getCustomFileIcon(AbstractFile file,
java.awt.Dimension iconDimension)
custom file icon provider.
Returns null if the icon couldn't be retrieved, either because the file doesn't exist
or for any other reason.
file - the file for which an icon is to be returnediconDimension - the icon's dimension
getCustomFileIconProvider()public static javax.swing.Icon getSystemFileIcon(AbstractFile file)
getSystemFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension) called with the
icon dimension returned by getIconDimension().
file - the file for which an icon is to be returned
public static javax.swing.Icon getSystemFileIcon(AbstractFile file,
java.awt.Dimension iconDimension)
FileIconProvider currently set.
Returns null if the icon couldn't be retrieved, either because the file doesn't exist or for any other reason.
file - the file for which an icon is to be returnediconDimension - the icon's dimension
public static FileIconProvider getCustomFileIconProvider()
FileIconProvider instance that provides 'custom' file icons.
public static void setCustomFileIconProvider(FileIconProvider fip)
FileIconProvider instance that provides 'custom' file icons.
fip - the FileIconProvider instance that provides 'custom' file iconspublic static FileIconProvider getSystemFileIconProvider()
FileIconProvider instance that provides 'system' file icons.
public static void setSystemFileIconProvider(FileIconProvider fip)
FileIconProvider instance that provides 'custom' file icons.
fip - the FileIconProvider instance that provides 'custom' file iconspublic static java.awt.Dimension getIconDimension()
public static float getScaleFactor()
DEFAULT_SCALE_FACTOR.
public static void setScaleFactor(float factor)
factor - the new icon scale factor to use
java.lang.IllegalArgumentException - if factor is lower or equal to 0public static java.lang.String getSystemIconsPolicy()
DEFAULT_SYSTEM_ICONS_POLICY.
public static void setSystemIconsPolicy(java.lang.String policy)
policy - the new system icons policy to usepublic static boolean hasProperSystemIcons()
true if the current platform is able to retrieve system icons that match the ones used in
the OS's default file manager. If false is returned and getSystemFileIcon(com.mucommander.file.AbstractFile)
is used or getFileIcon(com.mucommander.file.AbstractFile) together with a system policy different from
USE_SYSTEM_ICONS_NEVER, the returned icon will probably look very bad.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard