use of cbit.vcell.model.KineticsDescription in project vcell by virtualcell.
the class KineticsTypeTemplatePanel method getKineticsTypeComboBox.
private javax.swing.JComboBox getKineticsTypeComboBox() {
if (kineticsTypeComboBox == null) {
try {
kineticsTypeComboBox = new javax.swing.JComboBox();
kineticsTypeComboBox.setName("JComboBox1");
kineticsTypeComboBox.setRenderer(new DefaultListCellRenderer() {
private static final String MU = "\u03BC";
private static final String MICROMOLAR = MU + "M";
private static final String SQUARED = "\u00B2";
private static final String SQUAREMICRON = MU + "m" + SQUARED;
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
java.awt.Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof KineticsDescription) {
KineticsDescription kineticsDescription = (KineticsDescription) value;
if (getKinetics() != null && getKinetics().getReactionStep() != null) {
if (getKinetics().getReactionStep().getStructure() instanceof Feature) {
if (kineticsDescription.equals(KineticsDescription.General)) {
setText("General [" + MICROMOLAR + "/s]");
} else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
setText("Mass Action [" + MICROMOLAR + "/s] (recommended for stochastic application)");
} else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
setText("General [molecules/s]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
setText("Henri-Michaelis-Menten (Irreversible) [" + MICROMOLAR + "/s]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
setText("Henri-Michaelis-Menten (Reversible) [" + MICROMOLAR + "/s]");
} else {
setText(kineticsDescription.getDescription());
}
} else if (getKinetics().getReactionStep().getStructure() instanceof Membrane) {
if (kineticsDescription.equals(KineticsDescription.General)) {
setText("General [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
setText("Mass Action [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
setText("General [molecules/s)]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
setText("Henri-Michaelis-Menten (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
setText("Henri-Michaelis-Menten (Reversible) [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.Macroscopic_irreversible)) {
setText("Macroscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.Microscopic_irreversible)) {
setText("Microscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
} else {
setText(kineticsDescription.getDescription());
}
}
} else {
setText(kineticsDescription.getDescription());
}
}
return component;
}
});
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return kineticsTypeComboBox;
}
use of cbit.vcell.model.KineticsDescription in project vcell by virtualcell.
the class KineticsTypeTemplatePanel method initKineticChoices.
private void initKineticChoices() {
KineticsDescription[] kineticTypes = reactionStep == null || reactionStep instanceof SimpleReaction ? Simple_Reaction_Kinetic_Types : Flux_Reaction_KineticTypes;
javax.swing.DefaultComboBoxModel model = new DefaultComboBoxModel();
for (int i = 0; i < kineticTypes.length; i++) {
model.addElement(kineticTypes[i]);
}
getKineticsTypeComboBox().setModel(model);
return;
}
use of cbit.vcell.model.KineticsDescription in project vcell by virtualcell.
the class ReactionPropertiesPanel method getKineticsTypeComboBox.
private javax.swing.JComboBox getKineticsTypeComboBox() {
if (kineticsTypeComboBox == null) {
try {
kineticsTypeComboBox = new javax.swing.JComboBox();
kineticsTypeComboBox.setName("JComboBox1");
kineticsTypeComboBox.setRenderer(new DefaultListCellRenderer() {
private static final String MU = "\u03BC";
private static final String MICROMOLAR = MU + "M";
private static final String SQUARED = "\u00B2";
private static final String SQUAREMICRON = MU + "m" + SQUARED;
private static final String MICRON = MU + "m";
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
java.awt.Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof KineticsDescription) {
KineticsDescription kineticsDescription = (KineticsDescription) value;
setText(kineticsDescription.getDescription());
if (reactionStep != null) {
if (reactionStep instanceof SimpleReaction) {
if (reactionStep.getStructure() instanceof Feature) {
if (kineticsDescription.equals(KineticsDescription.General)) {
setText("General [" + MICROMOLAR + "/s]");
} else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
setText("Mass Action [" + MICROMOLAR + "/s] (recommended for stochastic application)");
} else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
setText("General [molecules/s]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
setText("Henri-Michaelis-Menten (Irreversible) [" + MICROMOLAR + "/s]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
setText("Henri-Michaelis-Menten (Reversible) [" + MICROMOLAR + "/s]");
} else {
setText(kineticsDescription.getDescription());
}
} else if (reactionStep.getStructure() instanceof Membrane) {
if (kineticsDescription.equals(KineticsDescription.General)) {
setText("General [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
setText("Mass Action [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
setText("General [molecules/s)]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
setText("Henri-Michaelis-Menten (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
setText("Henri-Michaelis-Menten (Reversible) [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.Macroscopic_irreversible)) {
setText("Macroscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
} else if (kineticsDescription.equals(KineticsDescription.Microscopic_irreversible)) {
setText("Microscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
}
}
} else if (reactionStep instanceof FluxReaction) {
if (kineticsDescription.equals(KineticsDescription.General)) {
setText("General Flux Density (" + MICROMOLAR + "-" + MICRON + "/s)");
} else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
setText("General Flux (molecules/s)");
} else if (kineticsDescription.equals(KineticsDescription.GeneralCurrent)) {
setText("General Current Density (pA/" + SQUAREMICRON + ")");
} else if (kineticsDescription.equals(KineticsDescription.GeneralCurrentLumped)) {
setText("General Current (pA)");
} else if (kineticsDescription.equals(KineticsDescription.GHK)) {
setText("Goldman-Hodgkin-Katz Current Density (pA/" + SQUAREMICRON + ") - permeability in " + MICRON + "/s");
} else if (kineticsDescription.equals(KineticsDescription.Nernst)) {
setText("Nernst Current Density (pA/" + SQUAREMICRON + ") - conductance in nS/" + SQUAREMICRON);
} else if (kineticsDescription.equals(KineticsDescription.GeneralPermeability)) {
setText("General Permeability (" + MICROMOLAR + "-" + MICRON + "/s) - permeability in " + MICRON + "/s");
}
}
}
}
return component;
}
});
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return kineticsTypeComboBox;
}
use of cbit.vcell.model.KineticsDescription in project vcell by virtualcell.
the class ReactionPropertiesPanel method initKineticChoices.
private void initKineticChoices() {
KineticsDescription[] kineticTypes = reactionStep == null || reactionStep instanceof SimpleReaction ? Simple_Reaction_Kinetic_Types : Flux_Reaction_KineticTypes;
javax.swing.DefaultComboBoxModel model = new DefaultComboBoxModel();
for (int i = 0; i < kineticTypes.length; i++) {
if (!(kineticTypes[i].equals(KineticsDescription.Macroscopic_irreversible) || kineticTypes[i].equals(KineticsDescription.Microscopic_irreversible))) {
model.addElement(kineticTypes[i]);
} else // macroscopic/microscopic irreversible
{
// reactions on membrane in a 3D geometry
if (reactionStep != null && reactionStep.getStructure() != null && reactionStep.getStructure() instanceof Membrane) {
// check if reactants are all on membrane and calculate sum of reactants' stoichiometry
ReactionParticipant[] rps = reactionStep.getReactionParticipants();
int order = 0;
boolean bAllMembraneReactants = true;
for (ReactionParticipant rp : rps) {
if (rp instanceof Reactant) {
if (!(rp.getStructure() instanceof Membrane)) {
bAllMembraneReactants = false;
break;
}
order += rp.getStoichiometry();
}
}
// add only if 2nd order membrane reaction
if (order == 2 && bAllMembraneReactants && !reactionStep.hasCatalyst()) {
model.addElement(kineticTypes[i]);
}
}
}
}
getKineticsTypeComboBox().setModel(model);
return;
}
use of cbit.vcell.model.KineticsDescription in project vcell by virtualcell.
the class ReactionPropertiesPanel method updateKineticChoice.
private void updateKineticChoice() {
KineticsDescription newKineticChoice = (KineticsDescription) getKineticsTypeComboBox().getSelectedItem();
//
if (reactionStep == null || reactionStep.getKinetics().getKineticsDescription().equals(newKineticChoice)) {
return;
}
boolean bFoundKineticType = false;
KineticsDescription[] kineticTypes = reactionStep instanceof SimpleReaction ? Simple_Reaction_Kinetic_Types : Flux_Reaction_KineticTypes;
for (int i = 0; i < kineticTypes.length; i++) {
if (kineticTypes[i].equals(newKineticChoice)) {
bFoundKineticType = true;
break;
}
}
if (!bFoundKineticType) {
return;
}
try {
reactionStep.setKinetics(newKineticChoice.createKinetics(reactionStep));
} catch (Exception exc) {
handleException(exc);
}
}
Aggregations