return icons;
}
private static IconMap loadIconMap(String iconMapName) {
PropertySet iconMapProperties = Configurator.getProperties(iconMapName, ICON_MAP_KEY);
IconMap iconMap = new IconMap();
ArrayList notCached = new ArrayList();
for(Iterator it=iconMapProperties.keys(); it.hasNext();) {
String fakeName = (String)it.next();
String realName = iconMapProperties.getString(fakeName);
// load all the cached icon resources
IconResource iconResource = getCachedResource(realName);
if(iconResource==null) {
// track the non-cached icons
notCached.add(fakeName);
} else {
iconMap.addIcons(fakeName, iconResource);
}
}
// if all our resources were already cached, then we can return immediately
if(notCached.size()==0)
return iconMap;
// otherwise, we need to load resources and put them in the cache.
String[] fakeNames = (String[])notCached.toArray(new String[0]);
String[] realNames = iconMapProperties.getStrings(fakeNames);
// load the resources into memory
HashMap resourceMap = loadIconResources(realNames);
// now loop through and cache
for(int i=0; i<fakeNames.length; i++) {
String realName = iconMapProperties.getString(fakeNames[i]);
IconResource iconResource = (IconResource)resourceMap.get(realName);
// cache the resource for future use
cacheResource(realName, iconResource);
// add to the immediate icon map
iconMap.addIcons(fakeNames[i], iconResource);