Search in sources :

Example 11 with ScopedExpression

use of cbit.gui.ScopedExpression in project vcell by virtualcell.

the class EventAssignmentsTableModel method setValueAt.

public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    if (rowIndex < 0 || rowIndex >= getRowCount()) {
        throw new RuntimeException("EventAssignmentsTableModel.setValueAt(), row = " + rowIndex + " out of range [" + 0 + "," + (getRowCount() - 1) + "]");
    }
    if (columnIndex < 0 || columnIndex >= getColumnCount()) {
        throw new RuntimeException("EventAssignmentsTableModel.setValueAt(), column = " + columnIndex + " out of range [" + 0 + "," + (getColumnCount() - 1) + "]");
    }
    EventAssignment eventAssignment = (EventAssignment) getValueAt(rowIndex);
    switch(columnIndex) {
        case COLUMN_EVENTASSIGN_EXPRESSION:
            {
                try {
                    if (aValue instanceof ScopedExpression) {
                        throw new RuntimeException("unexpected value type ScopedExpression");
                    } else if (aValue instanceof String) {
                        Expression exp = new Expression((String) aValue);
                        eventAssignment.setAssignmentExpression(exp);
                    }
                    fireTableRowsUpdated(rowIndex, rowIndex);
                } catch (ExpressionException e) {
                    e.printStackTrace(System.out);
                    PopupGenerator.showErrorDialog(ownerTable, "Expression error:\n" + e.getMessage());
                }
                break;
            }
    }
}
Also used : ScopedExpression(cbit.gui.ScopedExpression) EventAssignment(cbit.vcell.mapping.BioEvent.EventAssignment) ScopedExpression(cbit.gui.ScopedExpression) Expression(cbit.vcell.parser.Expression) ExpressionException(cbit.vcell.parser.ExpressionException)

Aggregations

ScopedExpression (cbit.gui.ScopedExpression)11 Expression (cbit.vcell.parser.Expression)7 ExpressionException (cbit.vcell.parser.ExpressionException)6 SpeciesContextSpecParameter (cbit.vcell.mapping.SpeciesContextSpec.SpeciesContextSpecParameter)3 SpeciesContext (cbit.vcell.model.SpeciesContext)3 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)3 VCellSortTableModel (cbit.vcell.client.desktop.biomodel.VCellSortTableModel)2 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)2 Kinetics (cbit.vcell.model.Kinetics)2 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)2 ModelParameter (cbit.vcell.model.Model.ModelParameter)2 ModelQuantity (cbit.vcell.model.ModelQuantity)2 ModelUnitSystem (cbit.vcell.model.ModelUnitSystem)2 Parameter (cbit.vcell.model.Parameter)2 VCUnitException (cbit.vcell.units.VCUnitException)2 PropertyVetoException (java.beans.PropertyVetoException)2 TableModel (javax.swing.table.TableModel)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1 GeneralConstraint (cbit.vcell.constraints.GeneralConstraint)1 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)1