Search in sources :

Example 6 with UserCancelException

use of org.vcell.util.UserCancelException in project vcell by virtualcell.

the class TestingFrameworkWindowManager method queryTCritCrossRef.

@SuppressWarnings("serial")
public void queryTCritCrossRef(final TestSuiteInfoNew tsin, final TestCriteriaNew tcrit, final String varName) {
    try {
        QueryTestCriteriaCrossRefOP queryTestCriteriaCrossRefOP = new QueryTestCriteriaCrossRefOP(tsin.getTSKey(), tcrit.getTCritKey(), varName);
        TestCriteriaCrossRefOPResults testCriteriaCrossRefOPResults = (TestCriteriaCrossRefOPResults) getRequestManager().getDocumentManager().doTestSuiteOP(queryTestCriteriaCrossRefOP);
        final Vector<TestCriteriaCrossRefOPResults.CrossRefData> xrefDataV = testCriteriaCrossRefOPResults.getCrossRefData();
        final TestSuiteInfoNew[] testSuiteInfos = getRequestManager().getDocumentManager().getTestSuiteInfos();
        Vector<TestSuiteInfoNew> missingTestSuites = new Vector<TestSuiteInfoNew>();
        for (int i = 0; i < testSuiteInfos.length; i++) {
            boolean bFound = false;
            for (int j = 0; j < xrefDataV.size(); j++) {
                if (xrefDataV.elementAt(j).tsVersion.equals(testSuiteInfos[i].getTSID())) {
                    bFound = true;
                    break;
                }
            }
            if (!bFound) {
                missingTestSuites.add(testSuiteInfos[i]);
            }
        }
        TestCriteriaCrossRefOPResults.CrossRefData xrefDataSource = null;
        for (int i = 0; i < xrefDataV.size(); i++) {
            if (xrefDataV.elementAt(i).tcritKey.equals(tcrit.getTCritKey())) {
                xrefDataSource = xrefDataV.elementAt(i);
                break;
            }
        }
        if (xrefDataSource == null) {
            throw new RuntimeException("Couldn't find source Test Criteria in query results.");
        }
        final int numColumns = 8;
        final int XREFDATA_ALLOWANCE = 1;
        final int TSKEY_ALLOWANCE = 1;
        final int XREFDATA_OFFSET = numColumns;
        final int TSDATE_OFFSET = 1;
        final int VARNAME_OFFSET = 3;
        final int TSKEYMISSING_OFFSET = numColumns + 1;
        final String[] colNames = new String[numColumns];
        final Object[][] sourceRows = new Object[xrefDataV.size() + missingTestSuites.size()][numColumns + XREFDATA_ALLOWANCE + TSKEY_ALLOWANCE];
        String sourceTestSuite = null;
        colNames[0] = "tsVersion";
        colNames[1] = "tsDate";
        colNames[2] = "tsBaseVersion";
        colNames[3] = "varName";
        colNames[4] = "RelErorr";
        colNames[5] = "limitRelErorr";
        colNames[6] = "limitAbsErorr";
        colNames[7] = "AbsErorr";
        for (int i = 0; i < xrefDataV.size(); i++) {
            sourceRows[i][colNames.length] = xrefDataV.elementAt(i);
            if (xrefDataV.elementAt(i).tcritKey.equals(queryTestCriteriaCrossRefOP.getTestCriterium())) {
                sourceTestSuite = xrefDataV.elementAt(i).tsVersion;
            }
            sourceRows[i][0] = xrefDataV.elementAt(i).tsVersion;
            sourceRows[i][2] = (xrefDataV.elementAt(i).tsRefVersion == null ? (xrefDataV.elementAt(i).regressionModelID == null ? /* && xrefDataV.elementAt(i).regressionMMref==null*/
            "" : "Ref Model exist BUT outside of TestSuites") : xrefDataV.elementAt(i).tsRefVersion);
            sourceRows[i][6] = xrefDataV.elementAt(i).maxAbsErorr;
            sourceRows[i][5] = xrefDataV.elementAt(i).maxRelErorr;
            if (xrefDataV.elementAt(i).varName != null) {
                sourceRows[i][VARNAME_OFFSET] = xrefDataV.elementAt(i).varName;
                sourceRows[i][4] = xrefDataV.elementAt(i).varCompSummary.getRelativeError();
                sourceRows[i][7] = xrefDataV.elementAt(i).varCompSummary.getAbsoluteError();
            } else {
                sourceRows[i][VARNAME_OFFSET] = "-No Report-";
                // "No Report";
                sourceRows[i][4] = null;
                // "No Report";
                sourceRows[i][7] = null;
            }
            for (int j = 0; j < testSuiteInfos.length; j++) {
                if (xrefDataV.elementAt(i).tsVersion.equals(testSuiteInfos[j].getTSID())) {
                    sourceRows[i][1] = testSuiteInfos[j].getTSDate();
                    break;
                }
            }
        }
        for (int i = xrefDataV.size(); i < sourceRows.length; i++) {
            sourceRows[i][0] = missingTestSuites.elementAt(i - xrefDataV.size()).getTSID();
            sourceRows[i][TSDATE_OFFSET] = missingTestSuites.elementAt(i - xrefDataV.size()).getTSDate();
            sourceRows[i][TSKEYMISSING_OFFSET] = missingTestSuites.elementAt(i - xrefDataV.size()).getTSKey();
        }
        // Arrays.sort(rows,
        // new Comparator<Object[]>(){
        // public int compare(Object[] o1, Object[] o2) {
        // return ((String)o1[0]).compareToIgnoreCase((String)o2[0]);
        // //						if(o1[0].equals(o2[0])){
        // //							return o1[3].compareToIgnoreCase(o2[3]);
        // //						}
        // //						return o1[0].compareToIgnoreCase(o2[0]);
        // }
        // }
        // );
        final VCellSortTableModel<Object[]> tableModel = new VCellSortTableModel<Object[]>(colNames) {

            public Class<?> getColumnClass(int columnIndex) {
                if (columnIndex == TSDATE_OFFSET) {
                    return Date.class;
                } else if (columnIndex >= 4 && columnIndex <= 7) {
                    return Double.class;
                }
                return String.class;
            }

            public boolean isCellEditable(int row, int column) {
                return false;
            }

            public Object getValueAt(int rowIndex, int columnIndex) {
                return getValueAt(rowIndex)[columnIndex];
            }

            public Comparator<Object[]> getComparator(final int col, final boolean ascending) {
                return new Comparator<Object[]>() {

                    public int compare(Object[] o1, Object[] o2) {
                        if (o1[col] == null && o2[col] == null) {
                            return 0;
                        }
                        // if(ascending){
                        if (o1[col] == null) {
                            return 1;
                        }
                        if (o2[col] == null) {
                            return -1;
                        }
                        // }
                        if (getColumnClass(col).equals(String.class)) {
                            if (ascending) {
                                return ((String) o1[col]).compareToIgnoreCase(((String) o2[col]));
                            } else {
                                return ((String) o2[col]).compareToIgnoreCase(((String) o1[col]));
                            }
                        } else if (getColumnClass(col).equals(Date.class)) {
                            if (ascending) {
                                return ((Date) o1[col]).compareTo(((Date) o2[col]));
                            }
                            return ((Date) o2[col]).compareTo(((Date) o1[col]));
                        } else if (getColumnClass(col).equals(Double.class)) {
                            if (ascending) {
                                return ((Double) o1[col]).compareTo(((Double) o2[col]));
                            }
                            return ((Double) o2[col]).compareTo(((Double) o1[col]));
                        }
                        throw new RuntimeException("TestSuite XRef Query unexpecte column class " + getColumnClass(col).getName());
                    }
                };
            }
        };
        tableModel.setData(Arrays.asList(sourceRows));
        // Create table
        final JSortTable table = new JSortTable();
        table.setModel(tableModel);
        table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        final JScrollPane scrollPaneContentPane = new JScrollPane(table);
        table.setPreferredScrollableViewportSize(new Dimension(500, 250));
        table.getColumnModel().getColumn(TSDATE_OFFSET).setCellRenderer(new DefaultTableCellRenderer() {

            // DateFormat formatter = DateFormat.getDateTimeInstance();
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                return super.getTableCellRendererComponent(table, (value == null ? null : ((Date) value).toString()), /*formatter.format((Date)value)*/
                isSelected, hasFocus, row, column);
            }
        });
        DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer() {

            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                return super.getTableCellRendererComponent(table, (value == null ? null : ((Double) value).toString()), /*formatter.format((Date)value)*/
                isSelected, hasFocus, row, column);
            }
        };
        table.getColumnModel().getColumn(4).setCellRenderer(dtcr);
        table.getColumnModel().getColumn(5).setCellRenderer(dtcr);
        table.getColumnModel().getColumn(6).setCellRenderer(dtcr);
        table.getColumnModel().getColumn(7).setCellRenderer(dtcr);
        // table.getColumnModel().getColumn(4).setCellRenderer(
        // new DefaultTableCellRenderer(){
        // public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        // return super.getTableCellRendererComponent(table,(value == null?null:((Double)value).toString())/*formatter.format((Date)value)*/, isSelected, hasFocus, row, column);
        // }
        // }
        // );
        // table.getTableHeader().setReorderingAllowed(false);
        // Popup Menu
        final TestCriteriaCrossRefOPResults.CrossRefData xrefDataSourceFinal = xrefDataSource;
        final JPopupMenu queryPopupMenu = new JPopupMenu();
        final JMenuItem changeLimitsMenuItem = new JMenuItem("Change Selected Error Limits...");
        final String OPEN_MODEL = "Open Model(s)";
        final JMenuItem openModelMenuItem = new JMenuItem(OPEN_MODEL);
        final String OPEN_REGRREFMODEL = "Open Regr Ref Model(s)";
        final JMenuItem openRegrRefModelMenuItem = new JMenuItem(OPEN_REGRREFMODEL);
        final String SELECT_REF_IN_TREE = "Select in Tree View";
        final JMenuItem showInTreeMenuItem = new JMenuItem(SELECT_REF_IN_TREE);
        final String SELECT_REGR_REF_IN_TREE = "Select RegrRef TCase in Tree View";
        final JMenuItem showRegrRefInTreeMenuItem = new JMenuItem(SELECT_REGR_REF_IN_TREE);
        queryPopupMenu.add(changeLimitsMenuItem);
        queryPopupMenu.add(openModelMenuItem);
        queryPopupMenu.add(openRegrRefModelMenuItem);
        queryPopupMenu.add(showInTreeMenuItem);
        queryPopupMenu.add(showRegrRefInTreeMenuItem);
        ActionListener showInTreeActionListener = new ActionListener() {

            public void actionPerformed(ActionEvent actionEvent) {
                int[] selectedRows = table.getSelectedRows();
                if (selectedRows == null || selectedRows.length != 1) {
                    PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Action " + actionEvent.getActionCommand() + " accepts only single selection!");
                    return;
                }
                TestCriteriaCrossRefOPResults.CrossRefData xrefData = (TestCriteriaCrossRefOPResults.CrossRefData) tableModel.getValueAt(selectedRows[0], XREFDATA_OFFSET);
                BigDecimal missingTSKey = (BigDecimal) tableModel.getValueAt(selectedRows[0], TSKEYMISSING_OFFSET);
                if (actionEvent.getActionCommand().equals(SELECT_REF_IN_TREE)) {
                    getTestingFrameworkWindowPanel().selectInTreeView((xrefData != null ? xrefData.tsKey : missingTSKey), (xrefData != null ? xrefData.tcaseKey : null), (xrefData != null ? xrefData.tcritKey : null));
                } else if (actionEvent.getActionCommand().equals(SELECT_REGR_REF_IN_TREE)) {
                    if (xrefData == null) {
                        PopupGenerator.showErrorDialog(getComponent(), "No Regression Reference info available.");
                        return;
                    }
                    getTestingFrameworkWindowPanel().selectInTreeView((xrefData != null ? xrefData.regressionModelTSuiteID : null), (xrefData != null ? xrefData.regressionModelTCaseID : null), (xrefData != null ? xrefData.regressionModelTCritID : null));
                }
                ChildWindow childWindow = TFWFinder.findChildWindowManager(getComponent()).getChildWindowFromContentPane(scrollPaneContentPane);
                if (childWindow != null) {
                    childWindow.show();
                }
            }
        };
        showInTreeMenuItem.addActionListener(showInTreeActionListener);
        showRegrRefInTreeMenuItem.addActionListener(showInTreeActionListener);
        ActionListener openModelsActionListener = new ActionListener() {

            public void actionPerformed(ActionEvent actionEvent) {
                int[] selectedRows = table.getSelectedRows();
                String failureS = "";
                TestCriteriaCrossRefOPResults.CrossRefData xrefData = null;
                int openCount = 0;
                for (int i = 0; i < selectedRows.length; i++) {
                    try {
                        xrefData = (TestCriteriaCrossRefOPResults.CrossRefData) tableModel.getValueAt(selectedRows[i], XREFDATA_OFFSET);
                        if (xrefData != null && (actionEvent.getActionCommand().equals(OPEN_REGRREFMODEL) ? xrefData.regressionModelID != null : true)) {
                            openCount += 1;
                            VCDocumentInfo vcDocInfo = null;
                            if (xrefData.isBioModel) {
                                vcDocInfo = getRequestManager().getDocumentManager().getBioModelInfo(new KeyValue((actionEvent.getActionCommand().equals(OPEN_REGRREFMODEL) ? xrefData.regressionModelID : xrefData.modelID)));
                            } else {
                                vcDocInfo = getRequestManager().getDocumentManager().getMathModelInfo(new KeyValue((actionEvent.getActionCommand().equals(OPEN_REGRREFMODEL) ? xrefData.regressionModelID : xrefData.modelID)));
                            }
                            getRequestManager().openDocument(vcDocInfo, TestingFrameworkWindowManager.this, true);
                        }
                    } catch (Exception e) {
                        failureS += failureS + "key=" + xrefData.modelID + " " + e.getMessage() + "\n";
                        e.printStackTrace();
                    }
                }
                if (failureS.length() > 0 || openCount == 0) {
                    PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Failed to open some models\n" + failureS + (openCount == 0 ? "Selection(s) had no model(s)" : ""));
                }
                ChildWindow childWindow = TFWFinder.findChildWindowManager(getComponent()).getChildWindowFromContentPane(scrollPaneContentPane);
                if (childWindow != null) {
                    childWindow.show();
                }
            }
        };
        openModelMenuItem.addActionListener(openModelsActionListener);
        openRegrRefModelMenuItem.addActionListener(openModelsActionListener);
        changeLimitsMenuItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent actionEvent) {
                int[] selectedRows = table.getSelectedRows();
                Vector<TestCriteriaCrossRefOPResults.CrossRefData> changeTCritV = new Vector<TestCriteriaCrossRefOPResults.CrossRefData>();
                for (int i = 0; i < selectedRows.length; i++) {
                    TestCriteriaCrossRefOPResults.CrossRefData xrefData = (TestCriteriaCrossRefOPResults.CrossRefData) tableModel.getValueAt(selectedRows[i], XREFDATA_OFFSET);
                    if (xrefData != null) {
                        boolean bFound = false;
                        for (int j = 0; j < changeTCritV.size(); j++) {
                            if (changeTCritV.elementAt(j).tcritKey.equals(xrefData.tcritKey)) {
                                bFound = true;
                                break;
                            }
                        }
                        if (!bFound) {
                            changeTCritV.add(xrefData);
                        }
                    }
                }
                if (changeTCritV.size() > 0) {
                    Double relativeErrorLimit = null;
                    Double absoluteErrorLimit = null;
                    while (true) {
                        try {
                            String ret = PopupGenerator.showInputDialog(getComponent(), "Enter new TestCriteria Error Limits for '" + xrefDataSourceFinal.simName + "'.  '-'(dash) to keep original value.", "RelativeErrorLimit,AbsoluteErrorLimit");
                            int commaPosition = ret.indexOf(',');
                            if (commaPosition == -1) {
                                throw new Exception("No comma found separating RelativeErrorLimit AbsoluteErrorLimit");
                            }
                            if (commaPosition != ret.lastIndexOf(',')) {
                                throw new Exception("Only 1 comma allowed separating RelativeErrorLimit and AbsoluteErrorLimit");
                            }
                            final String KEEP_ORIGINAL_VALUE = "-";
                            String relativeErrorS = ret.substring(0, commaPosition);
                            String absoluteErrorS = ret.substring(commaPosition + 1, ret.length());
                            if (!relativeErrorS.equals(KEEP_ORIGINAL_VALUE)) {
                                relativeErrorLimit = Double.parseDouble(relativeErrorS);
                            }
                            if (!absoluteErrorS.equals(KEEP_ORIGINAL_VALUE)) {
                                absoluteErrorLimit = Double.parseDouble(absoluteErrorS);
                            }
                            if ((relativeErrorLimit != null && relativeErrorLimit <= 0) || (absoluteErrorLimit != null && absoluteErrorLimit <= 0)) {
                                throw new Exception("Error limits must be greater than 0");
                            }
                            break;
                        } catch (UserCancelException e) {
                            ChildWindow childWindow = TFWFinder.findChildWindowManager(getComponent()).getChildWindowFromContentPane(scrollPaneContentPane);
                            if (childWindow != null) {
                                childWindow.show();
                            }
                            return;
                        } catch (Exception e) {
                            PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Error parsing Error Limits\n" + e.getMessage());
                        }
                    }
                    double[] relErrorLimitArr = new double[changeTCritV.size()];
                    double[] absErrorLimitArr = new double[changeTCritV.size()];
                    Object[][] rows = new Object[changeTCritV.size()][5];
                    for (int j = 0; j < changeTCritV.size(); j++) {
                        relErrorLimitArr[j] = (relativeErrorLimit != null ? relativeErrorLimit.doubleValue() : changeTCritV.elementAt(j).maxRelErorr);
                        absErrorLimitArr[j] = (absoluteErrorLimit != null ? absoluteErrorLimit.doubleValue() : changeTCritV.elementAt(j).maxAbsErorr);
                        rows[j][2] = new Double(relErrorLimitArr[j]);
                        rows[j][4] = new Double(absErrorLimitArr[j]);
                        rows[j][1] = new Double(changeTCritV.elementAt(j).maxRelErorr);
                        rows[j][3] = new Double(changeTCritV.elementAt(j).maxAbsErorr);
                        rows[j][0] = changeTCritV.elementAt(j).tsVersion;
                    }
                    try {
                        PopupGenerator.showComponentOKCancelTableList(getComponent(), "Confirm Error Limit Changes", new String[] { "TSVersion", "Orig RelErrorLimit", "New RelErrorLimit", "Orig AbsErrorLimit", "New AbsErrorLimit" }, rows, null);
                    } catch (UserCancelException e) {
                        ChildWindow childWindow = TFWFinder.findChildWindowManager(getComponent()).getChildWindowFromContentPane(scrollPaneContentPane);
                        if (childWindow != null) {
                            childWindow.show();
                        }
                        return;
                    }
                    // Get information needed to generate new TestCriteria Reports
                    final String YES_ANSWER = "Yes";
                    Hashtable<TestSuiteInfoNew, Vector<TestCriteriaCrossRefOPResults.CrossRefData>> genReportHash = null;
                    String genRepResult = PopupGenerator.showWarningDialog(getComponent(), "Generate Reports for changed Test Criterias?", new String[] { YES_ANSWER, "No" }, YES_ANSWER);
                    if (genRepResult != null && genRepResult.equals(YES_ANSWER)) {
                        genReportHash = new Hashtable<TestSuiteInfoNew, Vector<TestCriteriaCrossRefOPResults.CrossRefData>>();
                        for (int i = 0; i < changeTCritV.size(); i++) {
                            boolean bFound = false;
                            for (int j = 0; j < testSuiteInfos.length; j++) {
                                if (changeTCritV.elementAt(i).tsVersion.equals(testSuiteInfos[j].getTSID())) {
                                    bFound = true;
                                    Vector<TestCriteriaCrossRefOPResults.CrossRefData> tempV = genReportHash.get(testSuiteInfos[j]);
                                    if (tempV == null) {
                                        tempV = new Vector<TestCriteriaCrossRefOPResults.CrossRefData>();
                                        genReportHash.put(testSuiteInfos[j], tempV);
                                    }
                                    tempV.add(changeTCritV.elementAt(i));
                                }
                            }
                            if (!bFound) {
                                PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Couldn't find testsuiteinfo for testcriteria");
                                return;
                            }
                        }
                    }
                    BigDecimal[] changeTCritBDArr = new BigDecimal[changeTCritV.size()];
                    for (int i = 0; i < changeTCritV.size(); i++) {
                        changeTCritBDArr[i] = changeTCritV.elementAt(i).tcritKey;
                    }
                    ChangeTestCriteriaErrorLimitOP changeTestCriteriaErrorLimitOP = new ChangeTestCriteriaErrorLimitOP(changeTCritBDArr, absErrorLimitArr, relErrorLimitArr);
                    try {
                        getTestingFrameworkWindowPanel().getDocumentManager().doTestSuiteOP(changeTestCriteriaErrorLimitOP);
                    } catch (Exception e) {
                        PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Failed Changing Error limits for selected " + xrefDataSourceFinal.simName + "\n" + e.getMessage());
                        return;
                    }
                    ChildWindow childWindow = TFWFinder.findChildWindowManager(getComponent()).getChildWindowFromContentPane(scrollPaneContentPane);
                    if (childWindow != null) {
                        childWindow.close();
                    }
                    getTestingFrameworkWindowPanel().refreshTree((TestSuiteInfoNew) null);
                    if (genReportHash != null) {
                        updateReports(genReportHash);
                    } else {
                        new Thread(new Runnable() {

                            public void run() {
                                TestingFrameworkWindowManager.this.queryTCritCrossRef(tsin, tcrit, varName);
                            }
                        }).start();
                    }
                } else {
                    PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "No selected rows contain Test Criteria.");
                }
            }
        });
        table.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                checkPopup(e);
            }

            @Override
            public void mousePressed(MouseEvent e) {
                super.mousePressed(e);
                checkPopup(e);
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                super.mouseReleased(e);
                checkPopup(e);
            }

            private void checkPopup(MouseEvent mouseEvent) {
                if (mouseEvent.isPopupTrigger()) {
                    // Not use because popupmenu will not show at edge
                    // if(table.getSelectedRowCount() <= 1){
                    // table.getSelectionModel().setSelectionInterval(table.rowAtPoint(mouseEvent.getPoint()),table.rowAtPoint(mouseEvent.getPoint()));
                    // }
                    doPopup(mouseEvent);
                } else {
                    queryPopupMenu.setVisible(false);
                }
            }

            private void doPopup(MouseEvent mouseEvent) {
                // queryPopupMenu.add(showInTreeMenuItem);
                if (table.getSelectedRowCount() == 0) {
                    changeLimitsMenuItem.setEnabled(false);
                    openModelMenuItem.setEnabled(false);
                    openRegrRefModelMenuItem.setEnabled(false);
                    showInTreeMenuItem.setEnabled(false);
                    showRegrRefInTreeMenuItem.setEnabled(false);
                } else {
                    changeLimitsMenuItem.setEnabled(true);
                    openModelMenuItem.setEnabled(true);
                    openRegrRefModelMenuItem.setEnabled(true);
                    showInTreeMenuItem.setEnabled(true);
                    if (table.getSelectedRowCount() == 1) {
                        TestCriteriaCrossRefOPResults.CrossRefData xrefData = (TestCriteriaCrossRefOPResults.CrossRefData) tableModel.getValueAt(table.getSelectedRow(), numColumns);
                        showRegrRefInTreeMenuItem.setEnabled(xrefData != null && xrefData.regressionModelID != null && xrefData.tsRefVersion != null);
                    }
                }
                queryPopupMenu.show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
            }
        });
        String title = (xrefDataSource.isBioModel ? "BM" : "MM") + " " + xrefDataSource.tcSolutionType + " (" + sourceTestSuite + ") " + " \"" + (xrefDataSource.isBioModel ? xrefDataSource.bmName : xrefDataSource.mmName) + "\"  ::  " + (xrefDataSource.isBioModel ? "app=\"" + xrefDataSource.bmAppName + "\"  ::  sim=\"" + xrefDataSource.simName + "\"" : "sim=\"" + xrefDataSource.simName + "\"");
        ChildWindow childWindow = TFWFinder.findChildWindowManager(getComponent()).addChildWindow(scrollPaneContentPane, scrollPaneContentPane, title);
        // childWindow.setSize(600,400);
        childWindow.setIsCenteredOnParent();
        childWindow.pack();
        childWindow.setResizable(true);
        childWindow.show();
    } catch (DataAccessException e) {
        e.printStackTrace();
        PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Error Query TestCriteria Cross Ref:\n" + e.getMessage());
    }
}
Also used : KeyValue(org.vcell.util.document.KeyValue) ActionEvent(java.awt.event.ActionEvent) UserCancelException(org.vcell.util.UserCancelException) Comparator(java.util.Comparator) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) VCellSortTableModel(cbit.vcell.client.desktop.biomodel.VCellSortTableModel) Component(java.awt.Component) JComponent(javax.swing.JComponent) JMenuItem(javax.swing.JMenuItem) Vector(java.util.Vector) CrossRefData(cbit.vcell.numericstest.TestCriteriaCrossRefOPResults.CrossRefData) DataAccessException(org.vcell.util.DataAccessException) JScrollPane(javax.swing.JScrollPane) QueryTestCriteriaCrossRefOP(cbit.vcell.numericstest.QueryTestCriteriaCrossRefOP) MouseEvent(java.awt.event.MouseEvent) Hashtable(java.util.Hashtable) MouseAdapter(java.awt.event.MouseAdapter) TestCriteriaCrossRefOPResults(cbit.vcell.numericstest.TestCriteriaCrossRefOPResults) Dimension(java.awt.Dimension) ChildWindow(cbit.vcell.client.ChildWindowManager.ChildWindow) Date(java.util.Date) JPopupMenu(javax.swing.JPopupMenu) BigDecimal(java.math.BigDecimal) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException) UserCancelException(org.vcell.util.UserCancelException) CrossRefData(cbit.vcell.numericstest.TestCriteriaCrossRefOPResults.CrossRefData) JSortTable(org.vcell.util.gui.sorttable.JSortTable) ActionListener(java.awt.event.ActionListener) VCDocumentInfo(org.vcell.util.document.VCDocumentInfo) ChangeTestCriteriaErrorLimitOP(cbit.vcell.numericstest.ChangeTestCriteriaErrorLimitOP) JTable(javax.swing.JTable) TestSuiteInfoNew(cbit.vcell.numericstest.TestSuiteInfoNew)

