Search in sources :

Example 21 with BioPaxObject

use of org.vcell.pathway.BioPaxObject in project vcell by virtualcell.

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    JComponent bottomComponent = rightBottomEmptyPanel;
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        Object singleSelection = selections[0];
        if (singleSelection instanceof ReactionStep) {
            bottomComponent = getReactionPropertiesPanel();
        } else if (singleSelection instanceof ReactionRule) {
            bottomComponent = getReactionRulePropertiesPanel();
        } else if (singleSelection instanceof SpeciesContext) {
            bottomComponent = getSpeciesPropertiesPanel();
        } else if (singleSelection instanceof MolecularType) {
            bottomComponent = getMolecularTypePropertiesPanel();
        } else if (singleSelection instanceof RbmObservable) {
            bottomComponent = getObservablePropertiesPanel();
        } else if (singleSelection instanceof Structure) {
            bottomComponent = getStructurePropertiesPanel();
            getStructurePropertiesPanel().setModel(bioModel.getModel());
        } else if (singleSelection instanceof Parameter) {
            bottomComponent = getParameterPropertiesPanel();
        } else if (singleSelection instanceof SimulationContext) {
            bottomComponent = getApplicationPropertiesPanel();
        } else if (singleSelection instanceof ParameterEstimationTask) {
            bottomComponent = parameterEstimationTaskPropertiesPanel;
        } else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
            bottomComponent = getReactionParticipantPropertiesPanel();
        } else if (singleSelection instanceof BioModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } else if (singleSelection instanceof MathModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = mathModelMetaDataPanel;
        } else if (singleSelection instanceof GeometryInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = geometryMetaDataPanel;
        } else if (singleSelection instanceof SpeciesContextSpec) {
            bottomComponent = getSpeciesContextSpecPanel();
        } else if (singleSelection instanceof ReactionSpec) {
            bottomComponent = getKineticsTypeTemplatePanel();
        } else if (singleSelection instanceof ReactionRuleSpec) {
            // 
            bottomComponent = getReactionRuleSpecPropertiesPanel();
        } else if (singleSelection instanceof BioModelsNetModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = getBioModelsNetPropertiesPanel();
        } else if (singleSelection instanceof Simulation) {
            bottomComponent = getSimulationSummaryPanel();
        } else if (singleSelection instanceof DataSymbol) {
            bottomComponent = getDataSymbolsSpecPanel();
        } else if (singleSelection instanceof BioEvent) {
            bottomComponent = getEventPanel();
        } else if (singleSelection instanceof SpatialObject) {
            bottomComponent = getSpatialObjectPropertyPanel();
        } else if (singleSelection instanceof SpatialProcess) {
            bottomComponent = getSpatialProcessPropertyPanel();
        } else if (singleSelection instanceof BioPaxObject) {
            bottomComponent = bioPaxObjectPropertiesPanel;
        } else if (singleSelection instanceof BioModel || singleSelection instanceof VCMetaData) {
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (singleSelection instanceof PathwayData) {
            bShowPathway = true;
            bottomComponent = getBioModelEditorPathwayPanel();
        } else if (singleSelection instanceof Model) {
        } else if (singleSelection instanceof RuleParticipantSignature) {
            bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
        } else if (singleSelection instanceof CSGObject) {
            bottomComponent = csgObjectPropertiesPanel;
            csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
        } else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
            DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
            if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionPropertiesPanel();
            } else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionRulePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
                bottomComponent = getStructurePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
                bottomComponent = getObservablePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
                bottomComponent = getApplicationsPropertiesPanel();
                getApplicationsPropertiesPanel().setBioModel(bioModel);
            } else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
                bottomComponent = parameterEstimationTaskPropertiesPanel;
            }
        }
    }
    if (bShowPathway) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            if (rightBottomTabbedPane.getComponentAt(destComponentIndex) == bottomComponent) {
                break;
            }
        }
        String tabTitle = "Pathway Preview";
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
        }
    } else if (bShowInDatabaseProperties) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
                break;
            }
        }
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
        }
    }
    if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
        bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightSplitPane.repaint();
    }
    if (rightBottomTabbedPane.getSelectedComponent() != bottomComponent) {
        rightBottomTabbedPane.setSelectedComponent(bottomComponent);
    }
}
Also used : RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) BioPaxObject(org.vcell.pathway.BioPaxObject) Product(cbit.vcell.model.Product) PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) Reactant(cbit.vcell.model.Reactant) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) GeometryInfo(cbit.vcell.geometry.GeometryInfo) Structure(cbit.vcell.model.Structure) CSGObject(cbit.vcell.geometry.CSGObject) Component(java.awt.Component) JComponent(javax.swing.JComponent) ReactionRule(cbit.vcell.model.ReactionRule) ReactionSpec(cbit.vcell.mapping.ReactionSpec) ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec) RbmObservable(cbit.vcell.model.RbmObservable) JComponent(javax.swing.JComponent) BioModelInfo(org.vcell.util.document.BioModelInfo) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) MolecularType(org.vcell.model.rbm.MolecularType) ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) DataSymbol(cbit.vcell.data.DataSymbol) Simulation(cbit.vcell.solver.Simulation) ReactionStep(cbit.vcell.model.ReactionStep) BioModel(cbit.vcell.biomodel.BioModel) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) Parameter(cbit.vcell.model.Parameter) BioPaxObject(org.vcell.pathway.BioPaxObject) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) CSGObject(cbit.vcell.geometry.CSGObject) BioEvent(cbit.vcell.mapping.BioEvent)

