@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);