Example 7 with UserCancelException

use of org.vcell.util.UserCancelException in project vcell by virtualcell.

the class VFrap_ROIAssistPanel method showComponentOKCancelTableList.

public int[] showComponentOKCancelTableList(final Component requester, String title, String[] columnNames, Object[][] rowData, int listSelectionModel_SelectMode, final RegionInfo[] regionInfoArr, final short[] multiObjectROIPixels) throws UserCancelException {
    DefaultTableModel tableModel = new DefaultTableModel() {

        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    tableModel.setDataVector(rowData, columnNames);
    final JTable table = new JTable(tableModel);
    table.setSelectionMode(listSelectionModel_SelectMode);
    JScrollPane scrollPane = new JScrollPane(table);
    table.setPreferredScrollableViewportSize(new Dimension(500, 250));
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                try {
                    int index = table.getSelectedRow();
                    // System.out.println("list index="+index);
                    RegionInfo keepRegion = regionInfoArr[index];
                    short[] removePixels = multiObjectROIPixels.clone();
                    for (int i = 0; i < removePixels.length; i++) {
                        if (!keepRegion.isIndexInRegion(i)) {
                            removePixels[i] = 0;
                        }
                    }
                    UShortImage ushortImage = new UShortImage(removePixels, originalROI.getRoiImages()[0].getOrigin(), originalROI.getRoiImages()[0].getExtent(), originalROI.getISize().getX(), originalROI.getISize().getY(), originalROI.getISize().getZ());
                    final ROI newCellROI = new ROI(ushortImage, frapData.getCurrentlyDisplayedROI().getROIName());
                    frapData.addReplaceRoi(newCellROI);
                } catch (Exception e2) {
                    e2.printStackTrace();
                    throw new RuntimeException("Error selecting resolved ROI", e2);
                }
            }
        }
    });
    ScopedExpressionTableCellRenderer.formatTableCellSizes(table);
    int result = DialogUtils.showComponentOKCancelDialog(requester, scrollPane, title);
    if (result != JOptionPane.OK_OPTION) {
        throw UserCancelException.CANCEL_GENERIC;
    }
    return table.getSelectedRows();
}
Also used : JScrollPane(javax.swing.JScrollPane) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) ListSelectionEvent(javax.swing.event.ListSelectionEvent) RegionInfo(cbit.vcell.geometry.RegionImage.RegionInfo) UShortImage(cbit.vcell.VirtualMicroscopy.UShortImage) Dimension(java.awt.Dimension) ROI(cbit.vcell.VirtualMicroscopy.ROI) UserCancelException(org.vcell.util.UserCancelException) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 8 with UserCancelException

