}
@SuppressWarnings("unchecked")
private void loadObjects(IMapNode parent, Group groupObj, String label, Object object){
IDataSource dataSrc = groupObj.getDataSource();
String spec = dataSrc.getSpec(object);
boolean pruned = groupObj.isPruned(spec);
if(pruned) return;
if(object instanceof List){
for(Object child : ((List<Object>)object)){
loadObjects(parent,groupObj,dataSrc.getName(child),child);
}
return;
}
// Look up that label.
Label labelObj = groupObj.findLabel(
label,
groupObj.getType(),
spec);
// If we haven't got a label for this sort of object yet, create one.
if (labelObj == null || !labelObj.isCached()){
labelObj = dataSrc.createLabel(
this,
groupObj,
dataSrc.getName(object), // Get our default label name
dataSrc.getKey(object), // See if we can find a key for this obj
false,
object);
}
// If we still don't have a LabelObj, then just process its children.
if(labelObj == null){
for(Object child : dataSrc.getChildren(object) ){
loadObjects(parent, groupObj, dataSrc.getName(child), child);
}
return;
}
loadObjects(parent, groupObj, labelObj, object);
}