Search in sources :

Example 6 with DocumentEditorTreeFolderNode

use of cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode in project vcell by virtualcell.

the class MathModelEditorTreeCellRenderer method getTreeCellRendererComponent.

// public void setMathModel(MathModel mm) {
// mathModel = mm;
// }
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    if (regularFont == null) {
        regularFont = getFont();
        boldFont = regularFont.deriveFont(Font.BOLD);
    }
    Font font = regularFont;
    Icon icon = null;
    String labelText = null;
    String toolTipPrefix = "";
    String toolTipSuffix = "";
    if (value instanceof BioModelNode) {
        BioModelNode node = (BioModelNode) value;
        if (node.getChildCount() > 0) {
            icon = getIcon();
        }
        Object userObj = node.getUserObject();
        if (userObj instanceof MathModel) {
            font = boldFont;
            icon = VCellIcons.documentIcon;
            labelText = ((MathModel) userObj).getName();
            toolTipPrefix = "MathModel: ";
        } else if (userObj instanceof DocumentEditorTreeFolderNode) {
            // --- 1st level folders
            DocumentEditorTreeFolderNode folder = (DocumentEditorTreeFolderNode) userObj;
            labelText = folder.getName();
            if (folder.isBold()) {
                font = boldFont;
            }
            DocumentEditorTreeFolderClass folderClass = folder.getFolderClass();
            switch(folderClass) {
                case MATH_VCML_NODE:
                    icon = VCellIcons.textNotesIcon;
                    break;
                case MATH_GEOMETRY_NODE:
                    icon = VCellIcons.geometryIcon;
                    break;
                case MATH_SIMULATIONS_NODE:
                    icon = VCellIcons.simulationIcon;
                    break;
                case MATH_OUTPUT_FUNCTIONS_NODE:
                    icon = VCellIcons.getOutputFunctionIcon();
                    break;
            }
        }
    }
    setIcon(icon);
    setFont(font);
    setText(labelText);
    if (toolTipSuffix.length() == 0) {
        toolTipSuffix = labelText;
    }
    setToolTipText(toolTipPrefix + toolTipSuffix);
    return this;
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) BioModelNode(cbit.vcell.desktop.BioModelNode) Icon(javax.swing.Icon) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) Font(java.awt.Font)

Example 7 with DocumentEditorTreeFolderNode

use of cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode in project vcell by virtualcell.

