use of cbit.vcell.model.ReactionStepInfo in project vcell by virtualcell.
the class DictionaryDbDriver method getReactionStepInfos.
/**
* Insert the method's description here.
* Creation date: (4/18/2003 10:23:37 AM)
*/
public ReactionStepInfo[] getReactionStepInfos(Connection con, User user, KeyValue[] reactionStepKeys) throws SQLException {
String sql = ReactStepTable.table.getSQLReactionStepInfosQuery(reactionStepKeys, user, dbSyntax);
Statement stmt = con.createStatement();
Vector<ReactionStepInfo> reactionStepInfoList = new Vector<ReactionStepInfo>();
try {
ResultSet rset = stmt.executeQuery(sql);
while (rset.next()) {
java.math.BigDecimal rxID = rset.getBigDecimal(ReactStepTable.table.id.toString());
KeyValue rxKey = new KeyValue(rxID);
String modelOwnerName = rset.getString(UserTable.table.userid.toString());
java.math.BigDecimal modelOwnerID = rset.getBigDecimal(BioModelTable.table.ownerRef.toString());
User owner = new User(modelOwnerName, new KeyValue(modelOwnerID));
String bioModelName = rset.getString(ReactStepTable.RXIDDN_BIOMODEL_NAME_INDEX);
String rxName = rset.getString(ReactStepTable.RXIDDN_REACTSTEP_NAME_INDEX);
java.sql.Date bioModelDate = rset.getDate(BioModelTable.table.versionDate.toString());
String structType = rset.getString(StructTable.table.structType.getUnqualifiedColName());
ReactionStepInfo reactionStepInfo = new ReactionStepInfo(rxKey, owner, bioModelName, rxName, bioModelDate, structType);
reactionStepInfoList.add(reactionStepInfo);
}
} finally {
// Release resources include resultset
stmt.close();
}
if (reactionStepInfoList.size() == 0) {
return null;
}
return (ReactionStepInfo[]) BeanUtils.getArray(reactionStepInfoList, ReactionStepInfo.class);
}
use of cbit.vcell.model.ReactionStepInfo in project vcell by virtualcell.
the class DBReactionWizardPanel method configureRXParameterList.
/**
* Comment
*/
private void configureRXParameterList(javax.swing.event.ListSelectionEvent listSelectionEvent) {
//
final DefaultListModel<MapStringToObject> pndlm = (DefaultListModel<MapStringToObject>) getParameterNamesJList().getModel();
//
if (lastReactionSelection == null || !lastReactionSelection.equals(getReactionsJList().getSelectedValue())) {
lastReactionSelection = getReactionsJList().getSelectedValue();
setReactionStep(null);
setReactionDescription(null);
//
pndlm.removeAllElements();
//
if (getReactionsJList().getSelectedValue() instanceof String) {
// User Reactions
Vector<String> rxIDV = mapRXStringtoRXIDs.get(getReactionsJList().getSelectedValue());
// String[] rxIDArr = (String[])rxIDV.toArray(new String[rxIDV.size()]);
final KeyValue[] rxKeys = new KeyValue[rxIDV.size()];
for (int i = 0; i < rxKeys.length; i++) {
rxKeys[i] = new KeyValue(rxIDV.elementAt(i));
}
AsynchClientTask task1 = new AsynchClientTask("getting user reaction step infos", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
ReactionStepInfo[] reactionStepInfos = getDocumentManager().getUserReactionStepInfos(rxKeys);
hashTable.put("reactionStepInfos", reactionStepInfos);
}
};
AsynchClientTask task2 = new AsynchClientTask("getting user reaction step infos", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) {
ReactionStepInfo[] reactionStepInfos = (ReactionStepInfo[]) hashTable.get("reactionStepInfos");
for (int i = 0; reactionStepInfos != null && i < reactionStepInfos.length; i++) {
String structTypeName = (reactionStepInfos[i].getStructType().equals("feature") ? Structure.TYPE_NAME_FEATURE : (reactionStepInfos[i].getStructType().equals("membrane") ? Structure.TYPE_NAME_MEMBRANE : reactionStepInfos[i].getStructType()));
String descriptiveText = structTypeName + " " + reactionStepInfos[i].getOwner().getName() + " - " + " " + reactionStepInfos[i].getBioModelName() + " " + "(" + reactionStepInfos[i].getReactionName() + ")" + " " + reactionStepInfos[i].getBioModelVersionDate();
pndlm.addElement(new MapStringToObject(descriptiveText, /*reactionStepInfos[i].getDescriptiveText()*/
reactionStepInfos[i], getStructure().getTypeName().equals(structTypeName)));
}
}
};
Hashtable<String, Object> hash = new Hashtable<String, Object>();
AsynchClientTask[] taskArray = new AsynchClientTask[] { task1, task2 };
ClientTaskDispatcher.dispatch(this, hash, taskArray);
} else {
// Dictionary ReactionDescription
ReactionDescription dbfr = (ReactionDescription) getReactionsJList().getSelectedValue();
getRXParticipantResolverPanel().setupRX(dbfr, getModel(), getStructure());
}
}
// if(pndlm.size() == 0){
// //Skip parameters if there are none
// ((java.awt.CardLayout)getCardLayoutJPanel().getLayout()).next(getCardLayoutJPanel());
// }
}
use of cbit.vcell.model.ReactionStepInfo in project vcell by virtualcell.
the class DBReactionWizardPanel method parameterNameSelectionChanged.
/**
* Comment
*/
private void parameterNameSelectionChanged() {
try {
//
if (getParameterNamesJList().getSelectedValue() != null) {
// final cbit.vcell.clientdb.DocumentManager docManager = getDocumentManager();
// final javax.swing.JList jlist = getReactionsJList();
final MapStringToObject parameNameMSO = (MapStringToObject) getParameterNamesJList().getSelectedValue();
final KeyValue reactionStepKey = ((ReactionStepInfo) parameNameMSO.getToObject()).getReactionKey();
//
final String RXSTEP_HASH_VALUE_KEY = "rxStep";
AsynchClientTask searchReactions = new AsynchClientTask("Getting Full Reaction", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hash) throws Exception {
Model reactionModel = getDocumentManager().getReactionStepAsModel(reactionStepKey);
ReactionStep rStep = reactionModel.getReactionStep(((ReactionStepInfo) parameNameMSO.getToObject()).getReactionName());
if (rStep != null) {
rStep.rebindAllToModel(reactionModel);
hash.put(RXSTEP_HASH_VALUE_KEY, rStep);
}
}
};
//
AsynchClientTask updateRXParams = new AsynchClientTask("updateRXParams", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hash) throws DataAccessException {
ReactionStep rStep = (ReactionStep) hash.get(RXSTEP_HASH_VALUE_KEY);
if (rStep != null) {
Kinetics.KineticsParameter[] kpArr = rStep.getKinetics().getKineticsParameters();
ReactionParticipant[] rpArr = rStep.getReactionParticipants();
//
DefaultListModel<String> pvdlm = (DefaultListModel<String>) getParameterValuesJList().getModel();
pvdlm.removeAllElements();
for (int i = 0; i < kpArr.length; i += 1) {
pvdlm.addElement("Parameter - " + kpArr[i].getName().toString() + " = " + kpArr[i].getExpression().infix());
}
pvdlm.addElement("PhysicsOption=" + rStep.getPhysicsOptions());
for (int i = 0; i < rpArr.length; i += 1) {
String role = "Unknown";
if (rpArr[i] instanceof Reactant) {
role = "Reactant";
} else if (rpArr[i] instanceof Product) {
role = "Product";
} else if (rpArr[i] instanceof Catalyst) {
role = "Catalyst";
}
String fluxFlag = "";
// if(rStep instanceof FluxReaction){
// Membrane rStepStruct = (Membrane)rStep.getStructure();
// if(rpArr[i] instanceof Flux){
// if(rpArr[i].getStructure().equals(getModel().getStructureTopology().getOutsideFeature(rStepStruct))){
// fluxFlag = "Outside";
// }else{
// fluxFlag = "Inside";
// }
// }
// }
pvdlm.addElement("RXParticipant(" + role + ") " + fluxFlag + " " + (rpArr[i].getSpecies().getDBSpecies() != null ? "*" : "-") + " " + rpArr[i].getSpeciesContext().getName());
}
}
setReactionStep(rStep);
configureBFN();
}
};
//
Hashtable<String, Object> hashTemp = new Hashtable<String, Object>();
ClientTaskDispatcher.dispatch(this, hashTemp, new AsynchClientTask[] { searchReactions, updateRXParams }, true);
} else {
setReactionStep(null);
}
} catch (Exception e) {
PopupGenerator.showErrorDialog(this, e.getMessage(), e);
}
//
configureBFN();
}
Aggregations