use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class MolecularTypeTableModel method getValueAt.
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Column col = Column.values()[columnIndex];
MolecularType molecularType = getValueAt(rowIndex);
if (molecularType == null) {
if (col == Column.name) {
return ADD_NEW_HERE_TEXT;
}
} else {
switch(col) {
case name:
return molecularType.getName();
case link:
HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(molecularType);
if (relObjsHash != null && relObjsHash.size() > 0) {
return relObjsHash.iterator().next().getBioPaxObject();
}
return null;
case bngl_pattern:
return pattern(molecularType);
}
}
return null;
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class ModelCartoon method refreshRelationshipInfo.
public final void refreshRelationshipInfo(RelationshipModel relationshipModel) {
for (RelationshipObject relationship : relationshipModel.getRelationshipObjects()) {
BioModelEntityObject bioModelEntity = relationship.getBioModelEntityObject();
Shape shape = getShapeFromModelObject(bioModelEntity);
if (shape instanceof SpeciesContextShape) {
SpeciesContextShape scShape = (SpeciesContextShape) shape;
scShape.setLinkText("L");
} else if (shape instanceof SimpleReactionShape) {
SimpleReactionShape srShape = (SimpleReactionShape) shape;
srShape.setLinkText("L");
} else if (shape instanceof ReactionRuleDiagramShape) {
ReactionRuleDiagramShape srShape = (ReactionRuleDiagramShape) shape;
srShape.setLinkText("L");
}
}
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class ModelCartoon method relationshipChanged.
public void relationshipChanged(RelationshipEvent event) {
RelationshipObject relationshipObject = event.getRelationshipObject();
if (event.getOperationType() == event.ADDED) {
Shape shape = getShapeFromModelObject(relationshipObject.getBioModelEntityObject());
if (shape instanceof SpeciesContextShape) {
SpeciesContextShape scShape = (SpeciesContextShape) shape;
scShape.setLinkText("L");
} else if (shape instanceof SimpleReactionShape) {
SimpleReactionShape srShape = (SimpleReactionShape) shape;
srShape.setLinkText("L");
} else if (shape instanceof ReactionRuleDiagramShape) {
ReactionRuleDiagramShape srShape = (ReactionRuleDiagramShape) shape;
srShape.setLinkText("L");
}
} else if (event.getOperationType() == event.REMOVED) {
Shape shape = getShapeFromModelObject(relationshipObject.getBioModelEntityObject());
if (shape instanceof SpeciesContextShape) {
SpeciesContextShape scShape = (SpeciesContextShape) shape;
scShape.setLinkText("");
// if the BioModelEntity Object is still linked with other BioPax objects, we add the "L" shape back
if (((RelationshipModel) event.getSource()).getRelationshipObjects(relationshipObject.getBioModelEntityObject()).size() > 0) {
scShape.setLinkText("L");
}
} else if (shape instanceof SimpleReactionShape) {
SimpleReactionShape srShape = (SimpleReactionShape) shape;
srShape.setLinkText("");
if (((RelationshipModel) event.getSource()).getRelationshipObjects(relationshipObject.getBioModelEntityObject()).size() > 0) {
srShape.setLinkText("L");
}
} else if (shape instanceof ReactionRuleDiagramShape) {
ReactionRuleDiagramShape srShape = (ReactionRuleDiagramShape) shape;
srShape.setLinkText("");
if (((RelationshipModel) event.getSource()).getRelationshipObjects(relationshipObject.getBioModelEntityObject()).size() > 0) {
srShape.setLinkText("L");
}
}
}
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class ReactionRuleKineticsPropertiesPanel method listLinkedPathwayObjects.
private String listLinkedPathwayObjects() {
if (reactionRule == null) {
return "no selected rule";
}
if (bioModel == null || bioModel.getModel() == null) {
return "no biomodel";
}
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
String linkedPOlist = "";
for (RelationshipObject relObject : bioModel.getRelationshipModel().getRelationshipObjects(reactionRule)) {
if (relObject == null) {
continue;
}
final BioPaxObject bpObject = relObject.getBioPaxObject();
if (bpObject == null) {
continue;
}
if (bpObject instanceof Entity) {
String name = new String();
if (((Entity) bpObject).getName().isEmpty()) {
name = ((Entity) bpObject).getID();
} else {
name = ((Entity) bpObject).getName().get(0);
}
if (name.contains("#")) {
name = name.substring(name.indexOf("#") + 1);
}
JLabel label = new JLabel("<html><u>" + name + "</u></html>");
label.setForeground(Color.blue);
label.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.PATHWAY_DIAGRAM_NODE, ActiveViewID.pathway_diagram), new Object[] { bpObject });
}
}
});
panel.add(label);
}
}
Dimension dim = new Dimension(200, 20);
panel.setMinimumSize(dim);
panel.setPreferredSize(dim);
linkedPOScrollPane.setViewportView(panel);
return linkedPOlist;
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class SpeciesPropertiesPanel method listLinkedPathwayObjects.
// wei's code
private String listLinkedPathwayObjects() {
if (getSpeciesContext() == null) {
return "no selected species";
}
if (bioModel == null || bioModel.getModel() == null) {
return "no biomodel";
}
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
String linkedPOlist = "";
for (RelationshipObject relObject : bioModel.getRelationshipModel().getRelationshipObjects(getSpeciesContext())) {
final BioPaxObject bpObject = relObject.getBioPaxObject();
if (bpObject instanceof Entity) {
JLabel label = new JLabel("<html><u>" + ((Entity) bpObject).getName().get(0) + "</u></html>");
label.setForeground(Color.blue);
label.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.PATHWAY_DIAGRAM_NODE, ActiveViewID.pathway_diagram), new Object[] { bpObject });
}
}
});
panel.add(label);
}
}
linkedPOScrollPane.setViewportView(panel);
return linkedPOlist;
}
Aggregations