the class BioModelEditorTreeCellRenderer method getTreeCellRendererComponent.

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    if (regularFont == null) {
        regularFont = getFont();
        boldFont = regularFont.deriveFont(Font.BOLD);
    }
    Font font = regularFont;
    Icon icon = null;
    String labelText = null;
    String toolTipPrefix = "";
    String toolTipSuffix = "";
    if (value instanceof LinkNode) {
        LinkNode ln = (LinkNode) value;
        String link = ln.getLink();
        String text = ln.getText();
        String qualifier = ln.getMiriamQualifier().getDescription();
        if (link != null) {
            String colorString = (sel) ? "white" : "blue";
            toolTipPrefix = "double-click to open link " + link;
            labelText = "<html>" + qualifier + "&nbsp;<font color=\"" + colorString + "\"><a href=" + link + ">" + text + "</a></font></html>";
        } else {
            String colorString = (sel) ? "white" : "black";
            labelText = "<html>" + qualifier + "&nbsp;<font color=\"" + colorString + "\">" + text + "</font></html>";
        }
    } else if (value instanceof BioModelNode) {
        BioModelNode node = (BioModelNode) value;
        Object userObj = node.getUserObject();
        if (userObj instanceof BioModel) {
            font = boldFont;
            icon = VCellIcons.documentIcon;
            labelText = ((BioModel) userObj).getName();
            toolTipPrefix = "BioModel: ";
        } else if (userObj instanceof SimulationContext) {
            // --- root: application name
            font = boldFont;
            // icon = VCellIcons.applicationIcon;
            SimulationContext simContext = (SimulationContext) userObj;
            if (simContext.isRuleBased()) {
                if (simContext.getGeometry().getDimension() == 0) {
                    icon = VCellIcons.appRbmNonspIcon;
                    toolTipSuffix = "Rule Based / Non spatial";
                }
            } else if (simContext.isStoch()) {
                if (simContext.getGeometry().getDimension() == 0) {
                    icon = VCellIcons.appStoNonspIcon;
                    toolTipSuffix = "Stochastic / Non spatial";
                } else {
                    icon = VCellIcons.appStoSpatialIcon;
                    toolTipSuffix = "Stochastic / Spatial";
                }
            } else {
                // deterministic
                if (simContext.getGeometry().getDimension() == 0) {
                    icon = VCellIcons.appDetNonspIcon;
                    toolTipSuffix = "Deterministic / Non spatial";
                } else {
                    icon = VCellIcons.appDetSpatialIcon;
                    toolTipSuffix = "Deterministic / Spatial";
                }
            }
            labelText = /*"Application: " + */
            ((SimulationContext) userObj).getName();
            toolTipPrefix = "Application: ";
        } else if (userObj instanceof DocumentEditorTreeFolderNode) {
            // --- 1st level folders
            DocumentEditorTreeFolderNode folder = (DocumentEditorTreeFolderNode) userObj;
            labelText = folder.getName();
            if (folder.isBold()) {
                font = boldFont;
            }
            DocumentEditorTreeFolderClass folderClass = folder.getFolderClass();
            switch(folderClass) {
                // break;
                case REACTIONS_NODE:
                    icon = VCellIcons.tableIcon;
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        int numReactions = bioModel.getModel().getNumReactions();
                        if (bioModel.getModel().getRbmModelContainer() != null) {
                            numReactions += bioModel.getModel().getRbmModelContainer().getReactionRuleList().size();
                        }
                        labelText = folder.getName() + " (" + numReactions + ")";
                    }
                    break;
                case STRUCTURES_NODE:
                    icon = VCellIcons.tableIcon;
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        labelText = folder.getName() + " (" + bioModel.getModel().getNumStructures() + ")";
                    }
                    break;
                case SPECIES_NODE:
                    icon = VCellIcons.tableIcon;
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        labelText = folder.getName() + " (" + bioModel.getModel().getNumSpeciesContexts() + ")";
                    }
                    break;
                case MOLECULAR_TYPES_NODE:
                    icon = VCellIcons.tableIcon;
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        RbmModelContainer rbmModelContainer = bioModel.getModel().getRbmModelContainer();
                        if (rbmModelContainer == null) {
                            labelText = folder.getName() + "(00000)";
                        } else {
                            labelText = folder.getName() + " (" + rbmModelContainer.getMolecularTypeList().size() + ")";
                        }
                    }
                    break;
                case OBSERVABLES_NODE:
                    icon = VCellIcons.tableIcon;
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        RbmModelContainer rbmModelContainer = bioModel.getModel().getRbmModelContainer();
                        if (rbmModelContainer == null) {
                            labelText = folder.getName() + "(00000)";
                        } else {
                            labelText = folder.getName() + " (" + rbmModelContainer.getObservableList().size() + ")";
                        }
                    }
                    break;
                case APPLICATIONS_NODE:
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        labelText = folder.getName() + " (" + bioModel.getNumSimulationContexts() + ")";
                    }
                    break;
                case REACTION_DIAGRAM_NODE:
                    icon = VCellIcons.diagramIcon;
                    break;
                // break;
                case GEOMETRY_NODE:
                    icon = VCellIcons.geometryIcon;
                    break;
                case SPECIFICATIONS_NODE:
                    icon = VCellIcons.settingsIcon;
                    break;
                case PROTOCOLS_NODE:
                    icon = VCellIcons.protocolsIcon;
                    break;
                case SIMULATIONS_NODE:
                    icon = VCellIcons.simulationIcon;
                    break;
                case PARAMETER_ESTIMATION_NODE:
                    icon = VCellIcons.fittingIcon;
                    break;
                case PATHWAY_DIAGRAM_NODE:
                    icon = VCellIcons.diagramIcon;
                    break;
                case PATHWAY_OBJECTS_NODE:
                    icon = VCellIcons.tableIcon;
                    if (bioModel == null) {
                        labelText = folder.getName() + "(00000)";
                    } else {
                        labelText = folder.getName() + " (" + bioModel.getPathwayModel().getBiopaxObjects().size() + ")";
                    }
                    break;
                case BIOPAX_SUMMARY_NODE:
                    icon = VCellIcons.textNotesIcon;
                    break;
                case BIOPAX_TREE_NODE:
                    icon = VCellIcons.tableIcon;
                    break;
            }
        }
    }
    setIcon(icon);
    setFont(font);
    setText(labelText);
    if (toolTipSuffix.length() == 0) {
        toolTipSuffix = labelText;
    }
    setToolTipText(toolTipPrefix + toolTipSuffix);
    return this;
}
Also used : RbmModelContainer(cbit.vcell.model.Model.RbmModelContainer) BioModel(cbit.vcell.biomodel.BioModel) LinkNode(cbit.vcell.xml.gui.MiriamTreeModel.LinkNode) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) BioModelNode(cbit.vcell.desktop.BioModelNode) Icon(javax.swing.Icon) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) Font(java.awt.Font)

