}
@SuppressWarnings("unchecked")
private void loadObjects(IMapNode parent, Group groupObj, Label labelObj, Object object){
IDataSource dataSrc = groupObj.getDataSource();
MapNodeObject node = new MapNodeObject(groupObj, labelObj, parent);
node.setSource(object);
node.setKey(dataSrc.getKeyValue(node,object));
if(parent==null){
getDataMap().add(node);
}
// If we have written this object already, then we don't need to repeat its
// attributes. But we do need the key from the previous write!
if(written.get(object)!=null){
node.setKey(written.get(object).getKey());
}else{
written.put(object,node);
for(IAttribute a : labelObj.getAttributes()){
Object r = a.get(object);
if(a.getType().isPrimitive()){
MapNodeAttribute mna = new MapNodeAttribute(a, node);
mna.setData(r);
if(a.isKey()){
node.setKey(r);
}
}else{
if(a.getType() == MapType.LIST
&& a.getSubType().isPrimitive()){
MapNodeList mnl = new MapNodeList(a, node);
mnl.setSubType(a.getSubTypeText());
mnl.setList((List<Object>)r);
}else if(a.getType()== MapType.LIST){
MapNodeList mnl = new MapNodeList(a,node);
mnl.setSubType(a.getSubTypeText());
mnl.setList((List<Object>)r);
if( r!=null ) for(Object obj2 : (List<Object>)r){
loadObjects(mnl, groupObj,(String) null, obj2);
}
}else if (a.getType() == MapType.MAP){
MapNodeMap mnm = new MapNodeMap(a,node);
mnm.setMap((Map<Object,Object>)r);
}else if (a.getType() == MapType.OBJECT){
if(r!=null) if(groupObj.isPruned(dataSrc.getSpec(r))) continue;
MapNodeRef mnr = new MapNodeRef (a, node);
if(r!=null) loadObjects(mnr, groupObj, (String) null, r);
}
}
}