}
return ret;
}
Element fromComponent(Component comp) {
ComponentFactory source = comp.getFactory();
Library lib = findLibrary(source);
String lib_name;
if (lib == null) {
loader.showError(source.getName() + " component not found");
return null;
} else if (lib == file) {
lib_name = null;
} else {
lib_name = libs.get(lib);
if (lib_name == null) {
loader.showError("unknown library within file");
return null;
}
}
Element ret = doc.createElement("comp");
if (lib_name != null) {
ret.setAttribute("lib", lib_name);
}
ret.setAttribute("name", source.getName());
ret.setAttribute("loc", comp.getLocation().toString());
addAttributeSetContent(ret, comp.getAttributeSet(), comp.getFactory());
return ret;
}