import org.pathvisio.core.model.GroupStyle; //导入依赖的package包/类
private void drawComplexMembers(ArrayList complexComponentIDString,
String parentComplexId, boolean isComplex) {
GKInstance inst;
try {
// Creating Group Element for grouping complex components
parentComplex = PathwayElement
.createPathwayElement(ObjectType.GROUP);
gpmlpathway.add(parentComplex);
parentComplex.setGeneratedGraphId();
parentComplex.setGroupId(gpmlpathway.getUniqueGroupId());
if (isComplex) {
parentComplex.setGroupStyle(GroupStyle.COMPLEX);
} else {
parentComplex.setGroupStyle(GroupStyle.NONE);
}
for (int count = 0; count < complexComponentIDString.size(); count++) {
String identifier = complexComponentIDString.get(count);
// System.out.println(identifier);
inst = dbAdaptor.fetchInstance(Long.parseLong(identifier));
pwyelement = PathwayElement
.createPathwayElement(ObjectType.DATANODE);
String nodeType = parseIdentifier(inst.getExtendedDisplayName())[0];
// System.out.println("members : " + nodeType);
if (nodeType.equalsIgnoreCase("EntityWithAccessionedSequence")) {
pwyelement.setDataNodeType(DataNodeType.PROTEIN);
} else if (nodeType.equalsIgnoreCase("SimpleEntity")) {
pwyelement.setDataNodeType(DataNodeType.METABOLITE);
pwyelement.setColor(Color.BLUE);
}
parentComplex.setDynamicProperty(COMPLEX_ID, parentComplexId);
gpmlpathway.add(pwyelement);
pwyelement.setGeneratedGraphId();
pwyelement
.setTextLabel(parseLocation(inst.getDisplayName())[0]);
pwyelement.setGroupRef(parentComplex.getGroupId());
/*
* Adding Dynamic properties COMPLEX_ID : for connecting complex
* and components COPIES_NUM : for counting copies of a complex
* component LOCATION : for cellular location
*/
pwyelement.setDynamicProperty(COMPLEX_ID,
parentComplex.getDynamicProperty(COMPLEX_ID));
pwyelement.setDynamicProperty(COPIES_NUM,
String.valueOf(complexComponentIDMap.get(identifier)));
pwyelement.setDynamicProperty(LOCATION,
(parseLocation(inst.getDisplayName())[1]));
addXref(pwyelement, Long.parseLong(identifier), inst);
addComments(inst, pwyelement, false, false);
addLitRef(inst, pwyelement);
pwyEleList.add(pwyelement);
}
} catch (Exception e) {
e.printStackTrace();
}
}