use of org.vcell.util.UserCancelException in project vcell by virtualcell.

the class SbmlExtensionFilter method askUser.

@Override
public void askUser(ChooseContext c) throws UserCancelException {
    BioModel bioModel = c.chosenContext.getBioModel();
    JFrame currentWindow = c.currentWindow;
    selectedSimWOSBE = null;
    selectedSimContext = c.chosenContext;
    // get user choice of structure and its size and computes absolute sizes of compartments using the StructureSizeSolver.
    Structure[] structures = bioModel.getModel().getStructures();
    // get the nonspatial simulationContexts corresponding to names in applicableAppNameList
    // This is needed in ApplnSelectionAndStructureSizeInputPanel
    String strucName = null;
    double structSize = 1.0;
    int structSelection = -1;
    int option = JOptionPane.CANCEL_OPTION;
    ApplnSelectionAndStructureSizeInputPanel applnStructInputPanel = null;
    while (structSelection < 0) {
        applnStructInputPanel = new ApplnSelectionAndStructureSizeInputPanel();
        applnStructInputPanel.setSimContext(c.chosenContext);
        applnStructInputPanel.setStructures(structures);
        if (applnStructInputPanel.isNeedStructureSizes()) {
            applnStructInputPanel.setPreferredSize(new java.awt.Dimension(350, 400));
            applnStructInputPanel.setMaximumSize(new java.awt.Dimension(350, 400));
            option = DialogUtils.showComponentOKCancelDialog(currentWindow, applnStructInputPanel, "Specify Structure Size to Export:");
            structSelection = applnStructInputPanel.getStructSelectionIndex();
            if (option == JOptionPane.CANCEL_OPTION || option == JOptionPane.CLOSED_OPTION) {
                break;
            } else if (option == JOptionPane.OK_OPTION && structSelection < 0) {
                DialogUtils.showErrorDialog(currentWindow, "Please select a structure and set its size");
            }
        } else {
            // adapt to legacy logic ...
            structSelection = 0;
            option = JOptionPane.OK_OPTION;
        }
    }
    if (option == JOptionPane.OK_OPTION) {
        applnStructInputPanel.applyStructureNameAndSizeValues();
        strucName = applnStructInputPanel.getSelectedStructureName();
        selectedSimContext = applnStructInputPanel.getSelectedSimContext();
        GeometryContext geoContext = selectedSimContext.getGeometryContext();
        if (!isSpatial) {
            // calculate structure Sizes only if appln is not spatial
            structSize = applnStructInputPanel.getStructureSize();
            // Invoke StructureSizeEvaluator to compute absolute sizes of compartments if all sizes are not set
            if ((geoContext.isAllSizeSpecifiedNull() && geoContext.isAllVolFracAndSurfVolSpecifiedNull()) || ((strucName == null || structSize <= 0.0) && (geoContext.isAllSizeSpecifiedNull() && geoContext.isAllVolFracAndSurfVolSpecified())) || (!geoContext.isAllSizeSpecifiedPositive() && geoContext.isAllVolFracAndSurfVolSpecifiedNull()) || (!geoContext.isAllSizeSpecifiedPositive() && !geoContext.isAllVolFracAndSurfVolSpecified()) || (geoContext.isAllSizeSpecifiedNull() && !geoContext.isAllVolFracAndSurfVolSpecified())) {
                DialogUtils.showErrorDialog(currentWindow, "Cannot export to SBML without compartment sizes being set. This can be automatically " + " computed if the absolute size of at least one compartment and the relative sizes (Surface-to-volume-ratio/Volume-fraction) " + " of all compartments are known. Sufficient information is not available to perform this computation." + "\n\nThis can be fixed by going back to the application '" + selectedSimContext.getName() + "' and setting structure sizes in the 'StructureMapping' tab.");
                throw UserCancelException.CANCEL_XML_TRANSLATION;
            }
            if (!geoContext.isAllSizeSpecifiedPositive() && geoContext.isAllVolFracAndSurfVolSpecified()) {
                Structure chosenStructure = selectedSimContext.getModel().getStructure(strucName);
                StructureMapping chosenStructMapping = selectedSimContext.getGeometryContext().getStructureMapping(chosenStructure);
                try {
                    StructureSizeSolver.updateAbsoluteStructureSizes(selectedSimContext, chosenStructure, structSize, chosenStructMapping.getSizeParameter().getUnitDefinition());
                } catch (Exception e) {
                    throw new ProgrammingException("exception updating sizes", e);
                }
            }
        } else {
            if (!geoContext.isAllUnitSizeParameterSetForSpatial()) {
                DialogUtils.showErrorDialog(currentWindow, "Cannot export to SBML without compartment size ratios being set." + "\n\nThis can be fixed by going back to the application '" + selectedSimContext.getName() + "' and setting structure" + " size ratios in the 'StructureMapping' tab.");
                throw UserCancelException.CANCEL_XML_TRANSLATION;
            }
        }
        // Select simulation whose overrides need to be exported
        // If simContext doesn't have simulations, don't pop up simulationSelectionPanel
        Simulation[] sims = bioModel.getSimulations(selectedSimContext);
        // display only those simulations that have overrides in the simulationSelectionPanel.
        Vector<Simulation> orSims = new Vector<Simulation>();
        for (int s = 0; (sims != null) && (s < sims.length); s++) {
            if (sims[s].getMathOverrides().hasOverrides()) {
                orSims.addElement(sims[s]);
            }
        }
        Simulation[] overriddenSims = orSims.toArray(new Simulation[orSims.size()]);
        if (overriddenSims.length > 0) {
            SimulationSelectionPanel simSelectionPanel = new SimulationSelectionPanel();
            simSelectionPanel.setPreferredSize(new java.awt.Dimension(600, 400));
            simSelectionPanel.setMaximumSize(new java.awt.Dimension(600, 400));
            simSelectionPanel.setSimulations(overriddenSims);
            int simOption = DialogUtils.showComponentOKCancelDialog(currentWindow, simSelectionPanel, "Select Simulation whose overrides should be exported:");
            if (simOption == JOptionPane.OK_OPTION) {
                selectedSimWOSBE = simSelectionPanel.getSelectedSimulation();
            // if (chosenSimulation != null) {
            // CARRY						hashTable.put("selectedSimulation", chosenSimulation);
            // }
            } else if (simOption == JOptionPane.CANCEL_OPTION || simOption == JOptionPane.CLOSED_OPTION) {
                // Hence canceling the entire export to SBML operation.
                throw UserCancelException.CANCEL_XML_TRANSLATION;
            }
        }
    } else if (option == JOptionPane.CANCEL_OPTION || option == JOptionPane.CLOSED_OPTION) {
        // Hence canceling the entire export to SBML operation.
        throw UserCancelException.CANCEL_XML_TRANSLATION;
    }
    if (selectedSimWOSBE != null) {
        String selectedFileName = c.filename;
        // rename file to contain exported simulation.
        String ext = FilenameUtils.getExtension(selectedFileName);
        String base = FilenameUtils.getBaseName(selectedFileName);
        String path = FilenameUtils.getPath(selectedFileName);
        base += "_" + TokenMangler.mangleToSName(selectedSimWOSBE.getName());
        selectedFileName = path + base + ext;
        c.selectedFile.renameTo(new File(selectedFileName));
    }
}
Also used : SimulationSelectionPanel(org.vcell.sbml.gui.SimulationSelectionPanel) StructureMapping(cbit.vcell.mapping.StructureMapping) ProgrammingException(org.vcell.util.ProgrammingException) UserCancelException(org.vcell.util.UserCancelException) Simulation(cbit.vcell.solver.Simulation) JFrame(javax.swing.JFrame) ApplnSelectionAndStructureSizeInputPanel(org.vcell.sbml.gui.ApplnSelectionAndStructureSizeInputPanel) BioModel(cbit.vcell.biomodel.BioModel) GeometryContext(cbit.vcell.mapping.GeometryContext) ProgrammingException(org.vcell.util.ProgrammingException) Structure(cbit.vcell.model.Structure) Vector(java.util.Vector) File(java.io.File)

