Search in sources :

Example 11 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    // TODO: here
    JComponent bottomComponent = rightBottomEmptyPanel;
    JComponent annotationComponent = rightBottomEmptyAnnotationsPanel;
    // properties panel
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    // annotations panel
    int annComponentIndex = DocumentEditorTabID.annotations.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        annotationComponent = getAnnotationsPanel();
        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 BioModelNode.PublicationInfoNode) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } 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) {
            // only contains Notes, is displayed in the Object Properties Panel
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (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;
            }
        } else if (singleSelection instanceof SelectionManager.AnnotationNavigator) {
            Object entity = ((SelectionManager.AnnotationNavigator) singleSelection).getEntity();
            if (entity instanceof ReactionStep) {
                bottomComponent = getReactionPropertiesPanel();
            } else if (entity instanceof SpeciesContext) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (entity instanceof Structure) {
                // Observables. MolecularType, Structures
                bottomComponent = getStructurePropertiesPanel();
            } else if (entity instanceof MolecularType) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (entity instanceof RbmObservable) {
                bottomComponent = getObservablePropertiesPanel();
            } else {
                bottomComponent = bioModelEditorAnnotationPanel;
            }
        }
    }
    if (bShowPathway) {
        int numTabs = rightBottomTabbedPane.getTabCount();
        for (destComponentIndex = 0; destComponentIndex < numTabs; destComponentIndex++) {
            Component current = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (current == 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);
        annotationComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightBottomTabbedPane.setComponentAt(annComponentIndex, annotationComponent);
        rightSplitPane.repaint();
    }
    Component selectedComponent = rightBottomTabbedPane.getSelectedComponent();
    if (selections.length == 1 && selections[0] instanceof BioModel && bottomComponent instanceof BioModelEditorAnnotationPanel) {
        // if the biomodel name is selected in the upper left tree, we select the Annotations tab
        rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    } else if (selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && selections[0] instanceof SelectionManager.AnnotationNavigator) {
        // we want to navigate to the AnnotationPanel
        rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    // } else if(selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && bottomComponent instanceof BioModelEditorAnnotationPanel) {
    // // we want to navigate to the AnnotationPanel (old way)
    // rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    } else if (selectedComponent != bottomComponent) /* && rightBottomTabbedPane.getSelectedComponent() != annotationComponent */
    {
        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) PublicationInfoNode(cbit.vcell.desktop.BioModelNode.PublicationInfoNode) 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 12 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class DatabaseWindowPanel method currentDocumentInfo.

/**
 * Comment
 */
private void currentDocumentInfo() {
    VCDocumentInfo selectedDocInfo = null;
    switch(getJTabbedPane1().getSelectedIndex()) {
        case 0:
            {
                // VCDocumentType.BIOMODEL_DOC
                selectedDocInfo = (BioModelInfo) getBioModelDbTreePanel1().getSelectedVersionInfo();
                break;
            }
        case 1:
            {
                // VCDocumentType.MATHMODEL_DOC
                selectedDocInfo = (MathModelInfo) getMathModelDbTreePanel1().getSelectedVersionInfo();
                break;
            }
        case 2:
            {
                // VCDocumentType.GEOMETRY_DOC
                selectedDocInfo = (GeometryInfo) getGeometryTreePanel1().getSelectedVersionInfo();
                break;
            }
    }
    setSelectedDocumentInfo(selectedDocInfo);
}
Also used : VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) MathModelInfo(org.vcell.util.document.MathModelInfo)

Example 13 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class VCDocumentDbTreeModel method initOwners.

protected static synchronized TreeMap<String, BioModelNode> initOwners(VCDocumentInfo[] vcDocumentInfos, User loginUser, VCDocumentDbTreeModel subTreeParent, Method subTreeMethod) {
    // 
    // get list of users (owners)
    // 
    Vector<User> userList = new Vector<User>();
    userList.addElement(loginUser);
    for (int i = 0; i < vcDocumentInfos.length; i++) {
        VCDocumentInfo vcDocumentInfo = vcDocumentInfos[i];
        if (!userList.contains(vcDocumentInfo.getVersion().getOwner())) {
            userList.addElement(vcDocumentInfo.getVersion().getOwner());
        }
    }
    // 
    // for each user
    // 
    TreeMap<String, BioModelNode> treeMap = new TreeMap<String, BioModelNode>(new Comparator<String>() {

        public int compare(String o1, String o2) {
            return o1.compareToIgnoreCase(o2);
        }
    });
    for (int ownerIndex = 0; ownerIndex < userList.size(); ownerIndex++) {
        User owner = (User) userList.elementAt(ownerIndex);
        BioModelNode ownerNode = null;
        try {
            if (vcDocumentInfos instanceof BioModelInfo[]) {
                ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (BioModelInfo[]) vcDocumentInfos });
            } else if (vcDocumentInfos instanceof MathModelInfo[]) {
                ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (MathModelInfo[]) vcDocumentInfos });
            } else if (vcDocumentInfos instanceof GeometryInfo[]) {
                ownerNode = (BioModelNode) subTreeMethod.invoke(subTreeParent, new Object[] { owner, (GeometryInfo[]) vcDocumentInfos });
            } else {
                throw new Exception("Unimplemented VCDocumentInfo type=" + vcDocumentInfos.getClass().getName());
            }
        } catch (Exception e) {
            e.printStackTrace();
            ownerNode = new BioModelNode("Error" + e.getMessage());
        }
        if (owner.equals(loginUser) || ownerNode.getChildCount() > 0) {
            treeMap.put(owner.getName(), ownerNode);
        }
    }
    return treeMap;
}
Also used : User(org.vcell.util.document.User) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) TreeMap(java.util.TreeMap) DataAccessException(org.vcell.util.DataAccessException) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) Vector(java.util.Vector)