Example 8 with DocumentEditorTreeFolderNode

use of cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode in project vcell by virtualcell.

the class DocumentEditor method construcutPopupMenu.

private void construcutPopupMenu() {
    popupMenu.removeAll();
    TreePath[] selectedPaths = documentEditorTree.getSelectionPaths();
    boolean bRename = false;
    boolean bExpand = true;
    boolean bAddNew = false;
    boolean bAddNewApp = false;
    boolean bCopyApp = false;
    boolean bDelete = false;
    boolean bNewBiomodel = false;
    boolean bRemoveApps = false;
    DocumentEditorTreeFolderClass folderClass = null;
    for (TreePath tp : selectedPaths) {
        Object obj = tp.getLastPathComponent();
        if (obj == null || !(obj instanceof BioModelNode)) {
            continue;
        }
        if (documentEditorTree.getModel().isLeaf(obj)) {
            bExpand = false;
        }
        BioModelNode selectedNode = (BioModelNode) obj;
        Object userObject = selectedNode.getUserObject();
        if (userObject instanceof DocumentEditorTreeFolderNode) {
            folderClass = ((DocumentEditorTreeFolderNode) userObject).getFolderClass();
            if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
                bAddNewApp = true;
                if (selectedNode.getChildCount() > 0) {
                    bRemoveApps = true;
                }
            } else if (folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE || folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE || folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE || folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE || folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE || folderClass == DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE) {
                bAddNew = (selectedPaths.length == 1);
                bRename = false;
            }
        } else if (userObject instanceof SimulationContext) {
            bRename = true;
            bCopyApp = true;
            bDelete = true;
            bNewBiomodel = true;
        }
    }
    if (selectedPaths.length != 1) {
        bRename = false;
    }
    if (bAddNewApp) {
        if (addNewAppMenu == null) {
            addNewAppMenu = new JMenu("New Application");
            addNewAppDeterministicMenuItem = new JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
            addNewAppDeterministicMenuItem.addActionListener(eventHandler);
            addNewAppStochasticMenuItem = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
            addNewAppStochasticMenuItem.addActionListener(eventHandler);
            addNewAppRulebasedMenuItem = new JMenuItem(GuiConstants.MENU_TEXT_RULEBASED_APPLICATION);
            addNewAppRulebasedMenuItem.addActionListener(eventHandler);
            addNewAppMenu.add(addNewAppDeterministicMenuItem);
            addNewAppMenu.add(addNewAppStochasticMenuItem);
            addNewAppMenu.add(addNewAppRulebasedMenuItem);
        }
        popupMenu.add(addNewAppMenu);
    }
    if (bRemoveApps) {
        if (removeAppsMenu == null) {
            removeAppsMenu = new JMenuItem("Remove Apps...");
            removeAppsMenu.addActionListener(eventHandler);
        }
        popupMenu.add(removeAppsMenu);
    }
    if (bAddNew) {
        String addText = "New";
        if (folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) {
            addText += " Reaction";
        } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
            addText += " Compartment";
        } else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
            addText += " Species";
        } else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
            addText += " Molecule";
        } else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
            addText += " Observable";
        } else if (folderClass == DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE) {
            addText += " Simulation";
        }
        addNewMenuItem = new javax.swing.JMenuItem(addText);
        addNewMenuItem.addActionListener(eventHandler);
        popupMenu.add(addNewMenuItem);
    }
    if (bRename) {
        if (renameMenuItem == null) {
            renameMenuItem = new javax.swing.JMenuItem("Rename");
            renameMenuItem.addActionListener(eventHandler);
        }
        popupMenu.add(renameMenuItem);
    }
    if (bDelete) {
        if (deleteMenuItem == null) {
            deleteMenuItem = new javax.swing.JMenuItem("Delete");
            deleteMenuItem.addActionListener(eventHandler);
        }
        popupMenu.add(deleteMenuItem);
    }
    if (bCopyApp) {
        if (menuItemAppCopy == null) {
            menuItemAppCopy = new JMenuItem(GuiConstants.MENU_TEXT_APP_COPY);
            menuItemAppCopy.addActionListener(eventHandler);
            menuItemAppCopy.setActionCommand(GuiConstants.ACTIONCMD_COPY_APPLICATION);
        }
        if (menuAppCopyAs == null) {
            menuAppCopyAs = new JMenu(GuiConstants.MENU_TEXT_APP_COPYAS);
        }
        menuAppCopyAs.removeAll();
        SimulationContext selectedSimContext = getSelectedSimulationContext();
        if (selectedSimContext != null) {
            if (selectedSimContext.getGeometry().getDimension() == 0) {
                if (menuItemNonSpatialCopyDeterministic == null) {
                    menuItemNonSpatialCopyStochastic = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
                    menuItemNonSpatialCopyStochastic.setActionCommand(GuiConstants.ACTIONCMD_NON_SPATIAL_COPY_TO_STOCHASTIC_APPLICATION);
                    menuItemNonSpatialCopyStochastic.addActionListener(eventHandler);
                    menuItemNonSpatialCopyDeterministic = new javax.swing.JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
                    menuItemNonSpatialCopyDeterministic.setActionCommand(GuiConstants.ACTIONCMD_NON_SPATIAL_COPY_TO_DETERMINISTIC_APPLICATION);
                    menuItemNonSpatialCopyDeterministic.addActionListener(eventHandler);
                    menuItemNonSpatialCopyRulebased = new javax.swing.JMenuItem(GuiConstants.MENU_TEXT_RULEBASED_APPLICATION);
                    menuItemNonSpatialCopyRulebased.setActionCommand(GuiConstants.ACTIONCMD_NON_SPATIAL_COPY_TO_RULEBASED_APPLICATION);
                    menuItemNonSpatialCopyRulebased.addActionListener(eventHandler);
                }
                menuAppCopyAs.add(menuItemNonSpatialCopyDeterministic);
                menuAppCopyAs.add(menuItemNonSpatialCopyStochastic);
                menuAppCopyAs.add(menuItemNonSpatialCopyRulebased);
            } else {
                if (menuSpatialCopyAsNonSpatial == null) {
                    menuSpatialCopyAsNonSpatial = new JMenu(GuiConstants.MENU_TEXT_NON_SPATIAL_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialDeterministic = new JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialDeterministic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_NON_SPATIAL_DETERMINISTIC_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialDeterministic.addActionListener(eventHandler);
                    menuItemSpatialCopyAsNonSpatialStochastic = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialStochastic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_NON_SPATIAL_STOCHASTIC_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialStochastic.addActionListener(eventHandler);
                    menuItemSpatialCopyAsNonSpatialRulebased = new JMenuItem(GuiConstants.MENU_TEXT_RULEBASED_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialRulebased.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_NON_SPATIAL_RULEBASED_APPLICATION);
                    menuItemSpatialCopyAsNonSpatialRulebased.addActionListener(eventHandler);
                    menuSpatialCopyAsNonSpatial.add(menuItemSpatialCopyAsNonSpatialDeterministic);
                    menuSpatialCopyAsNonSpatial.add(menuItemSpatialCopyAsNonSpatialStochastic);
                    menuSpatialCopyAsNonSpatial.add(menuItemSpatialCopyAsNonSpatialRulebased);
                    menuSpatialCopyAsSpatial = new JMenu(GuiConstants.MENU_TEXT_SPATIAL_APPLICATION);
                    menuItemSpatialCopyAsSpatialDeterministic = new JMenuItem(GuiConstants.MENU_TEXT_DETERMINISTIC_APPLICATION);
                    menuItemSpatialCopyAsSpatialDeterministic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_SPATIAL_DETERMINISTIC_APPLICATION);
                    menuItemSpatialCopyAsSpatialDeterministic.addActionListener(eventHandler);
                    menuItemSpatialCopyAsSpatialStochastic = new JMenuItem(GuiConstants.MENU_TEXT_STOCHASTIC_APPLICATION);
                    menuItemSpatialCopyAsSpatialStochastic.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_SPATIAL_STOCHASTIC_APPLICATION);
                    menuItemSpatialCopyAsSpatialStochastic.addActionListener(eventHandler);
                    menuItemSpatialCopyAsSpatialRulebased = new JMenuItem(GuiConstants.MENU_TEXT_RULEBASED_APPLICATION);
                    menuItemSpatialCopyAsSpatialRulebased.setActionCommand(GuiConstants.ACTIONCMD_SPATIAL_COPY_TO_SPATIAL_RULEBASED_APPLICATION);
                    menuItemSpatialCopyAsSpatialRulebased.addActionListener(eventHandler);
                    menuSpatialCopyAsSpatial.add(menuItemSpatialCopyAsSpatialDeterministic);
                    menuSpatialCopyAsSpatial.add(menuItemSpatialCopyAsSpatialStochastic);
                // menuSpatialCopyAsSpatial.add(menuItemSpatialCopyAsSpatialRulebased);		// not supported yet, uncomment when time comes
                }
                menuAppCopyAs.add(menuSpatialCopyAsNonSpatial);
                menuAppCopyAs.add(menuSpatialCopyAsSpatial);
            }
        }
        if (popupMenu.getComponents().length > 0) {
            popupMenu.add(new JSeparator());
        }
        popupMenu.add(menuItemAppCopy);
        popupMenu.add(menuAppCopyAs);
    }
    if (bNewBiomodel) {
        menuItemNewBiomodelFromApp = new JMenuItem(GuiConstants.MENU_TEXT_APP_NEWBIOMODEL);
        menuItemNewBiomodelFromApp.addActionListener(eventHandler);
        popupMenu.add(menuItemNewBiomodelFromApp);
    }
    if (bExpand) {
        if (expandAllMenuItem == null) {
            popupMenuSeparator = new JSeparator();
            expandAllMenuItem = new javax.swing.JMenuItem("Expand All");
            collapseAllMenuItem = new javax.swing.JMenuItem("Collapse All");
            expandAllMenuItem.addActionListener(eventHandler);
            collapseAllMenuItem.addActionListener(eventHandler);
        }
        if (popupMenu.getComponents().length > 0) {
            popupMenu.add(popupMenuSeparator);
        }
        popupMenu.add(expandAllMenuItem);
        popupMenu.add(collapseAllMenuItem);
    }
}
Also used : DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) BioModelNode(cbit.vcell.desktop.BioModelNode) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) SimulationContext(cbit.vcell.mapping.SimulationContext) JSeparator(javax.swing.JSeparator) TreePath(javax.swing.tree.TreePath) JMenuItem(javax.swing.JMenuItem) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Example 9 with DocumentEditorTreeFolderNode

