Search in sources :

Example 6 with RelationshipObject

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;
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 7 with RelationshipObject

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");
        }
    }
}
Also used : Shape(cbit.gui.graph.Shape) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 8 with RelationshipObject

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");
            }
        }
    }
}
Also used : Shape(cbit.gui.graph.Shape) RelationshipModel(org.vcell.relationship.RelationshipModel) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 9 with RelationshipObject

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;
}
Also used : JPanel(javax.swing.JPanel) Entity(org.vcell.pathway.Entity) MouseEvent(java.awt.event.MouseEvent) BioPaxObject(org.vcell.pathway.BioPaxObject) BoxLayout(javax.swing.BoxLayout) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) Dimension(java.awt.Dimension) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 10 with RelationshipObject

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;
}
Also used : JPanel(javax.swing.JPanel) Entity(org.vcell.pathway.Entity) MouseEvent(java.awt.event.MouseEvent) BioPaxObject(org.vcell.pathway.BioPaxObject) BoxLayout(javax.swing.BoxLayout) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) RelationshipObject(org.vcell.relationship.RelationshipObject) BioPaxObject(org.vcell.pathway.BioPaxObject) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) RelationshipObject(org.vcell.relationship.RelationshipObject)

Aggregations

RelationshipObject (org.vcell.relationship.RelationshipObject)24 ArrayList (java.util.ArrayList)11 BioPaxObject (org.vcell.pathway.BioPaxObject)11 Entity (org.vcell.pathway.Entity)10 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)7 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)6 PhysicalEntity (org.vcell.pathway.PhysicalEntity)6 JLabel (javax.swing.JLabel)5 JPanel (javax.swing.JPanel)5 MolecularType (org.vcell.model.rbm.MolecularType)5 SpeciesContext (cbit.vcell.model.SpeciesContext)4 Dimension (java.awt.Dimension)4 MouseAdapter (java.awt.event.MouseAdapter)4 MouseEvent (java.awt.event.MouseEvent)4 BoxLayout (javax.swing.BoxLayout)4 Conversion (org.vcell.pathway.Conversion)4 ReactionStep (cbit.vcell.model.ReactionStep)3 ModelProcessEquation (cbit.gui.ModelProcessEquation)2 Shape (cbit.gui.graph.Shape)2 ModelProcess (cbit.vcell.model.ModelProcess)2