public static void buildLocatorTree(DefaultMutableTreeNode treeNode, Element xmlNode,
Set<ResourceLocator> alreadyLoaded, ResourceTree resourceTree) {
String name = getAttribute(xmlNode, NAME.getText());
ResourceLocator locator = new ResourceLocator(
getAttribute(xmlNode, PATH.getText())
);
locator.setName(name);
String infoLink = getAttribute(xmlNode, HYPERLINK.getText());
if (infoLink == null) {
infoLink = getAttribute(xmlNode, INFOLINK.getText());
}
locator.setTrackInforURL(infoLink);
if (xmlNode.getTagName().equalsIgnoreCase("Resource")) {
String resourceType = getAttribute(xmlNode, RESOURCE_TYPE.getText());
locator.setType(resourceType);
String sampleId = getAttribute(xmlNode, SAMPLE_ID.getText());
if (sampleId == null) {
// legacy option
sampleId = getAttribute(xmlNode, ID.getText());
}
locator.setSampleId(sampleId);
locator.setFeatureInfoURL(getAttribute(xmlNode, URL.getText()));
locator.setDescription(getAttribute(xmlNode, DESCRIPTION.getText()));
locator.setTrackLine(getAttribute(xmlNode, TRACK_LINE.getText()));
locator.setName(name);
// Special element for alignment tracks
locator.setCoverage(getAttribute(xmlNode, COVERAGE.getText()));
String colorString = getAttribute(xmlNode, COLOR.getText());
if (colorString != null) {
try {
Color c = ColorUtilities.stringToColor(colorString);
locator.setColor(c);
} catch (Exception e) {
log.error("Error setting color: ", e);
}
}
}