use of cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode in project vcell by virtualcell.

the class MathModelEditor method popupMenuActionPerformed.

@Override
protected void popupMenuActionPerformed(DocumentEditorPopupMenuAction action, String actionCommand) {
    switch(action) {
        case add_new:
            try {
                Object obj = documentEditorTree.getLastSelectedPathComponent();
                if (obj == null || !(obj instanceof BioModelNode)) {
                    return;
                }
                BioModelNode selectedNode = (BioModelNode) obj;
                Object userObject = selectedNode.getUserObject();
                if (userObject instanceof DocumentEditorTreeFolderNode) {
                    DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) userObject).getFolderClass();
                    switch(folderClass) {
                        case MATH_SIMULATIONS_NODE:
                            Object newsim = mathModel.addNewSimulation(SimulationOwner.DEFAULT_SIM_NAME_PREFIX);
                            selectionManager.setSelectedObjects(new Object[] { newsim });
                            break;
                        case MATH_OUTPUT_FUNCTIONS_NODE:
                            break;
                    }
                }
            } catch (Exception ex) {
                DialogUtils.showErrorDialog(this, ex.getMessage());
            }
            break;
    }
}
Also used : DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) CSGObject(cbit.vcell.geometry.CSGObject) BioModelNode(cbit.vcell.desktop.BioModelNode) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass)

