Search in sources :

Example 1 with ChildWindowManager

use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.

the class BioModelEditorApplicationsPanel method compareButtonPressed.

private void compareButtonPressed() {
    int[] rows = table.getSelectedRows();
    if (rows == null || rows.length != 2) {
        return;
    }
    try {
        SimulationContext simContext1 = tableModel.getValueAt(rows[0]);
        SimulationContext simContext2 = tableModel.getValueAt(rows[1]);
        BioModel bioModel = simContext1.getBioModel();
        MathMappingCallback callback = new MathMappingCallback() {

            @Override
            public void setProgressFraction(float fractionDone) {
                Thread.dumpStack();
                System.out.println("---> stdout mathMapping: progress = " + (fractionDone * 100.0) + "% done");
            }

            @Override
            public void setMessage(String message) {
                Thread.dumpStack();
                System.out.println("---> stdout mathMapping: message = " + message);
            }

            @Override
            public boolean isInterrupted() {
                return false;
            }
        };
        simContext1.refreshMathDescription(callback, NetworkGenerationRequirements.ComputeFullStandardTimeout);
        simContext2.refreshMathDescription(callback, NetworkGenerationRequirements.ComputeFullStandardTimeout);
        Xmlproducer xmlProducer = new Xmlproducer(false);
        String simContext1XML = XmlUtil.xmlToString(xmlProducer.getXML(simContext1, bioModel));
        String simContext2XML = XmlUtil.xmlToString(xmlProducer.getXML(simContext2, bioModel));
        DiffConfiguration comparisonSetting = DiffConfiguration.COMPARE_DOCS_OTHER;
        XmlTreeDiff diffTree = XmlHelper.compareMerge(simContext1XML, simContext2XML, comparisonSetting, true);
        String baselineDesc = "application " + simContext1.getName();
        String modifiedDesc = "application " + simContext2.getName();
        TMLPanel comparePanel = new TMLPanel();
        comparePanel.setXmlTreeDiff(diffTree);
        comparePanel.setBaselineVersionDescription(baselineDesc);
        comparePanel.setModifiedVersionDescription(modifiedDesc);
        ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(this);
        String title = "comparing application " + simContext1.getName() + " and " + simContext2.getName();
        ChildWindow childWindow = childWindowManager.addChildWindow(comparePanel, diffTree, title, true);
        childWindow.setSize(new Dimension(600, 600));
        childWindow.show();
    } catch (XmlParseException e) {
        e.printStackTrace();
        DialogUtils.showErrorDialog(this, "failed to compare applications: \n\n" + e.getMessage());
    }
}
Also used : DiffConfiguration(cbit.xml.merge.XmlTreeDiff.DiffConfiguration) MathMappingCallback(cbit.vcell.mapping.SimulationContext.MathMappingCallback) Xmlproducer(cbit.vcell.xml.Xmlproducer) XmlTreeDiff(cbit.xml.merge.XmlTreeDiff) ChildWindowManager(cbit.vcell.client.ChildWindowManager) Dimension(java.awt.Dimension) XmlParseException(cbit.vcell.xml.XmlParseException) SimulationContext(cbit.vcell.mapping.SimulationContext) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) TMLPanel(cbit.xml.merge.gui.TMLPanel) BioModel(cbit.vcell.biomodel.BioModel)

Example 2 with ChildWindowManager

use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.

the class DataValueSurfaceViewer method jButtonDSR_ActionPerformed.

/**
 * Comment
 */
private void jButtonDSR_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
    dsr.setModeInstruction("(CTRL-CLICK on surface to add/remove from selection)");
    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(DataValueSurfaceViewer.this);
    ChildWindow childWindow = childWindowManager.getChildWindowFromContentPane(dsr);
    if (childWindow == null) {
        childWindow = childWindowManager.addChildWindow(dsr, dsr, "Define Region Of Interest");
        childWindow.pack();
        childWindow.setIsCenteredOnParent();
    }
    childWindow.show();
}
Also used : ChildWindowManager(cbit.vcell.client.ChildWindowManager) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Example 3 with ChildWindowManager

use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.

the class BioModelEditorModelPanel method showDiagramView.

private void showDiagramView() {
    if (tabbedPane.getSelectedIndex() == ModelPanelTabID.reaction_diagram.ordinal()) {
        if (tabbedPane.getComponentAt(ModelPanelTabID.reaction_diagram.ordinal()) != modelPanelTabs[ModelPanelTabID.reaction_diagram.ordinal()].getComponent()) {
            ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(this);
            if (childWindowManager != null) {
                ChildWindow childWindow = childWindowManager.getChildWindowFromContext(this.reactionCartoonEditorPanel);
                if (childWindow != null) {
                    childWindow.setIsCenteredOnParent();
                    childWindow.show();
                }
            }
        }
    }
}
Also used : ChildWindowManager(cbit.vcell.client.ChildWindowManager) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Example 4 with ChildWindowManager

