use of org.vcell.pathway.PhysicalEntity in project vcell by virtualcell.
the class PathwayTableModel method refreshData.
private void refreshData() {
if (pathwayModel == null) {
setData(null);
return;
}
List<BioPaxObject> allPathwayObjectList = new ArrayList<BioPaxObject>();
for (BioPaxObject bpObject1 : pathwayModel.getBiopaxObjects()) {
if (bpObject1 instanceof PhysicalEntity || (bpObject1 instanceof Interaction && !(bpObject1 instanceof Control))) {
allPathwayObjectList.add(bpObject1);
}
}
ArrayList<BioPaxObject> pathwayObjectList = new ArrayList<BioPaxObject>();
for (BioPaxObject bpObject : allPathwayObjectList) {
if (searchText == null || searchText.length() == 0 || getLabel(bpObject).toLowerCase().contains(searchText.toLowerCase()) || getType(bpObject).toLowerCase().contains(searchText.toLowerCase())) {
pathwayObjectList.add(bpObject);
bioPaxObjectImportedMap.put(bpObject, bioModel != null && bioModel.getPathwayModel().find(bpObject) != null);
}
}
setData(pathwayObjectList);
}
use of org.vcell.pathway.PhysicalEntity in project vcell by virtualcell.
the class PathwayGraphModel method refreshParticipant.
private void refreshParticipant(BioPaxInteractionShape interactionShape, InteractionParticipant participant) {
BioPaxInteractionParticipantShape edgeShape = (BioPaxInteractionParticipantShape) getShapeFromModelObject(participant);
PhysicalEntity physicalEntity = participant.getPhysicalEntity();
BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(physicalEntity);
if (edgeShape == null) {
Shape shape = getShapeFromModelObject(physicalEntity);
if (shape instanceof BioPaxPhysicalEntityShape) {
BioPaxPhysicalEntityShape physicalEntityShape = (BioPaxPhysicalEntityShape) shape;
edgeShape = new BioPaxInteractionParticipantShape(participant, interactionShape, physicalEntityShape, this);
pathwayContainerShape.addChildShape(edgeShape);
addShape(edgeShape);
}
} else {
// edges without end objects will be removed
if (ancestorObject != physicalEntity) {
removeEdgeShape(edgeShape);
}
}
unwantedShapes.remove(refreshGroup(pathwayContainerShape, ancestorObject, interactionShape, participant));
unwantedShapes.remove(edgeShape);
}
use of org.vcell.pathway.PhysicalEntity in project vcell by virtualcell.
the class PathwayGraphModel method refreshGroupInteraction.
private void refreshGroupInteraction(GroupObject groupObject, InteractionParticipant participant) {
BioPaxGroupShape groupShape = (BioPaxGroupShape) getShapeFromModelObject(groupObject);
PhysicalEntity physicalEntity = participant.getPhysicalEntity();
GroupNeighbor groupNeighbor = new GroupNeighbor(groupObject, physicalEntity, participant.getType());
BioPaxGroupNeighborShape edgeShape = (BioPaxGroupNeighborShape) getShapeFromModelObject(groupNeighbor);
BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(physicalEntity);
if (edgeShape == null) {
Shape shape = getShapeFromModelObject(physicalEntity);
if (shape instanceof BioPaxPhysicalEntityShape) {
BioPaxPhysicalEntityShape physicalEntityShape = (BioPaxPhysicalEntityShape) shape;
edgeShape = new BioPaxGroupNeighborShape(groupNeighbor, groupShape, physicalEntityShape, this);
pathwayContainerShape.addChildShape(edgeShape);
addShape(edgeShape);
}
} else {
// edges without end objects will be removed
if (ancestorObject != physicalEntity) {
// for grouped objects
removeEdgeShape(edgeShape);
}
}
unwantedShapes.remove(refreshGroup(pathwayContainerShape, ancestorObject, groupShape, participant));
unwantedShapes.remove(edgeShape);
}
use of org.vcell.pathway.PhysicalEntity in project vcell by virtualcell.
the class PathwayGraphModel method refreshAll.
@Override
public void refreshAll() {
if (pathwayModel == null) {
clearAllShapes();
fireGraphChanged();
return;
}
unwantedShapes = new HashSet<Shape>();
unwantedShapes.addAll(getShapes());
pathwayContainerShape = (PathwayContainerShape) getShapeFromModelObject(pathwayModel);
if (pathwayContainerShape == null) {
pathwayContainerShape = new PathwayContainerShape(this, pathwayModel);
pathwayContainerShape.getSpaceManager().setSize(400, 300);
addShape(pathwayContainerShape);
}
unwantedShapes.remove(pathwayContainerShape);
Set<BioPaxObject> bioPaxObjects = new HashSet<BioPaxObject>(pathwayModel.getDisplayableBioPaxObjectList());
for (BioPaxObject bpObject : bioPaxObjects) {
BioPaxShape bpObjectShape = (BioPaxShape) getShapeFromModelObject(bpObject);
if (bpObjectShape == null) {
if (bpObject instanceof Conversion) {
bpObjectShape = new BioPaxConversionShape((Conversion) bpObject, this);
} else if (bpObject instanceof MolecularInteraction) {
bpObjectShape = new BioPaxMolecularInteractionShape((MolecularInteraction) bpObject, this);
} else if (bpObject instanceof Protein) {
bpObjectShape = new BioPaxProteinShape((Protein) bpObject, this);
} else if (bpObject instanceof Complex) {
bpObjectShape = new BioPaxComplexShape((Complex) bpObject, this);
} else if (bpObject instanceof SmallMolecule) {
bpObjectShape = new BioPaxSmallMoleculeShape((SmallMolecule) bpObject, this);
} else if (bpObject instanceof Dna) {
bpObjectShape = new BioPaxDnaShape((Dna) bpObject, this);
} else if (bpObject instanceof Rna) {
bpObjectShape = new BioPaxRnaShape((Rna) bpObject, this);
} else if (bpObject instanceof PhysicalEntity) {
bpObjectShape = new BioPaxPhysicalEntityShape((PhysicalEntity) bpObject, this);
} else if (bpObject instanceof GroupObject) {
bpObjectShape = new BioPaxGroupShape((GroupObject) bpObject, this);
} else {
bpObjectShape = new BioPaxObjectShape(bpObject, this);
}
if (!(bpObject instanceof Control)) {
// the Control objects will not be displayed on the diagram
pathwayContainerShape.addChildShape(bpObjectShape);
addShape(bpObjectShape);
}
Dimension shapeSize = bpObjectShape.getSpaceManager().getSize();
Rectangle boundary = getContainerLayout().getBoundaryForAutomaticLayout(pathwayContainerShape);
int xPos = boundary.x + random.nextInt(boundary.width - shapeSize.width);
int yPos = boundary.y + random.nextInt(boundary.height - shapeSize.height);
bpObjectShape.setAbsPos(xPos, yPos);
}
unwantedShapes.remove(bpObjectShape);
}
for (BioPaxObject bpObject : bioPaxObjects) {
if (bpObject instanceof Conversion) {
refreshInteraction((Conversion) bpObject);
} else if (bpObject instanceof MolecularInteraction) {
refreshInteraction((MolecularInteraction) bpObject);
} else if (bpObject instanceof Control) {
refreshControl((Control) bpObject);
} else if (bpObject instanceof GroupObject) {
refreshGroupObject((GroupObject) bpObject);
}
}
for (Shape unwantedShape : unwantedShapes) {
removeShape(unwantedShape);
}
refreshRelationshipInfo();
fireGraphChanged();
}
use of org.vcell.pathway.PhysicalEntity in project vcell by virtualcell.
the class PathwayProducerBiopax3 method addContentConversion.
// right PhysicalEntity multiple
// participantStoichiometry Stoichiometry multiple
// left PhysicalEntity multiple
// spontaneous Boolean single
// conversionDirection String single
private Element addContentConversion(BioPaxObject bpObject, Element element) {
element = addContentInteraction(bpObject, element);
Conversion ob = (Conversion) bpObject;
Element tmpElement = null;
if (ob.getLeft() != null && ob.getLeft().size() > 0) {
List<PhysicalEntity> list = ob.getLeft();
for (PhysicalEntity item : list) {
tmpElement = new Element("left", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getRight() != null && ob.getRight().size() > 0) {
List<PhysicalEntity> list = ob.getRight();
for (PhysicalEntity item : list) {
tmpElement = new Element("right", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getParticipantStoichiometry() != null && ob.getParticipantStoichiometry().size() > 0) {
List<Stoichiometry> list = ob.getParticipantStoichiometry();
for (Stoichiometry item : list) {
tmpElement = new Element("participantStoichiometry", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getSpontaneous() != null) {
tmpElement = new Element("spontaneous", bp);
tmpElement.setAttribute("datatype", schemaBoolean, rdf);
tmpElement.setText(ob.getSpontaneous().toString());
element.addContent(tmpElement);
}
if (ob.getConversionDirection() != null && ob.getConversionDirection().length() > 0) {
tmpElement = new Element("conversionDirection", bp);
tmpElement.setAttribute("datatype", schemaString, rdf);
tmpElement.setText(ob.getConversionDirection());
element.addContent(tmpElement);
}
return element;
}
Aggregations