Example 9 with UserCancelException

use of org.vcell.util.UserCancelException in project vcell by virtualcell.

the class NetworkTransformer method transform.

private void transform(SimulationContext simContext, SimulationContext transformedSimulationContext, ArrayList<ModelEntityMapping> entityMappings, MathMappingCallback mathMappingCallback, NetworkGenerationRequirements networkGenerationRequirements) {
    String msg = "Generating network: flattening...";
    mathMappingCallback.setMessage(msg);
    TaskCallbackMessage tcm = new TaskCallbackMessage(TaskCallbackStatus.Clean, "");
    simContext.appendToConsole(tcm);
    tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskStart, msg);
    simContext.appendToConsole(tcm);
    long startTime = System.currentTimeMillis();
    System.out.println("Convert to bngl, execute BNG, retrieve the results.");
    try {
        BNGOutputSpec outputSpec = generateNetwork(simContext, mathMappingCallback, networkGenerationRequirements);
        if (mathMappingCallback.isInterrupted()) {
            msg = "Canceled by user.";
            tcm = new TaskCallbackMessage(TaskCallbackStatus.Error, msg);
            simContext.appendToConsole(tcm);
            throw new UserCancelException(msg);
        }
        long endTime = System.currentTimeMillis();
        long elapsedTime = endTime - startTime;
        System.out.println("     " + elapsedTime + " milliseconds");
        Model model = transformedSimulationContext.getModel();
        ReactionContext reactionContext = transformedSimulationContext.getReactionContext();
        // ---- Parameters -----------------------------------------------------------------------------------------------
        startTime = System.currentTimeMillis();
        for (int i = 0; i < outputSpec.getBNGParams().length; i++) {
            BNGParameter p = outputSpec.getBNGParams()[i];
            // System.out.println(i+1 + ":\t\t"+ p.toString());
            if (model.getRbmModelContainer().getParameter(p.getName()) != null) {
                // if it's already there we don't try to add it again; this should be true for all of them!
                continue;
            }
            String s = p.getName();
            FakeSeedSpeciesInitialConditionsParameter fakeICParam = FakeSeedSpeciesInitialConditionsParameter.fromString(s);
            if (speciesEquivalenceMap.containsKey(fakeICParam)) {
                // we get rid of the fake parameters we use as keys
                continue;
            }
            FakeReactionRuleRateParameter fakeKineticParam = FakeReactionRuleRateParameter.fromString(s);
            if (fakeKineticParam != null) {
                System.out.println("found fakeKineticParam " + fakeKineticParam.fakeParameterName);
                // we get rid of the fake parameters we use as keys
                continue;
            }
            throw new RuntimeException("unexpected parameter " + p.getName() + " in internal BNG processing");
        // Expression exp = new Expression(p.getValue());
        // exp.bindExpression(model.getRbmModelContainer().getSymbolTable());
        // model.getRbmModelContainer().addParameter(p.getName(), exp, model.getUnitSystem().getInstance_TBD());
        }
        endTime = System.currentTimeMillis();
        elapsedTime = endTime - startTime;
        msg = "Adding " + outputSpec.getBNGParams().length + " parameters to model, " + elapsedTime + " ms";
        System.out.println(msg);
        // ---- Species ------------------------------------------------------------------------------------------------------------
        mathMappingCallback.setMessage("generating network: adding species...");
        mathMappingCallback.setProgressFraction(progressFractionQuota / 4.0f);
        startTime = System.currentTimeMillis();
        System.out.println("\nSpecies :");
        // the reactions will need this map to recover the names of species knowing only the networkFileIndex
        HashMap<Integer, String> speciesMap = new HashMap<Integer, String>();
        LinkedHashMap<String, Species> sMap = new LinkedHashMap<String, Species>();
        LinkedHashMap<String, SpeciesContext> scMap = new LinkedHashMap<String, SpeciesContext>();
        LinkedHashMap<String, BNGSpecies> crossMap = new LinkedHashMap<String, BNGSpecies>();
        List<SpeciesContext> noMapForThese = new ArrayList<SpeciesContext>();
        // final int decimalTickCount = Math.max(outputSpec.getBNGSpecies().length/10, 1);
        for (int i = 0; i < outputSpec.getBNGSpecies().length; i++) {
            BNGSpecies s = outputSpec.getBNGSpecies()[i];
            // System.out.println(i+1 + ":\t\t"+ s.toString());
            String key = s.getConcentration().infix();
            FakeSeedSpeciesInitialConditionsParameter fakeParam = FakeSeedSpeciesInitialConditionsParameter.fromString(key);
            if (fakeParam != null) {
                Pair<SpeciesContext, Expression> value = speciesEquivalenceMap.get(fakeParam);
                // the species context of the original model
                SpeciesContext originalsc = value.one;
                Expression initial = value.two;
                // replace the fake initial condition with the real one
                s.setConcentration(initial);
                // we'll have to find the species context from the cloned model which correspond to the original species
                SpeciesContext sc = model.getSpeciesContext(originalsc.getName());
                // System.out.println(sc.getName() + ", " + sc.getSpecies().getCommonName() + "   ...is one of the original seed species.");
                // existing name
                speciesMap.put(s.getNetworkFileIndex(), sc.getName());
                sMap.put(sc.getName(), sc.getSpecies());
                scMap.put(sc.getName(), sc);
                crossMap.put(sc.getName(), s);
                noMapForThese.add(sc);
                continue;
            }
            // all these species are new!
            // generate unique name for the species
            int count = 0;
            String speciesName = null;
            String nameRoot = "s";
            String speciesPatternNameString = s.extractName();
            while (true) {
                speciesName = nameRoot + count;
                if (Model.isNameUnused(speciesName, model) && !sMap.containsKey(speciesName) && !scMap.containsKey(speciesName)) {
                    break;
                }
                count++;
            }
            // newly created name
            speciesMap.put(s.getNetworkFileIndex(), speciesName);
            SpeciesContext speciesContext;
            if (s.hasCompartment()) {
                String speciesPatternCompartmentString = s.extractCompartment();
                speciesContext = new SpeciesContext(new Species(speciesName, s.getName()), model.getStructure(speciesPatternCompartmentString), null);
            } else {
                speciesContext = new SpeciesContext(new Species(speciesName, s.getName()), model.getStructure(0), null);
            }
            speciesContext.setName(speciesName);
            try {
                if (speciesPatternNameString != null) {
                    SpeciesPattern sp = RbmUtils.parseSpeciesPattern(speciesPatternNameString, model);
                    speciesContext.setSpeciesPattern(sp);
                }
            } catch (ParseException e) {
                e.printStackTrace();
                throw new RuntimeException("Bad format for species pattern string: " + e.getMessage());
            }
            // speciesContext.setSpeciesPatternString(speciesPatternString);
            // model.addSpecies(speciesContext.getSpecies());
            // model.addSpeciesContext(speciesContext);
            sMap.put(speciesName, speciesContext.getSpecies());
            scMap.put(speciesName, speciesContext);
            crossMap.put(speciesName, s);
            // }
            if (mathMappingCallback.isInterrupted()) {
                msg = "Canceled by user.";
                tcm = new TaskCallbackMessage(TaskCallbackStatus.Error, msg);
                simContext.appendToConsole(tcm);
                throw new UserCancelException(msg);
            }
        // if(i%50 == 0) {
        // System.out.println(i+"");
        // }
        // if(i%decimalTickCount == 0) {
        // int multiplier = i/decimalTickCount;
        // float progress = progressFractionQuota/4.0f + progressFractionQuotaSpecies*multiplier;
        // mathMappingCallback.setProgressFraction(progress);
        // }
        }
        for (SpeciesContext sc1 : model.getSpeciesContexts()) {
            boolean found = false;
            for (Map.Entry<String, SpeciesContext> entry : scMap.entrySet()) {
                SpeciesContext sc2 = entry.getValue();
                if (sc1.getName().equals(sc2.getName())) {
                    found = true;
                    // System.out.println("found species context " + sc1.getName() + " of species " + sc1.getSpecies().getCommonName() + " // " + sc2.getSpecies().getCommonName());
                    break;
                }
            }
            if (found == false) {
                // we add to the map the species context and the species which exist in the model but which are not in the map yet
                // the only ones in this situation should be plain species which were not given to bngl for flattening (they are flat already)
                // System.out.println("species context " + sc1.getName() + " not found in the map. Adding it.");
                scMap.put(sc1.getName(), sc1);
                sMap.put(sc1.getName(), sc1.getSpecies());
                noMapForThese.add(sc1);
            }
        }
        for (Species s1 : model.getSpecies()) {
            boolean found = false;
            for (Map.Entry<String, Species> entry : sMap.entrySet()) {
                Species s2 = entry.getValue();
                if (s1.getCommonName().equals(s2.getCommonName())) {
                    found = true;
                    // System.out.println("found species " + s1.getCommonName());
                    break;
                }
            }
            if (found == false) {
                System.err.println("species " + s1.getCommonName() + " not found in the map!");
            }
        }
        SpeciesContext[] sca = new SpeciesContext[scMap.size()];
        scMap.values().toArray(sca);
        Species[] sa = new HashSet<Species>(sMap.values()).toArray(new Species[0]);
        model.setSpecies(sa);
        model.setSpeciesContexts(sca);
        boolean isSpatial = transformedSimulationContext.getGeometry().getDimension() > 0;
        for (SpeciesContext sc : sca) {
            if (noMapForThese.contains(sc)) {
                continue;
            }
            SpeciesContextSpec scs = reactionContext.getSpeciesContextSpec(sc);
            Parameter param = scs.getParameter(SpeciesContextSpec.ROLE_InitialConcentration);
            BNGSpecies s = crossMap.get(sc.getName());
            param.setExpression(s.getConcentration());
            SpeciesContext origSpeciesContext = simContext.getModel().getSpeciesContext(s.getName());
            if (origSpeciesContext != null) {
                ModelEntityMapping em = new ModelEntityMapping(origSpeciesContext, sc);
                entityMappings.add(em);
            } else {
                ModelEntityMapping em = new ModelEntityMapping(new GeneratedSpeciesSymbolTableEntry(sc), sc);
                if (isSpatial) {
                    scs.initializeForSpatial();
                }
                entityMappings.add(em);
            }
        }
        // for(SpeciesContext sc : sca) {		// clean all the species patterns from the flattened species, we have no sp now
        // sc.setSpeciesPattern(null);
        // }
        endTime = System.currentTimeMillis();
        elapsedTime = endTime - startTime;
        msg = "Adding " + outputSpec.getBNGSpecies().length + " species to model, " + elapsedTime + " ms";
        System.out.println(msg);
        // ---- Reactions -----------------------------------------------------------------------------------------------------
        mathMappingCallback.setMessage("generating network: adding reactions...");
        mathMappingCallback.setProgressFraction(progressFractionQuota / 4.0f * 3.0f);
        startTime = System.currentTimeMillis();
        System.out.println("\nReactions :");
        Map<String, HashSet<String>> ruleKeyMap = new HashMap<String, HashSet<String>>();
        Map<String, BNGReaction> directBNGReactionsMap = new HashMap<String, BNGReaction>();
        Map<String, BNGReaction> reverseBNGReactionsMap = new HashMap<String, BNGReaction>();
        for (int i = 0; i < outputSpec.getBNGReactions().length; i++) {
            BNGReaction r = outputSpec.getBNGReactions()[i];
            if (!r.isRuleReversed()) {
                // direct
                directBNGReactionsMap.put(r.getKey(), r);
            } else {
                reverseBNGReactionsMap.put(r.getKey(), r);
            }
            // 
            // for each rule name, store set of keySets (number of unique keysets are number of generated reactions from this ruleName).
            // 
            HashSet<String> keySet = ruleKeyMap.get(r.getRuleName());
            if (keySet == null) {
                keySet = new HashSet<String>();
                ruleKeyMap.put(r.getRuleName(), keySet);
            }
            keySet.add(r.getKey());
        }
        Map<String, ReactionStep> reactionStepMap = new HashMap<String, ReactionStep>();
        for (int i = 0; i < outputSpec.getBNGReactions().length; i++) {
            BNGReaction bngReaction = outputSpec.getBNGReactions()[i];
            // System.out.println(i+1 + ":\t\t"+ r.writeReaction());
            String baseName = bngReaction.getRuleName();
            String reactionName = null;
            HashSet<String> keySetsForThisRule = ruleKeyMap.get(bngReaction.getRuleName());
            if (keySetsForThisRule.size() == 1 && model.getReactionStep(bngReaction.getRuleName()) == null && !reactionStepMap.containsKey(bngReaction.getRuleName())) {
                // we can reuse the reaction rule labels
                reactionName = bngReaction.getRuleName();
            } else {
                reactionName = bngReaction.getRuleName() + "_0";
                while (true) {
                    if (model.getReactionStep(reactionName) == null && !reactionStepMap.containsKey(reactionName)) {
                        // we can reuse the reaction rule labels
                        break;
                    }
                    reactionName = TokenMangler.getNextEnumeratedToken(reactionName);
                }
            }
            // 
            if (directBNGReactionsMap.containsValue(bngReaction)) {
                BNGReaction forwardBNGReaction = bngReaction;
                BNGReaction reverseBNGReaction = reverseBNGReactionsMap.get(bngReaction.getKey());
                String name = forwardBNGReaction.getRuleName();
                if (name.endsWith(ReactionRule.DirectHalf)) {
                    name = name.substring(0, name.indexOf(ReactionRule.DirectHalf));
                }
                if (name.endsWith(ReactionRule.InverseHalf)) {
                    name = name.substring(0, name.indexOf(ReactionRule.InverseHalf));
                }
                ReactionRule rr = model.getRbmModelContainer().getReactionRule(name);
                Structure structure = rr.getStructure();
                boolean bReversible = reverseBNGReaction != null;
                SimpleReaction sr = new SimpleReaction(model, structure, reactionName, bReversible);
                for (int j = 0; j < forwardBNGReaction.getReactants().length; j++) {
                    BNGSpecies s = forwardBNGReaction.getReactants()[j];
                    String scName = speciesMap.get(s.getNetworkFileIndex());
                    SpeciesContext sc = model.getSpeciesContext(scName);
                    Reactant reactant = sr.getReactant(scName);
                    if (reactant == null) {
                        int stoichiometry = 1;
                        sr.addReactant(sc, stoichiometry);
                    } else {
                        int stoichiometry = reactant.getStoichiometry();
                        stoichiometry += 1;
                        reactant.setStoichiometry(stoichiometry);
                    }
                }
                for (int j = 0; j < forwardBNGReaction.getProducts().length; j++) {
                    BNGSpecies s = forwardBNGReaction.getProducts()[j];
                    String scName = speciesMap.get(s.getNetworkFileIndex());
                    SpeciesContext sc = model.getSpeciesContext(scName);
                    Product product = sr.getProduct(scName);
                    if (product == null) {
                        int stoichiometry = 1;
                        sr.addProduct(sc, stoichiometry);
                    } else {
                        int stoichiometry = product.getStoichiometry();
                        stoichiometry += 1;
                        product.setStoichiometry(stoichiometry);
                    }
                }
                MassActionKinetics targetKinetics = new MassActionKinetics(sr);
                sr.setKinetics(targetKinetics);
                KineticsParameter kforward = targetKinetics.getForwardRateParameter();
                KineticsParameter kreverse = targetKinetics.getReverseRateParameter();
                String kforwardNewName = rr.getKineticLaw().getLocalParameter(RbmKineticLawParameterType.MassActionForwardRate).getName();
                if (!kforward.getName().equals(kforwardNewName)) {
                    targetKinetics.renameParameter(kforward.getName(), kforwardNewName);
                    kforward = targetKinetics.getForwardRateParameter();
                }
                final String kreverseNewName = rr.getKineticLaw().getLocalParameter(RbmKineticLawParameterType.MassActionReverseRate).getName();
                if (!kreverse.getName().equals(kreverseNewName)) {
                    targetKinetics.renameParameter(kreverse.getName(), kreverseNewName);
                    kreverse = targetKinetics.getReverseRateParameter();
                }
                applyKineticsExpressions(forwardBNGReaction, kforward, targetKinetics);
                if (reverseBNGReaction != null) {
                    applyKineticsExpressions(reverseBNGReaction, kreverse, targetKinetics);
                }
                // String fieldParameterName = kforward.getName();
                // fieldParameterName += "_" + r.getRuleName();
                // kforward.setName(fieldParameterName);
                reactionStepMap.put(reactionName, sr);
            } else if (reverseBNGReactionsMap.containsValue(bngReaction) && !directBNGReactionsMap.containsKey(bngReaction.getKey())) {
                // reverse only (must be irreversible)
                BNGReaction reverseBNGReaction = reverseBNGReactionsMap.get(bngReaction.getKey());
                ReactionRule rr = model.getRbmModelContainer().getReactionRule(reverseBNGReaction.extractRuleName());
                Structure structure = rr.getStructure();
                boolean bReversible = false;
                SimpleReaction sr = new SimpleReaction(model, structure, reactionName, bReversible);
                for (int j = 0; j < reverseBNGReaction.getReactants().length; j++) {
                    BNGSpecies s = reverseBNGReaction.getReactants()[j];
                    String scName = speciesMap.get(s.getNetworkFileIndex());
                    SpeciesContext sc = model.getSpeciesContext(scName);
                    Reactant reactant = sr.getReactant(scName);
                    if (reactant == null) {
                        int stoichiometry = 1;
                        sr.addReactant(sc, stoichiometry);
                    } else {
                        int stoichiometry = reactant.getStoichiometry();
                        stoichiometry += 1;
                        reactant.setStoichiometry(stoichiometry);
                    }
                }
                for (int j = 0; j < reverseBNGReaction.getProducts().length; j++) {
                    BNGSpecies s = reverseBNGReaction.getProducts()[j];
                    String scName = speciesMap.get(s.getNetworkFileIndex());
                    SpeciesContext sc = model.getSpeciesContext(scName);
                    Product product = sr.getProduct(scName);
                    if (product == null) {
                        int stoichiometry = 1;
                        sr.addProduct(sc, stoichiometry);
                    } else {
                        int stoichiometry = product.getStoichiometry();
                        stoichiometry += 1;
                        product.setStoichiometry(stoichiometry);
                    }
                }
                MassActionKinetics k = new MassActionKinetics(sr);
                sr.setKinetics(k);
                KineticsParameter kforward = k.getForwardRateParameter();
                KineticsParameter kreverse = k.getReverseRateParameter();
                String kforwardNewName = rr.getKineticLaw().getLocalParameter(RbmKineticLawParameterType.MassActionForwardRate).getName();
                if (!kforward.getName().equals(kforwardNewName)) {
                    k.renameParameter(kforward.getName(), kforwardNewName);
                    kforward = k.getForwardRateParameter();
                }
                final String kreverseNewName = rr.getKineticLaw().getLocalParameter(RbmKineticLawParameterType.MassActionReverseRate).getName();
                if (!kreverse.getName().equals(kreverseNewName)) {
                    k.renameParameter(kreverse.getName(), kreverseNewName);
                    kreverse = k.getReverseRateParameter();
                }
                applyKineticsExpressions(reverseBNGReaction, kforward, k);
                // String fieldParameterName = kforward.getName();
                // fieldParameterName += "_" + r.getRuleName();
                // kforward.setName(fieldParameterName);
                reactionStepMap.put(reactionName, sr);
            }
        }
        for (ReactionStep rs : model.getReactionSteps()) {
            reactionStepMap.put(rs.getName(), rs);
        }
        ReactionStep[] reactionSteps = new ReactionStep[reactionStepMap.size()];
        reactionStepMap.values().toArray(reactionSteps);
        model.setReactionSteps(reactionSteps);
        if (mathMappingCallback.isInterrupted()) {
            msg = "Canceled by user.";
            tcm = new TaskCallbackMessage(TaskCallbackStatus.Error, msg);
            simContext.appendToConsole(tcm);
            throw new UserCancelException(msg);
        }
        endTime = System.currentTimeMillis();
        elapsedTime = endTime - startTime;
        msg = "Adding " + outputSpec.getBNGReactions().length + " reactions to model, " + elapsedTime + " ms";
        System.out.println(msg);
        // clean all the reaction rules
        model.getRbmModelContainer().getReactionRuleList().clear();
        // ---- Observables -------------------------------------------------------------------------------------------------
        mathMappingCallback.setMessage("generating network: adding observables...");
        mathMappingCallback.setProgressFraction(progressFractionQuota / 8.0f * 7.0f);
        startTime = System.currentTimeMillis();
        System.out.println("\nObservables :");
        RbmModelContainer rbmmc = model.getRbmModelContainer();
        for (int i = 0; i < outputSpec.getObservableGroups().length; i++) {
            ObservableGroup o = outputSpec.getObservableGroups()[i];
            if (rbmmc.getParameter(o.getObservableGroupName()) != null) {
                System.out.println("   ...already exists.");
                // if it's already there we don't try to add it again; this should be true for all of them!
                continue;
            }
            ArrayList<Expression> terms = new ArrayList<Expression>();
            for (int j = 0; j < o.getListofSpecies().length; j++) {
                Expression term = Expression.mult(new Expression(o.getSpeciesMultiplicity()[j]), new Expression(speciesMap.get(o.getListofSpecies()[j].getNetworkFileIndex())));
                terms.add(term);
            }
            Expression exp = Expression.add(terms.toArray(new Expression[terms.size()])).flatten();
            exp.bindExpression(rbmmc.getSymbolTable());
            RbmObservable originalObservable = rbmmc.getObservable(o.getObservableGroupName());
            VCUnitDefinition observableUnitDefinition = originalObservable.getUnitDefinition();
            rbmmc.removeObservable(originalObservable);
            Parameter newParameter = rbmmc.addParameter(o.getObservableGroupName(), exp, observableUnitDefinition);
            RbmObservable origObservable = simContext.getModel().getRbmModelContainer().getObservable(o.getObservableGroupName());
            ModelEntityMapping em = new ModelEntityMapping(origObservable, newParameter);
            entityMappings.add(em);
        }
        if (mathMappingCallback.isInterrupted()) {
            msg = "Canceled by user.";
            tcm = new TaskCallbackMessage(TaskCallbackStatus.Error, msg);
            simContext.appendToConsole(tcm);
            throw new UserCancelException(msg);
        }
        endTime = System.currentTimeMillis();
        elapsedTime = endTime - startTime;
        msg = "Adding " + outputSpec.getObservableGroups().length + " observables to model, " + elapsedTime + " ms";
        System.out.println(msg);
    } catch (PropertyVetoException ex) {
        ex.printStackTrace(System.out);
        throw new RuntimeException(ex.getMessage());
    } catch (ExpressionBindingException ex) {
        ex.printStackTrace(System.out);
        throw new RuntimeException(ex.getMessage());
    } catch (ModelException ex) {
        ex.printStackTrace(System.out);
        throw new RuntimeException(ex.getMessage());
    } catch (ExpressionException ex) {
        ex.printStackTrace(System.out);
        throw new RuntimeException(ex.getMessage());
    } catch (ClassNotFoundException ex) {
        throw new RuntimeException(ex.getMessage());
    } catch (IOException ex) {
        throw new RuntimeException(ex.getMessage());
    }
    System.out.println("Done transforming");
    msg = "Generating math...";
    System.out.println(msg);
    mathMappingCallback.setMessage(msg);
    mathMappingCallback.setProgressFraction(progressFractionQuota);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) UserCancelException(org.vcell.util.UserCancelException) ArrayList(java.util.ArrayList) Product(cbit.vcell.model.Product) SpeciesContext(cbit.vcell.model.SpeciesContext) FakeSeedSpeciesInitialConditionsParameter(org.vcell.model.rbm.FakeSeedSpeciesInitialConditionsParameter) Reactant(cbit.vcell.model.Reactant) BNGOutputSpec(cbit.vcell.bionetgen.BNGOutputSpec) ExpressionException(cbit.vcell.parser.ExpressionException) LinkedHashMap(java.util.LinkedHashMap) FakeReactionRuleRateParameter(org.vcell.model.rbm.FakeReactionRuleRateParameter) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) RbmModelContainer(cbit.vcell.model.Model.RbmModelContainer) Species(cbit.vcell.model.Species) BNGSpecies(cbit.vcell.bionetgen.BNGSpecies) HashSet(java.util.HashSet) BNGParameter(cbit.vcell.bionetgen.BNGParameter) ModelException(cbit.vcell.model.ModelException) ObservableGroup(cbit.vcell.bionetgen.ObservableGroup) RbmObservable(cbit.vcell.model.RbmObservable) PropertyVetoException(java.beans.PropertyVetoException) BNGReaction(cbit.vcell.bionetgen.BNGReaction) VCUnitDefinition(cbit.vcell.units.VCUnitDefinition) ReactionStep(cbit.vcell.model.ReactionStep) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) Structure(cbit.vcell.model.Structure) SimpleReaction(cbit.vcell.model.SimpleReaction) ReactionRule(cbit.vcell.model.ReactionRule) IOException(java.io.IOException) ExpressionBindingException(cbit.vcell.parser.ExpressionBindingException) Expression(cbit.vcell.parser.Expression) Model(cbit.vcell.model.Model) FakeSeedSpeciesInitialConditionsParameter(org.vcell.model.rbm.FakeSeedSpeciesInitialConditionsParameter) Parameter(cbit.vcell.model.Parameter) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) LocalParameter(cbit.vcell.mapping.ParameterContext.LocalParameter) BNGParameter(cbit.vcell.bionetgen.BNGParameter) FakeReactionRuleRateParameter(org.vcell.model.rbm.FakeReactionRuleRateParameter) MassActionKinetics(cbit.vcell.model.MassActionKinetics) ParseException(org.vcell.model.bngl.ParseException) BNGSpecies(cbit.vcell.bionetgen.BNGSpecies)