use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.

the class BioModelEditorModelPanel method floatDiagramView.

private void floatDiagramView(boolean bFloating) {
    ChildWindowManager childWindowManager = null;
    try {
        childWindowManager = ChildWindowManager.findChildWindowManager(this);
        if (childWindowManager != null) {
            lastChildWindowManager = childWindowManager;
        }
    } catch (Exception e) {
        if (childWindowManager == null && lastChildWindowManager != null) {
            childWindowManager = lastChildWindowManager;
        } else {
            throw (e);
        }
    }
    if (bFloating) {
        // 
        // insert dummy panel into tabbed pane, real one is floating now.
        // 
        tabbedPane.setComponentAt(ModelPanelTabID.reaction_diagram.ordinal(), new JPanel());
        // 
        // create new panel to add to client window (and hold the reactionCartoonEditorPanel)
        // 
        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(p, BorderLayout.NORTH);
        panel.add(reactionCartoonEditorPanel, BorderLayout.CENTER);
        ChildWindow childWindow = childWindowManager.addChildWindow(panel, reactionCartoonEditorPanel, "model diagram");
        childWindow.setSize(500, 400);
        childWindow.setIsCenteredOnParent();
        childWindow.addChildWindowListener(new ChildWindowListener() {

            public void closing(ChildWindow childWindow) {
                reactionCartoonEditorPanel.setFloatingRequested(false);
            }
        });
        childWindow.show();
    // diagramViewInternalFrame.setFrameIcon(new ImageIcon(getClass().getResource("/images/step.gif")));
    } else {
        if (childWindowManager != null) {
            ChildWindow childWindow = childWindowManager.getChildWindowFromContext(reactionCartoonEditorPanel);
            if (childWindow != null) {
                childWindowManager.closeChildWindow(childWindow);
            }
        }
        tabbedPane.setComponentAt(ModelPanelTabID.reaction_diagram.ordinal(), modelPanelTabs[ModelPanelTabID.reaction_diagram.ordinal()].getComponent());
        tabbedPane.setSelectedIndex(ModelPanelTabID.reaction_diagram.ordinal());
    }
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) ChildWindowManager(cbit.vcell.client.ChildWindowManager) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) ChildWindowListener(cbit.vcell.client.ChildWindowListener) PropertyVetoException(java.beans.PropertyVetoException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) ModelException(cbit.vcell.model.ModelException) UserCancelException(org.vcell.util.UserCancelException)

Example 5 with ChildWindowManager

use of cbit.vcell.client.ChildWindowManager in project vcell by virtualcell.

the class ApplicationComponents method getDataViewerFrames.

/**
 * Insert the method's description here.
 * Creation date: (6/3/2004 4:40:40 PM)
 */
public ChildWindow[] getDataViewerFrames(Component component) {
    SimulationWindow[] simWindows = (SimulationWindow[]) BeanUtils.getArray(simulationWindowsHash.elements(), SimulationWindow.class);
    ArrayList<ChildWindow> childWindows = new ArrayList<ChildWindow>();
    ChildWindowManager childWindowManager = ChildWindowManager.findChildWindowManager(component);
    for (int i = 0; i < simWindows.length; i++) {
        ChildWindow childWindow = childWindowManager.getChildWindowFromContext(simWindows[i]);
        if (childWindow != null) {
            childWindows.add(childWindow);
        }
    }
    return childWindows.toArray(new ChildWindow[childWindows.size()]);
}
Also used : ArrayList(java.util.ArrayList) SimulationWindow(cbit.vcell.client.desktop.simulation.SimulationWindow) ChildWindowManager(cbit.vcell.client.ChildWindowManager) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow)

Aggregations

ChildWindowManager (cbit.vcell.client.ChildWindowManager)14 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)14 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)4 SinglePoint (cbit.vcell.geometry.SinglePoint)4 Dimension (java.awt.Dimension)4 Point (java.awt.Point)4 Hashtable (java.util.Hashtable)4 SpatialSelection (cbit.vcell.simdata.SpatialSelection)3 SpatialSelectionVolume (cbit.vcell.simdata.SpatialSelectionVolume)3 PropertyVetoException (java.beans.PropertyVetoException)3 UserCancelException (org.vcell.util.UserCancelException)3 ImageException (cbit.image.ImageException)2 SingleXPlot2D (cbit.plot.SingleXPlot2D)2 PlotPane (cbit.plot.gui.PlotPane)2 MathMappingCallback (cbit.vcell.mapping.SimulationContext.MathMappingCallback)2 TaskCallbackMessage (cbit.vcell.mapping.TaskCallbackMessage)2 VariableType (cbit.vcell.math.VariableType)2 SimpleSymbolTable (cbit.vcell.parser.SimpleSymbolTable)2 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)2 SSHelper (cbit.vcell.simdata.SpatialSelection.SSHelper)2