Example 10 with DocumentEditorTreeFolderNode

use of cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode in project vcell by virtualcell.

the class MathModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    JComponent bottomComponent = rightBottomEmptyPanel;
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    boolean bShowInDatabaseProperties = false;
    if (selections != null && selections.length == 1) {
        Object singleSelection = selections[0];
        if (singleSelection == mathModel) {
            bottomComponent = mathModelEditorAnnotationPanel;
        } else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
            DocumentEditorTreeFolderNode folderNode = (DocumentEditorTreeFolderNode) singleSelection;
            if (folderNode.getFolderClass() == DocumentEditorTreeFolderClass.MATH_ANNOTATION_NODE) {
                bottomComponent = mathModelEditorAnnotationPanel;
            } else if (folderNode.getFolderClass() == DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE) {
                bottomComponent = simulationSummaryPanel;
            }
        } 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 Simulation) {
            bottomComponent = simulationSummaryPanel;
        } else if (singleSelection instanceof CSGObject) {
            bottomComponent = csgObjectPropertiesPanel;
            csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
        }
    }
    if (bShowInDatabaseProperties) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel) {
                break;
            }
        }
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
        }
    }
    if (rightSplitPane.getBottomComponent() != rightBottomTabbedPane) {
        rightSplitPane.setBottomComponent(rightBottomTabbedPane);
    }
    if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightBottomTabbedPane.repaint();
    }
    rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