Example 22 with BioPaxObject

use of org.vcell.pathway.BioPaxObject in project vcell by virtualcell.

the class PathwayGraphModel method refreshControl.

private void refreshControl(Control control) {
    Interaction controlledInteraction = control.getControlledInteraction();
    if (controlledInteraction instanceof Conversion) {
        List<InteractionParticipant> physicalControllers = control.getParticipants();
        if (physicalControllers != null) {
            Conversion conversion = (Conversion) controlledInteraction;
            BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(conversion);
            if (ancestorObject == conversion) {
                // conversion was not grouped
                BioPaxConversionShape conversionShape = (BioPaxConversionShape) getShapeFromModelObject(conversion);
                if (conversionShape != null) {
                    for (InteractionParticipant participant : physicalControllers) {
                        refreshParticipant(conversionShape, participant);
                    }
                }
            } else {
                if (ancestorObject instanceof GroupObject) {
                    // conversion has been grouped
                    GroupObject groupObject = (GroupObject) ancestorObject;
                    for (InteractionParticipant participant : physicalControllers) {
                        refreshGroupInteraction(groupObject, participant);
                    }
                }
            }
        }
    }
}
Also used : Interaction(org.vcell.pathway.Interaction) MolecularInteraction(org.vcell.pathway.MolecularInteraction) BioPaxObject(org.vcell.pathway.BioPaxObject) InteractionParticipant(org.vcell.pathway.InteractionParticipant) GroupObject(org.vcell.pathway.GroupObject) Conversion(org.vcell.pathway.Conversion)

Example 23 with BioPaxObject

use of org.vcell.pathway.BioPaxObject 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);
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 24 with BioPaxObject

use of org.vcell.pathway.BioPaxObject 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();
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) Rna(org.vcell.pathway.Rna) BioPaxObject(org.vcell.pathway.BioPaxObject) Rectangle(java.awt.Rectangle) Complex(org.vcell.pathway.Complex) Control(org.vcell.pathway.Control) MolecularInteraction(org.vcell.pathway.MolecularInteraction) HashSet(java.util.HashSet) GroupObject(org.vcell.pathway.GroupObject) Dimension(java.awt.Dimension) Conversion(org.vcell.pathway.Conversion) Protein(org.vcell.pathway.Protein) PhysicalEntity(org.vcell.pathway.PhysicalEntity) SmallMolecule(org.vcell.pathway.SmallMolecule) Dna(org.vcell.pathway.Dna)

Example 25 with BioPaxObject

use of org.vcell.pathway.BioPaxObject in project vcell by virtualcell.

the class PathwayGraphModel method refreshGroupObject.

private void refreshGroupObject(GroupObject groupObject) {
    for (BioPaxObject bpObject : groupObject.getGroupedObjects()) {
        if (bpObject instanceof Conversion) {
            // Conversions inside groupObject
            Conversion conversion = (Conversion) bpObject;
            refreshInteraction(conversion);
        } else if (bpObject instanceof MolecularInteraction) {
            // molecularInteraction inside  groupObject
            MolecularInteraction molecularInteraction = (MolecularInteraction) bpObject;
            refreshInteraction(molecularInteraction);
        } else if (bpObject instanceof GroupObject) {
            // groupObject inside another groupObject
            refreshGroupObject((GroupObject) bpObject);
        }
    }
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) MolecularInteraction(org.vcell.pathway.MolecularInteraction) GroupObject(org.vcell.pathway.GroupObject) Conversion(org.vcell.pathway.Conversion)

Aggregations

BioPaxObject (org.vcell.pathway.BioPaxObject)53 GroupObject (org.vcell.pathway.GroupObject)21 ArrayList (java.util.ArrayList)15 HashSet (java.util.HashSet)14 PhysicalEntity (org.vcell.pathway.PhysicalEntity)14 RelationshipObject (org.vcell.relationship.RelationshipObject)14 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)9 Conversion (org.vcell.pathway.Conversion)9 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)8 SpeciesContext (cbit.vcell.model.SpeciesContext)7 Entity (org.vcell.pathway.Entity)7 Complex (org.vcell.pathway.Complex)6 Control (org.vcell.pathway.Control)6 InteractionParticipant (org.vcell.pathway.InteractionParticipant)6 Dimension (java.awt.Dimension)5 MouseAdapter (java.awt.event.MouseAdapter)5 MouseEvent (java.awt.event.MouseEvent)5 JLabel (javax.swing.JLabel)5 JPanel (javax.swing.JPanel)5 MolecularType (org.vcell.model.rbm.MolecularType)5