bibliothek.gui.dock.util
Class IconManager

java.lang.Object
  extended by bibliothek.gui.dock.util.IconManager

@Todo(priority=ENHANCEMENT,
      compatibility=BREAK_MINOR,
      target=VERSION_1_1_0,
      description="IconManager extends UIManager, just like ColorManager and FontManager")
public class IconManager
extends Object

A map of icons which are used by various objects. The icon is stored under a given String-key. Every icon can be stored with three different priorities, only the icon with the highest priority will be returned when getIcon(String) is called. It is possible to register a IconManagerListener which will receive an event whenever an icon changes.

Author:
Benjamin Sigg
See Also:
IconManagerListener

Constructor Summary
IconManager()
           
 
Method Summary
 void add(String key, IconManagerListener listener)
          Adds a listener to this manager.
 void clearThemeIcons()
          Removes all icons which have the priority THEME.
 Icon getIcon(String key)
          Gets the icon under key with the highest priority.
 void remove(String key, IconManagerListener listener)
          Removes a listener from this manager.
 void setIcon(String key, Priority priority, Icon icon)
          Stores an icon.
 void setIconClient(String key, Icon icon)
          Sets an icon with client-priority.
 void setIconDefault(String key, Icon icon)
          Sets an icon with default-priority.
 void setIconTheme(String key, Icon icon)
          Sets an icon with theme-priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconManager

public IconManager()
Method Detail

setIcon

public void setIcon(String key,
                    Priority priority,
                    Icon icon)
Stores an icon.

Parameters:
key - the key of the icon
priority - the priority, where Priority.CLIENT is the highest, Priority.DEFAULT the lowest. Icons stored with the same key but another priority are not deleted.
icon - the icon, null if the icon should be removed

setIconDefault

public void setIconDefault(String key,
                           Icon icon)
Sets an icon with default-priority.

Parameters:
key - the key of the icon
icon - the icon or null

setIconTheme

public void setIconTheme(String key,
                         Icon icon)
Sets an icon with theme-priority.

Parameters:
key - the key of the icon
icon - the icon or null

setIconClient

public void setIconClient(String key,
                          Icon icon)
Sets an icon with client-priority.

Parameters:
key - the key of the icon
icon - the icon or null

getIcon

public Icon getIcon(String key)
Gets the icon under key with the highest priority.

Parameters:
key - the key of the icon
Returns:
the icon or null

add

public void add(String key,
                IconManagerListener listener)
Adds a listener to this manager. The listener will be informed when the icon under key has been changed.

Parameters:
key - the key which is observed
listener - the new listener

remove

public void remove(String key,
                   IconManagerListener listener)
Removes a listener from this manager.

Parameters:
key - the observed key
listener - the listener to remove

clearThemeIcons

public void clearThemeIcons()
Removes all icons which have the priority THEME.