Search in sources :

Example 1 with SymbolTableEntryListCellRenderer

use of cbit.vcell.modelopt.gui.SymbolTableEntryListCellRenderer in project vcell by virtualcell.

the class ParameterEstimationPanel method mapButton_ActionPerformed.

/**
 * Comment
 */
private void mapButton_ActionPerformed() {
    if (getParameterEstimationTask() == null) {
        return;
    }
    SymbolTableEntry[] symbolTableEntries = getParameterEstimationTask().getModelOptimizationSpec().calculateTimeDependentModelObjects(getParameterEstimationTask().getModelOptimizationSpec().getSimulationContext());
    java.util.Comparator<SymbolTableEntry> steComparator = new java.util.Comparator<SymbolTableEntry>() {

        private Class<?>[] classOrder = new Class<?>[] { Model.ReservedSymbol.class, SpeciesContext.class, Model.ModelParameter.class, Kinetics.KineticsParameter.class };

        public int compare(SymbolTableEntry ste1, SymbolTableEntry ste2) {
            int ste1Category = 100;
            int ste2Category = 100;
            for (int i = 0; i < classOrder.length; i++) {
                if (ste1.getClass().equals(classOrder[i])) {
                    ste1Category = i;
                }
                if (ste2.getClass().equals(classOrder[i])) {
                    ste2Category = i;
                }
            }
            if (ste1Category < ste2Category) {
                return 1;
            } else if (ste1Category > ste2Category) {
                return -1;
            } else {
                return ste1.getName().compareTo(ste2.getName());
            }
        }
    };
    java.util.Arrays.sort(symbolTableEntries, steComparator);
    SymbolTableEntry ste = (SymbolTableEntry) DialogUtils.showListDialog(this, symbolTableEntries, "Map Experimental Data", new SymbolTableEntryListCellRenderer());
    if (ste != null && getDataModelMappingTable().getSelectionModel().getMaxSelectionIndex() >= 0) {
        ReferenceDataMappingSpec refDataMappingSpec = getParameterEstimationTask().getModelOptimizationSpec().getReferenceDataMappingSpecs()[getDataModelMappingTable().getSelectionModel().getMaxSelectionIndex()];
        try {
            refDataMappingSpec.setModelObject(ste);
        } catch (java.beans.PropertyVetoException e) {
            e.printStackTrace(System.out);
            DialogUtils.showErrorDialog(this, e.getMessage());
        }
    }
    return;
}
Also used : ReferenceDataMappingSpec(cbit.vcell.modelopt.ReferenceDataMappingSpec) SymbolTableEntryListCellRenderer(cbit.vcell.modelopt.gui.SymbolTableEntryListCellRenderer) PropertyVetoException(java.beans.PropertyVetoException) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) ReferenceDataMappingSpecTableModel(org.vcell.optimization.gui.ReferenceDataMappingSpecTableModel) AnalysisTaskComboBoxModel(org.vcell.optimization.gui.AnalysisTaskComboBoxModel) Model(cbit.vcell.model.Model) Kinetics(cbit.vcell.model.Kinetics)

Aggregations

Kinetics (cbit.vcell.model.Kinetics)1 Model (cbit.vcell.model.Model)1 ReferenceDataMappingSpec (cbit.vcell.modelopt.ReferenceDataMappingSpec)1 SymbolTableEntryListCellRenderer (cbit.vcell.modelopt.gui.SymbolTableEntryListCellRenderer)1 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)1 PropertyVetoException (java.beans.PropertyVetoException)1 AnalysisTaskComboBoxModel (org.vcell.optimization.gui.AnalysisTaskComboBoxModel)1 ReferenceDataMappingSpecTableModel (org.vcell.optimization.gui.ReferenceDataMappingSpecTableModel)1