Search in sources :

Example 1 with GeometryViewer

use of cbit.vcell.geometry.gui.GeometryViewer in project vcell by virtualcell.

the class MathModelWindowManager method actionPerformed.

/**
 * Invoked when an action occurs.
 */
public void actionPerformed(java.awt.event.ActionEvent e) {
    String actionCommand = e.getActionCommand();
    final Object source = e.getSource();
    if (source instanceof GeometryViewer && actionCommand.equals(GuiConstants.ACTIONCMD_CREATE_GEOMETRY) || actionCommand.equals(GuiConstants.ACTIONCMD_EDITCURRENTSPATIAL_GEOMETRY)) {
        AsynchClientTask geomRegionsTask = new AsynchClientTask("Update Geometric regions", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                Geometry newGeom = (Geometry) hashTable.get("doc");
                ClientRequestManager.continueAfterMathModelGeomChangeWarning(MathModelWindowManager.this, newGeom);
                newGeom.precomputeAll(new GeometryThumbnailImageFactoryAWT());
            }
        };
        AsynchClientTask applyGeomTask = new AsynchClientTask("Apply Geometry", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                Geometry newGeom = (Geometry) hashTable.get("doc");
                if (newGeom.getName() == null) {
                    newGeom.setName(getMathModel().getName() + "_" + BeanUtils.generateDateTimeString());
                }
                ((MathModel) getVCDocument()).getMathDescription().setGeometry(newGeom);
            }
        };
        createGeometry(getMathModel().getMathDescription().getGeometry(), new AsynchClientTask[] { /*editSelectTask,*/
        geomRegionsTask, applyGeomTask }, TopLevelWindowManager.DEFAULT_CREATEGEOM_SELECT_DIALOG_TITLE, TopLevelWindowManager.APPLY_GEOMETRY_BUTTON_TEXT, (actionCommand.equals(GuiConstants.ACTIONCMD_EDITCURRENTSPATIAL_GEOMETRY) ? new DocumentWindowManager.GeometrySelectionInfo() : null));
    }
    if (source instanceof GeometryViewer && actionCommand.equals(GuiConstants.ACTIONCMD_CHANGE_GEOMETRY)) {
        Hashtable<String, Object> hashTable = new Hashtable<String, Object>();
        hashTable.put(SELECT_GEOM_POPUP, new Boolean(true));
        getRequestManager().changeGeometry(this, null, hashTable);
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) GeometryViewer(cbit.vcell.geometry.gui.GeometryViewer) Hashtable(java.util.Hashtable)

Example 2 with GeometryViewer

use of cbit.vcell.geometry.gui.GeometryViewer in project vcell by virtualcell.

the class GeometrySummaryViewer method getGeometryViewer.

/**
 * Return the GeometrySummaryPanel1 property value.
 * @return cbit.vcell.geometry.gui.GeometrySummaryPanel
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private GeometryViewer getGeometryViewer() {
    if (geometryViewer == null) {
        try {
            geometryViewer = new GeometryViewer();
            geometryViewer.setName("GeometryViewer");
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return geometryViewer;
}
Also used : GeometryViewer(cbit.vcell.geometry.gui.GeometryViewer)

Example 3 with GeometryViewer

use of cbit.vcell.geometry.gui.GeometryViewer in project vcell by virtualcell.

the class ApplicationGeometryPanel method initialize.

@Override
protected void initialize() {
    super.initialize();
    geometryViewer = new GeometryViewer();
    structureMappingCartoonPanel = new StructureMappingCartoonPanel();
    spatialEntitiesPanel = new SpatialEntitiesPanel();
    GeometryPanelTab[] geometryPanelTabs = new GeometryPanelTab[GeometryPanelTabID.values().length];
    geometryPanelTabs[GeometryPanelTabID.structure_mapping.ordinal()] = new GeometryPanelTab(GeometryPanelTabID.structure_mapping, structureMappingCartoonPanel, null);
    geometryPanelTabs[GeometryPanelTabID.geometry_definition.ordinal()] = new GeometryPanelTab(GeometryPanelTabID.geometry_definition, geometryViewer, null);
    geometryPanelTabs[GeometryPanelTabID.spatial_entities.ordinal()] = new GeometryPanelTab(GeometryPanelTabID.spatial_entities, spatialEntitiesPanel, null);
    for (GeometryPanelTab tab : geometryPanelTabs) {
        tab.component.setBorder(GuiConstants.TAB_PANEL_BORDER);
        tabbedPane.addTab(tab.id.title, tab.icon, tab.component);
    }
}
Also used : GeometryViewer(cbit.vcell.geometry.gui.GeometryViewer) StructureMappingCartoonPanel(cbit.vcell.mapping.gui.StructureMappingCartoonPanel)

Example 4 with GeometryViewer

use of cbit.vcell.geometry.gui.GeometryViewer in project vcell by virtualcell.

the class BioModelWindowManager method actionPerformed.

/**
 * Invoked when an action occurs.
 */