Example 14 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class GeometryTreePanel method actionsOnClick.

/**
 * Comment
 */
protected void actionsOnClick(MouseEvent mouseEvent) {
    if (mouseEvent.isPopupTrigger()) {
        if (!getPopupMenuDisabled()) {
            TreePath treePath = ((JTree) mouseEvent.getSource()).getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
            ((JTree) mouseEvent.getSource()).setSelectionPath(treePath);
            if (getSelectedVersionInfo() instanceof GeometryInfo) {
                Version version = getSelectedVersionInfo().getVersion();
                boolean isOwner = version.getOwner().compareEqual(getDocumentManager().getUser());
                getJMenuItemPermission().setEnabled(isOwner);
                getJMenuItemDelete().setEnabled(isOwner);
                getJMenuItemGeomRefs().setEnabled(isOwner);
                getGeometryPopupMenu().show(getJTree1(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
            } else if (treePath != null) {
                BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
                Object object = bioModelNode.getUserObject();
                if (object instanceof User) {
                    User selectedUser = (User) object;
                    boolean isOwner = selectedUser.compareEqual(getDocumentManager().getUser());
                    if (isOwner) {
                        JPopupMenu jPopupMenu = new JPopupMenu();
                        jPopupMenu.add(getJMenuItemCreateNewGeometry());
                        jPopupMenu.show(getJTree1(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
                    }
                }
            }
        }
    } else {
        ifNeedsDoubleClickEvent(mouseEvent, GeometryInfo.class);
    }
}
Also used : JTree(javax.swing.JTree) User(org.vcell.util.document.User) TreePath(javax.swing.tree.TreePath) Version(org.vcell.util.document.Version) GeometryInfo(cbit.vcell.geometry.GeometryInfo) JPopupMenu(javax.swing.JPopupMenu)

Example 15 with GeometryInfo

use of cbit.vcell.geometry.GeometryInfo in project vcell by virtualcell.

the class GeometryTreePanel method treeSelection.

/**
 * Comment
 */
protected void treeSelection() {
    TreePath treePath = getJTree1().getSelectionPath();
    if (treePath == null) {
        setSelectedVersionInfo(null);
        return;
    }
    BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
    Object object = bioModelNode.getUserObject();
    try {
        BeanUtils.setCursorThroughout(this, java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
        if (object instanceof VersionInfo) {
            setSelectedVersionInfo((VersionInfo) object);
        } else if (object instanceof VCDocumentInfoNode && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof GeometryInfo) {
            GeometryInfo geometryInfo = (GeometryInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
            setSelectedVersionInfo(geometryInfo);
        } else {
            setSelectedVersionInfo(null);
        }
    } catch (Exception exc) {
        handleException(exc);
    } finally {
        BeanUtils.setCursorThroughout(this, java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) TreePath(javax.swing.tree.TreePath) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDocumentInfoNode(cbit.vcell.desktop.VCellBasicCellRenderer.VCDocumentInfoNode)

Aggregations

GeometryInfo (cbit.vcell.geometry.GeometryInfo)47 BioModelInfo (org.vcell.util.document.BioModelInfo)27 MathModelInfo (org.vcell.util.document.MathModelInfo)27 DataAccessException (org.vcell.util.DataAccessException)19 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)11 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)8 Hashtable (java.util.Hashtable)8 Geometry (cbit.vcell.geometry.Geometry)7 VCImageInfo (cbit.image.VCImageInfo)6 BioModel (cbit.vcell.biomodel.BioModel)6 User (org.vcell.util.document.User)6 VersionInfo (org.vcell.util.document.VersionInfo)6 CSGObject (cbit.vcell.geometry.CSGObject)5 SimulationContext (cbit.vcell.mapping.SimulationContext)5 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)5 Vector (java.util.Vector)5 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)5 ImageException (cbit.image.ImageException)4 DocumentManager (cbit.vcell.clientdb.DocumentManager)4 GeometryException (cbit.vcell.geometry.GeometryException)4