Example 10 with UserCancelException

use of org.vcell.util.UserCancelException in project vcell by virtualcell.

the class FieldDataGUIPanel method getJButtonCreateGeom.

/**
 * This method initializes jButtonCopyInfo
 *
 * @return javax.swing.JButton
 */
private JButton getJButtonCreateGeom() {
    if (jButtonCreateGeom == null) {
        jButtonCreateGeom = new JButton();
        jButtonCreateGeom.setEnabled(false);
        jButtonCreateGeom.setText("Create Geom");
        jButtonCreateGeom.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                    RequestManager clientRequestManager = fieldDataWindowManager.getLocalRequestManager();
                    javax.swing.tree.TreePath selPath = getJTree1().getSelectionPath();
                    javax.swing.tree.DefaultMutableTreeNode lastPathComponent = (javax.swing.tree.DefaultMutableTreeNode) selPath.getLastPathComponent();
                    if (lastPathComponent.getUserObject() instanceof FieldDataVarList) {
                        DataIdentifier dataIdentifier = ((FieldDataVarList) lastPathComponent.getUserObject()).dataIdentifier;
                        TreePath ppPath = selPath.getParentPath().getParentPath();
                        javax.swing.tree.DefaultMutableTreeNode ppLastPathComp = (javax.swing.tree.DefaultMutableTreeNode) ppPath.getLastPathComponent();
                        if (ppLastPathComp.getUserObject() instanceof FieldDataMainList) {
                            ExternalDataIdentifier extDataID = ((FieldDataMainList) ppLastPathComp.getUserObject()).externalDataIdentifier;
                            final OpenModelInfoHolder openModelInfoHolder = FieldDataWindowManager.selectOpenModelsFromDesktop(FieldDataGUIPanel.this, fieldDataWindowManager.getRequestManager(), false, "Select BioModel or MathModel to receive new geometry", false);
                            if (openModelInfoHolder == null) {
                                DialogUtils.showErrorDialog(FieldDataGUIPanel.this, "Before proceeding, please open a Biomodel application or Mathmodel you wish to apply a new Field Data Geometry to");
                                return;
                            }
                            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");
                                    final String OK_OPTION = "Ok";
                                    if (openModelInfoHolder instanceof FDSimMathModelInfo) {
                                        Version version = ((FDSimMathModelInfo) openModelInfoHolder).getMathModelVersion();
                                        String modelName = (version == null ? "NoName" : version.getName());
                                        if (newGeom.getName() == null) {
                                            newGeom.setName(modelName + "_" + BeanUtils.generateDateTimeString());
                                        }
                                        String message = "Confirm Setting new FieldData derived geometry on MathModel '" + modelName + "'";
                                        if (DialogUtils.showWarningDialog(FieldDataGUIPanel.this, message, new String[] { OK_OPTION, "Cancel" }, OK_OPTION).equals(OK_OPTION)) {
                                            ((FDSimMathModelInfo) openModelInfoHolder).getMathDescription().setGeometry(newGeom);
                                        }
                                    } else if (openModelInfoHolder instanceof FDSimBioModelInfo) {
                                        Version version = ((FDSimBioModelInfo) openModelInfoHolder).getBioModelVersion();
                                        String modelName = (version == null ? "NoName" : version.getName());
                                        String simContextName = ((FDSimBioModelInfo) openModelInfoHolder).getSimulationContext().getName();
                                        if (newGeom.getName() == null) {
                                            newGeom.setName(modelName + "_" + simContextName + "_" + BeanUtils.generateDateTimeString());
                                        }
                                        String message = "Confirm Setting new FieldData derived geometry on BioModel '" + modelName + "' , Application '" + simContextName + "'";
                                        if (DialogUtils.showWarningDialog(FieldDataGUIPanel.this, message, new String[] { OK_OPTION, "Cancel" }, OK_OPTION).equals(OK_OPTION)) {
                                            ((FDSimBioModelInfo) openModelInfoHolder).getSimulationContext().setGeometry(newGeom);
                                        }
                                    }
                                }
                            };
                            VCDocument.GeomFromFieldDataCreationInfo geomFromFieldDataCreationInfo = new VCDocument.GeomFromFieldDataCreationInfo(extDataID, dataIdentifier.getName());
                            AsynchClientTask[] createGeomTask = clientRequestManager.createNewGeometryTasks(fieldDataWindowManager, geomFromFieldDataCreationInfo, new AsynchClientTask[] { applyGeomTask }, "Apply Geometry");
                            Hashtable<String, Object> hash = new Hashtable<String, Object>();
                            hash.put(ClientRequestManager.GUI_PARENT, fieldDataWindowManager.getComponent());
                            ClientTaskDispatcher.dispatch(FieldDataGUIPanel.this, hash, createGeomTask, false, false, null, true);
                        }
                    }
                } catch (UserCancelException e1) {
                // ignore
                } catch (Exception e1) {
                    e1.printStackTrace();
                    DialogUtils.showErrorDialog(FieldDataGUIPanel.this, e1.getMessage());
                }
            // jButtonFDCopyRef_ActionPerformed(e);
            // fieldDataWindowManager.newDocument(VCDocument.GEOMETRY_DOC, option);
            // copyMethod(COPY_CRNL);
            // //				javax.swing.tree.TreePath selPath = getJTree1().getSelectionPath();
            // //				if(selPath != null){
            // //					javax.swing.tree.DefaultMutableTreeNode lastPathComponent = (javax.swing.tree.DefaultMutableTreeNode)selPath.getLastPathComponent();
            // //					copyMethod(lastPathComponent, copyMode);
            // //				}
            // //					String copyString = "";
            // //					javax.swing.tree.DefaultMutableTreeNode lastPathComponent = (javax.swing.tree.DefaultMutableTreeNode)selPath.getLastPathComponent();
            // //					if(lastPathComponent.equals(getJTree1().getModel().getRoot())){
            // //						int childCount = lastPathComponent.getChildCount();
            // //						for(int i=0;i<childCount;i+= 1){
            // //							if(i != 0){
            // //								copyString+="\n";
            // //							}
            // //							copyString+=
            // //								((FieldDataMainList)((DefaultMutableTreeNode)lastPathComponent.getChildAt(i)).getUserObject()).externalDataIdentifier.getName();
            // //						}
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataOriginList){
            // //						Origin origin = ((FieldDataOriginList)lastPathComponent.getUserObject()).origin;
            // //						copyString = origin.getX()+","+origin.getY()+","+origin.getZ();
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataExtentList){
            // //						Extent extent = ((FieldDataExtentList)lastPathComponent.getUserObject()).extent;
            // //						copyString = extent.getX()+","+extent.getY()+","+extent.getZ();
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataISizeList){
            // //						ISize isize = ((FieldDataISizeList)lastPathComponent.getUserObject()).isize;
            // //						copyString = isize.getX()+","+isize.getY()+","+isize.getZ();
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataTimeList){
            // //						double[] times = ((FieldDataTimeList)lastPathComponent.getUserObject()).times;
            // //						for(int i=0;i<times.length;i+= 1){
            // //							if(i != 0){
            // //								copyString+="\n";
            // //							}
            // //							copyString+= times[i]+"";
            // //						}
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataMainList){
            // //						ExternalDataIdentifier extDataID =
            // //							((FieldDataMainList)lastPathComponent.getUserObject()).externalDataIdentifier;
            // //						copyString = extDataID.getName();
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataVarList){
            // //						DataIdentifier dataIdentifier =
            // //							((FieldDataVarList)lastPathComponent.getUserObject()).dataIdentifier;
            // //						copyString = dataIdentifier.getName();
            // //					}else if(lastPathComponent.getUserObject() instanceof FieldDataVarMainList){
            // //						int childCount = lastPathComponent.getChildCount();
            // //						for(int i=0;i<childCount;i+= 1){
            // //							if(i != 0){
            // //								copyString+="\n";
            // //							}
            // //							copyString+=
            // //								((FieldDataVarList)((DefaultMutableTreeNode)lastPathComponent.getChildAt(i)).getUserObject()).dataIdentifier.getName();
            // //						}
            // //					}
            // //					if(copyString.length() > 0 ){
            // //						VCellTransferable.sendToClipboard(copyString);
            // //					}
            // //				}
            }
        });
    }
    return jButtonCreateGeom;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) ActionListener(java.awt.event.ActionListener) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) JButton(javax.swing.JButton) UserCancelException(org.vcell.util.UserCancelException) RequestManager(cbit.vcell.client.RequestManager) ClientRequestManager(cbit.vcell.client.ClientRequestManager) Version(org.vcell.util.document.Version) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDocument(org.vcell.util.document.VCDocument) Hashtable(java.util.Hashtable) FDSimMathModelInfo(cbit.vcell.client.TopLevelWindowManager.FDSimMathModelInfo) OpenModelInfoHolder(cbit.vcell.client.TopLevelWindowManager.OpenModelInfoHolder) ActionEvent(java.awt.event.ActionEvent) DataFormatException(java.util.zip.DataFormatException) UserCancelException(org.vcell.util.UserCancelException) Geometry(cbit.vcell.geometry.Geometry) TreePath(javax.swing.tree.TreePath) FDSimBioModelInfo(cbit.vcell.client.TopLevelWindowManager.FDSimBioModelInfo)

Aggregations

UserCancelException (org.vcell.util.UserCancelException)44 Hashtable (java.util.Hashtable)15 UtilCancelException (org.vcell.util.UtilCancelException)15 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)14 PropertyVetoException (java.beans.PropertyVetoException)11 DataAccessException (org.vcell.util.DataAccessException)10 Vector (java.util.Vector)9 ActionEvent (java.awt.event.ActionEvent)8 DataFormatException (java.util.zip.DataFormatException)8 BioModel (cbit.vcell.biomodel.BioModel)7 ActionListener (java.awt.event.ActionListener)7 IOException (java.io.IOException)7 Point (java.awt.Point)6 ArrayList (java.util.ArrayList)6 ImageException (cbit.image.ImageException)5 CSGObject (cbit.vcell.geometry.CSGObject)5 GeometryException (cbit.vcell.geometry.GeometryException)5 Structure (cbit.vcell.model.Structure)5 JButton (javax.swing.JButton)5 ProgrammingException (org.vcell.util.ProgrammingException)5