use of jmri.CatalogTreeManager in project JMRI by JMRI.
the class ItemPalette method loadSavedIcons.
static boolean loadSavedIcons(Editor ed) {
CatalogTreeManager manager = InstanceManager.getDefault(jmri.CatalogTreeManager.class);
CatalogTree tree = manager.getBySystemName("NXPI");
if (tree != null) {
CatalogTreeNode root = tree.getRoot();
// root.children() is still unchecked in JDOM2
@SuppressWarnings("unchecked") Enumeration<CatalogTreeNode> e = root.children();
while (e.hasMoreElements()) {
CatalogTreeNode node = e.nextElement();
String typeName = (String) node.getUserObject();
// not very elegant (i.e. extensible), but maybe all that's needed.
if (typeName.equals("IndicatorTO")) {
HashMap<String, HashMap<String, HashMap<String, NamedIcon>>> familyTOMap = loadIndicatorFamilyMap(node, ed);
if (log.isDebugEnabled()) {
log.debug("Add " + familyTOMap.size() + " indicatorTO families to item type " + typeName + " to _indicatorTOMaps.");
}
_indicatorTOMaps.put(typeName, familyTOMap);
} else {
HashMap<String, HashMap<String, NamedIcon>> familyMap = loadFamilyMap(node, ed);
_iconMaps.put(typeName, familyMap);
if (log.isDebugEnabled()) {
log.debug("Add item type " + typeName + " to _iconMaps.");
}
}
}
if (log.isDebugEnabled()) {
log.debug("Icon Map has " + _iconMaps.size() + " members");
}
return true;
}
return false;
}
Aggregations