public void actionPerformed(java.awt.event.ActionEvent e) {
    String actionCommand = e.getActionCommand();
    final Object source = e.getSource();
    if (source instanceof GeometryViewer && (actionCommand.equals(GuiConstants.ACTIONCMD_CREATE_GEOMETRY) || actionCommand.equals(GuiConstants.ACTIONCMD_EDITCURRENTSPATIAL_GEOMETRY))) {
        final GeometryViewer geometryViewer = (GeometryViewer) source;
        AsynchClientTask precomputeAllTask = new AsynchClientTask("precomputeAll geometry", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                Geometry newGeom = (Geometry) hashTable.get("doc");
                if (newGeom != null) {
                    newGeom.precomputeAll(new GeometryThumbnailImageFactoryAWT());
                }
            }
        };
        AsynchClientTask setGeomOnSimContextTask = new AsynchClientTask("Setting geometry on application", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            @Override
            public void run(Hashtable<String, Object> hashTable) throws Exception {
                Geometry newGeom = (Geometry) hashTable.get("doc");
                for (SimulationContext simulationContext : getBioModel().getSimulationContexts()) {
                    if (simulationContext == geometryViewer.getGeometryOwner()) {
                        if (newGeom.getName() == null) {
                            newGeom.setName(getBioModel().getName() + "_" + (simulationContext.getName() + "_" + BeanUtils.generateDateTimeString()));
                        }
                        simulationContext.setGeometry(newGeom);
                        return;
                    }
                }
                Geometry origGeom = geometryViewer.getGeometryOwner().getGeometry();
                throw new IllegalArgumentException("Couldn't find matching application editor for orig geom '" + origGeom.getName() + "' key=" + origGeom.getKey() + " in application hash.");
            }
        };
        Geometry currentGeometry = geometryViewer.getGeometryOwner().getGeometry();
        createGeometry(currentGeometry, new AsynchClientTask[] { /*oldEditorTask,*/
        precomputeAllTask, setGeomOnSimContextTask }, (e.toString().equals(FIELD_DATA_FLAG) ? FIELD_DATA_FLAG : TopLevelWindowManager.DEFAULT_CREATEGEOM_SELECT_DIALOG_TITLE), TopLevelWindowManager.APPLY_GEOMETRY_BUTTON_TEXT, (actionCommand.equals(GuiConstants.ACTIONCMD_EDITCURRENTSPATIAL_GEOMETRY) ? new DocumentWindowManager.GeometrySelectionInfo() : null));
    }
    if (source instanceof MathematicsPanel && actionCommand.equals(GuiConstants.ACTIONCMD_CREATE_MATH_MODEL)) {
        SimulationContext sc = ((MathematicsPanel) source).getSimulationContext();
        getRequestManager().createMathModelFromApplication(this, "Untitled", sc);
    }
    if (source instanceof GeometryViewer && actionCommand.equals(GuiConstants.ACTIONCMD_CHANGE_GEOMETRY)) {
        final GeometryViewer geometryViewer = (GeometryViewer) source;
        Hashtable<String, Object> hashTable = new Hashtable<String, Object>();
        hashTable.put(SELECT_GEOM_POPUP, new Boolean(true));
        getRequestManager().changeGeometry(this, (SimulationContext) geometryViewer.getGeometryOwner(), hashTable);
    }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) GeometryViewer(cbit.vcell.geometry.gui.GeometryViewer) Hashtable(java.util.Hashtable) SimulationContext(cbit.vcell.mapping.SimulationContext) MathematicsPanel(cbit.vcell.client.desktop.biomodel.MathematicsPanel) Geometry(cbit.vcell.geometry.Geometry) GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT)