Also used : Simulation(cbit.vcell.solver.Simulation) TabCloseIcon(cbit.vcell.client.desktop.biomodel.TabCloseIcon) JComponent(javax.swing.JComponent) BioModelInfo(org.vcell.util.document.BioModelInfo) GeometryInfo(cbit.vcell.geometry.GeometryInfo) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) CSGObject(cbit.vcell.geometry.CSGObject) MathModelInfo(org.vcell.util.document.MathModelInfo) CSGObject(cbit.vcell.geometry.CSGObject) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Aggregations

DocumentEditorTreeFolderNode (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode)10 DocumentEditorTreeFolderClass (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass)9 BioModelNode (cbit.vcell.desktop.BioModelNode)6 BioModel (cbit.vcell.biomodel.BioModel)5 SimulationContext (cbit.vcell.mapping.SimulationContext)5 CSGObject (cbit.vcell.geometry.CSGObject)4 Component (java.awt.Component)4 JComponent (javax.swing.JComponent)4 Model (cbit.vcell.model.Model)3 ListSelectionModel (javax.swing.ListSelectionModel)3 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)2 GeometryInfo (cbit.vcell.geometry.GeometryInfo)2 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)2 MathModel (cbit.vcell.mathmodel.MathModel)2 RbmObservable (cbit.vcell.model.RbmObservable)2 Simulation (cbit.vcell.solver.Simulation)2 MolecularType (org.vcell.model.rbm.MolecularType)2 BioPaxObject (org.vcell.pathway.BioPaxObject)2 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)1 ApplicationActionCommand (cbit.vcell.client.constants.ApplicationActionCommand)1