bibliothek.gui.dock.util.icon
Class DefaultIconScheme

java.lang.Object
  extended by bibliothek.gui.dock.util.AbstractUIScheme<javax.swing.Icon,DockIcon,DockIconBridge>
      extended by bibliothek.gui.dock.util.icon.AbstractIconScheme
          extended by bibliothek.gui.dock.util.icon.DefaultIconScheme
All Implemented Interfaces:
UIScheme<javax.swing.Icon,DockIcon,DockIconBridge>

public class DefaultIconScheme
extends AbstractIconScheme

This default implementation of an UIScheme for Icons reads an ini-file which consists of "key=icon-path" pairs, and loads all the icons described in that ini file when needed.

Author:
Benjamin Sigg

Nested Class Summary
static class DefaultIconScheme.IconResource
          A helper class describing a source for icons
 
Constructor Summary
DefaultIconScheme(DockController controller, DefaultIconScheme.IconResource... resources)
          Creates a new scheme loading icons from all the specified resources.
DefaultIconScheme(java.lang.String file, java.lang.ClassLoader loader, DockController controller)
          Creates a new scheme loading first the contents of the ini file file and then the icons that are found by analyzing the content of file.
DefaultIconScheme(java.lang.String file, DockController controller)
          Creates a new scheme loading first the contents of the ini file file and then the icons that are found by analyzing the content of file.
 
Method Summary
protected  void changed(java.lang.String id, javax.swing.Icon icon)
          Called if property accessed through a PropertyKey changed its value.
 DockIconBridge getBridge(Path name, UIProperties<javax.swing.Icon,DockIcon,DockIconBridge> properties)
          Creates the UIBridge that handles resources of type name.
 javax.swing.Icon getResource(java.lang.String name, UIProperties<javax.swing.Icon,DockIcon,DockIconBridge> properties)
          Creates the resource with name name.
 
Methods inherited from class bibliothek.gui.dock.util.icon.AbstractIconScheme
install, link, uninstall, unlink
 
Methods inherited from class bibliothek.gui.dock.util.AbstractUIScheme
addListener, fire, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIconScheme

public DefaultIconScheme(java.lang.String file,
                         DockController controller)
Creates a new scheme loading first the contents of the ini file file and then the icons that are found by analyzing the content of file.
If no file is found, then this scheme just remains empty.

Parameters:
file - the file to read
controller - the DockController in whose realm this scheme will be used

DefaultIconScheme

public DefaultIconScheme(java.lang.String file,
                         java.lang.ClassLoader loader,
                         DockController controller)
Creates a new scheme loading first the contents of the ini file file and then the icons that are found by analyzing the content of file.
If no file is found, then this scheme just remains empty.

Parameters:
file - the file to read
loader - the ClassLoader whose ClassLoader.getResource(String) method will be used to load any files
controller - the DockController in whose realm this scheme will be used

DefaultIconScheme

@Todo(priority=MAJOR,
      compatibility=BREAK_MINOR,
      target=VERSION_1_1_1,
      description="get rid of the Overflow-menu-icon")
public DefaultIconScheme(DockController controller,
                                                                                                 DefaultIconScheme.IconResource... resources)
Creates a new scheme loading icons from all the specified resources.

Parameters:
controller - the DockController in whose realm this scheme will be used
resources - a list of files with "key=path" lines telling key and path of the icons to load. If a key appears more than once, then the last occurance of the key wins
Method Detail

getBridge

public DockIconBridge getBridge(Path name,
                                UIProperties<javax.swing.Icon,DockIcon,DockIconBridge> properties)
Description copied from interface: UIScheme
Creates the UIBridge that handles resources of type name.

Parameters:
name - the name of the bridge
properties - the map that will use the resource
Returns:
the new bridge or null if this scheme does not know name

getResource

public javax.swing.Icon getResource(java.lang.String name,
                                    UIProperties<javax.swing.Icon,DockIcon,DockIconBridge> properties)
Description copied from interface: UIScheme
Creates the resource with name name. This method may be called often and should complete quickly.

Parameters:
name - the name of some resource
properties - the map that will use the resource
Returns:
the resource or null if this scheme does not know name

changed

protected void changed(java.lang.String id,
                       javax.swing.Icon icon)
Description copied from class: AbstractIconScheme
Called if property accessed through a PropertyKey changed its value.

Specified by:
changed in class AbstractIconScheme
Parameters:
id - the identifier of the value that changed
icon - the new value, can be null