Search in sources :

Example 1 with TabCloseIcon

use of cbit.vcell.client.desktop.biomodel.TabCloseIcon 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)1 TabCloseIcon (cbit.vcell.client.desktop.biomodel.TabCloseIcon)1 CSGObject (cbit.vcell.geometry.CSGObject)1 GeometryInfo (cbit.vcell.geometry.GeometryInfo)1 Simulation (cbit.vcell.solver.Simulation)1 Component (java.awt.Component)1 JComponent (javax.swing.JComponent)1 BioModelInfo (org.vcell.util.document.BioModelInfo)1 MathModelInfo (org.vcell.util.document.MathModelInfo)1