org.openbp.guiclient.model.item
Class ItemIconMgr

java.lang.Object
  extended by org.openbp.guiclient.model.item.ItemIconMgr

public final class ItemIconMgr
extends java.lang.Object

The item icon manager manages and caches icons for particular item types. All icons have to be registered using the registerIcon(String, Icon) method.

Author:
Jens Ferchland

Method Summary
 javax.swing.Icon getIcon(Item item, int preferredSize)
          Returns the standard icon for the given item.
 javax.swing.Icon getIcon(java.lang.String iconName, int preferredSize)
          Returns an icon that has been registered with the icon model by its name.
 javax.swing.Icon getIcon(java.lang.String skinName, Item item, int preferredSize)
          Returns the standard icon for the given item and the given skin.
 javax.swing.Icon getIcon(java.lang.String skinName, java.lang.String iconName, int preferredSize)
          Returns an icon that has been registered with the icon model by its name and the given skin.
static ItemIconMgr getInstance()
          Gets the singleton instance for this class.
static MultiIcon getMultiIcon(javax.swing.Icon icon)
          Converts a regular icon to a multi icon.
 javax.swing.Icon getTypeIcon(DataTypeItem item, int preferredSize)
          Returns an icon for a data type item that can be used to visualize parameters.
 javax.swing.Icon getTypeIcon(java.lang.String skinName, DataTypeItem item, int preferredSize)
          Returns an icon for a data type item and the given skin that can be used to visualize parameters.
 void registerIcon(java.lang.String name, javax.swing.Icon icon)
          Registers an icon with the icon model.
 void registerIcon(java.lang.String skinName, java.lang.String name, javax.swing.Icon icon)
          Registers an icon with the icon model for the given skin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ItemIconMgr getInstance()
Gets the singleton instance for this class.


getIcon

public javax.swing.Icon getIcon(Item item,
                                int preferredSize)
Returns the standard icon for the given item.

Parameters:
item - The item for which the icon should be retrieved
preferredSize - The preferred size of the icon in pixel
Returns:
The icon or null if not present

getIcon

public javax.swing.Icon getIcon(java.lang.String skinName,
                                Item item,
                                int preferredSize)
Returns the standard icon for the given item and the given skin.

Parameters:
skinName - Name of the skin this icon should belong to; null for the default skin
item - The item for which the icon should be retrieved
preferredSize - The preferred size of the icon in pixel
Returns:
The icon or null if not present

getTypeIcon

public javax.swing.Icon getTypeIcon(DataTypeItem item,
                                    int preferredSize)
Returns an icon for a data type item that can be used to visualize parameters. The icon will reflect the data type of the type item.

Parameters:
item - The item for which the icon should be retrieved
preferredSize - The preferred size of the icon in pixel
Returns:
The icon

getTypeIcon

public javax.swing.Icon getTypeIcon(java.lang.String skinName,
                                    DataTypeItem item,
                                    int preferredSize)
Returns an icon for a data type item and the given skin that can be used to visualize parameters. The icon will reflect the data type of the type item.

Parameters:
skinName - Name of the skin this icon should belong to; null for the default skin
item - The item for which the icon should be retrieved
preferredSize - The preferred size of the icon in pixel
Returns:
The icon

getIcon

public javax.swing.Icon getIcon(java.lang.String iconName,
                                int preferredSize)
Returns an icon that has been registered with the icon model by its name.

Parameters:
iconName - Name of the icon
preferredSize - The preferred size of the icon in pixel
Returns:
The icon or null if no such icon could be found

getIcon

public javax.swing.Icon getIcon(java.lang.String skinName,
                                java.lang.String iconName,
                                int preferredSize)
Returns an icon that has been registered with the icon model by its name and the given skin.

Parameters:
skinName - Name of the skin this icon should belong to; null for the default skin
iconName - Name of the icon
preferredSize - The preferred size of the icon in pixel
Returns:
The icon or null if no such icon could be found

registerIcon

public void registerIcon(java.lang.String name,
                         javax.swing.Icon icon)
Registers an icon with the icon model.

Parameters:
name - Name of the icon
icon - Icon to add

registerIcon

public void registerIcon(java.lang.String skinName,
                         java.lang.String name,
                         javax.swing.Icon icon)
Registers an icon with the icon model for the given skin.

Parameters:
skinName - Name of the skin this icon should belong to; null for the default skin
name - Name of the icon
icon - Icon to add

getMultiIcon

public static MultiIcon getMultiIcon(javax.swing.Icon icon)
Converts a regular icon to a multi icon.

Parameters:
icon - Icon to convert (if this is a MultiIcon itself, it will be returned directly)
Returns:
The multi icon or null if the icon is not a MultiIcon or an ImageIcon


Copyright © 2011. All Rights Reserved.