Example 5 with GeometryViewer

use of cbit.vcell.geometry.gui.GeometryViewer in project vcell by virtualcell.

the class MathModelEditor method initialize.

private void initialize() {
    try {
        rightSplitPane.setDividerLocation(400);
        rightSplitPane.setBottomComponent(rightBottomTabbedPane);
        mathModelEditorTreeModel = new MathModelEditorTreeModel(documentEditorTree);
        mathModelEditorTreeModel.setSelectionManager(selectionManager);
        mathModelEditorTreeCellRenderer = new MathModelEditorTreeCellRenderer();
        documentEditorTree.setModel(mathModelEditorTreeModel);
        documentEditorTree.setCellRenderer(mathModelEditorTreeCellRenderer);
        vcmlEditorPanel = new VCMLEditorPanel();
        vcmlEditorPanel.setMinimumSize(new java.awt.Dimension(198, 148));
        rightSplitPane.setTopComponent(vcmlEditorPanel);
        geometryViewer = new GeometryViewer();
        geometryViewer.setSelectionManager(selectionManager);
        geometryViewer.setIssueManager(issueManager);
        simulationListPanel = new SimulationListPanel();
        simulationListPanel.setSelectionManager(selectionManager);
        simulationListPanel.setIssueManager(issueManager);
        outputFunctionsPanel = new OutputFunctionsPanel();
        outputFunctionsPanel.setSelectionManager(selectionManager);
        outputFunctionsPanel.setIssueManager(issueManager);
        simulationSummaryPanel = new SimulationSummaryPanel();
        simulationSummaryPanel.setSelectionManager(selectionManager);
        simulationSummaryPanel.setIssueManager(issueManager);
        mathModelEditorAnnotationPanel.setSelectionManager(selectionManager);
        mathModelEditorAnnotationPanel.setIssueManager(issueManager);
        csgObjectPropertiesPanel = new CSGObjectPropertiesPanel();
        csgObjectPropertiesPanel.setSelectionManager(selectionManager);
        csgObjectPropertiesPanel.setIssueManager(issueManager);
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : SimulationListPanel(cbit.vcell.client.desktop.simulation.SimulationListPanel) OutputFunctionsPanel(cbit.vcell.client.desktop.simulation.OutputFunctionsPanel) SimulationSummaryPanel(cbit.vcell.solver.ode.gui.SimulationSummaryPanel) GeometryViewer(cbit.vcell.geometry.gui.GeometryViewer) CSGObjectPropertiesPanel(cbit.vcell.geometry.gui.CSGObjectPropertiesPanel)

Aggregations

GeometryViewer (cbit.vcell.geometry.gui.GeometryViewer)5 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 Geometry (cbit.vcell.geometry.Geometry)2 GeometryThumbnailImageFactoryAWT (cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT)2 Hashtable (java.util.Hashtable)2 MathematicsPanel (cbit.vcell.client.desktop.biomodel.MathematicsPanel)1 OutputFunctionsPanel (cbit.vcell.client.desktop.simulation.OutputFunctionsPanel)1 SimulationListPanel (cbit.vcell.client.desktop.simulation.SimulationListPanel)1 CSGObjectPropertiesPanel (cbit.vcell.geometry.gui.CSGObjectPropertiesPanel)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1 StructureMappingCartoonPanel (cbit.vcell.mapping.gui.StructureMappingCartoonPanel)1 SimulationSummaryPanel (cbit.vcell.solver.ode.gui.SimulationSummaryPanel)1