public class DefaultIconScheme extends AbstractIconScheme
UIScheme
for Icon
s reads an ini-file
which consists of "key=icon-path" pairs, and loads all the icons described in that
ini file when needed.Modifier and Type | Class and Description |
---|---|
static class |
DefaultIconScheme.IconResource
A helper class describing a source for icons
|
Constructor and Description |
---|
DefaultIconScheme(DockController controller,
DefaultIconScheme.IconResource... resources)
Creates a new scheme loading icons from all the specified resources.
|
DefaultIconScheme(String file,
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. |
DefaultIconScheme(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. |
Modifier and Type | Method and Description |
---|---|
protected void |
changed(String id,
Icon icon)
Called if property accessed through a
PropertyKey changed its value. |
DockIconBridge |
getBridge(Path name,
UIProperties<Icon,DockIcon,DockIconBridge> properties)
Creates the
UIBridge that handles resources of type name . |
Icon |
getResource(String name,
UIProperties<Icon,DockIcon,DockIconBridge> properties)
Creates the resource with name
name . |
protected void |
initHardcoded()
Called by the constructor of this class, initializes some hard coded icons.
|
void |
setBridge(Path type,
DockIconBridge bridge)
Sets the
DockIconBridge with type type . |
void |
setIcon(String name,
Icon icon)
Changes the icon with name
name to icon . |
install, link, uninstall, unlink
addListener, fire, removeListener
public DefaultIconScheme(String file, DockController controller)
file
and
then the icons that are found by analyzing the content of file
.file
- the file to readcontroller
- the DockController
in whose realm this scheme will be usedpublic DefaultIconScheme(String file, ClassLoader loader, DockController controller)
file
and
then the icons that are found by analyzing the content of file
.file
- the file to readloader
- the ClassLoader
whose ClassLoader.getResource(String)
method
will be used to load any filescontroller
- the DockController
in whose realm this scheme will be usedpublic DefaultIconScheme(DockController controller, DefaultIconScheme.IconResource... resources)
controller
- the DockController
in whose realm this scheme will be usedresources
- 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 winsprotected void initHardcoded()
public DockIconBridge getBridge(Path name, UIProperties<Icon,DockIcon,DockIconBridge> properties)
UIScheme
UIBridge
that handles resources of type name
.name
- the name of the bridgeproperties
- the map that will use the resourcenull
if this scheme does not know name
public Icon getResource(String name, UIProperties<Icon,DockIcon,DockIconBridge> properties)
UIScheme
name
. This method may be called often
and should complete quickly.name
- the name of some resourceproperties
- the map that will use the resourcenull
if this scheme does not know name
public void setIcon(String name, Icon icon)
name
to icon
. Please note that if
name
was linked
, the newly
set value may be overriden again.name
- the unique key of the iconicon
- the new icon, can be null
public void setBridge(Path type, DockIconBridge bridge)
DockIconBridge
with type type
.type
- the unique identifier of the type that should be handled by the new bridgebridge
- the new bridge or null
protected void changed(String id, Icon icon)
AbstractIconScheme
PropertyKey
changed its value.changed
in class AbstractIconScheme
id
- the identifier of the value that changedicon
- the new value, can be null