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;
}
Aggregations