Search in sources :

Example 1 with ReactionQuerySpec

use of cbit.vcell.model.ReactionQuerySpec in project vcell by virtualcell.

the class DBReactionWizardPanel method search.

/**
 * Comment
 */
private void search() {
    if (getDocumentManager() != null) {
        String textSearchS = getFindTextJTextField().getText();
        if (textSearchS != null && textSearchS.length() == 0) {
            textSearchS = null;
        }
        final ReactionQuerySpec reactionQuerySpec = new ReactionQuerySpec((getFindRXTextRadioButton().isSelected() ? formatLikeString(textSearchS) : null), (getKeggMoleculeJRadioButton().isSelected() ? getCurrentDBFormalSpecies() : null));
        if (getSearchUserJRadioButton().isSelected()) {
            searchUserReactions(reactionQuerySpec);
            return;
        }
        final DocumentManager docManager = getDocumentManager();
        final javax.swing.JList jlist = getReactionsJList();
        // 
        final String RXDESC_VALUE_KEY = "rxDesc";
        AsynchClientTask searchReactions = new AsynchClientTask("searching reactions", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

            public void run(Hashtable<String, Object> hash) throws DataAccessException {
                ReactionDescription[] dbfr = docManager.getDictionaryReactions(reactionQuerySpec);
                if (dbfr != null && dbfr.length > 0) {
                    hash.put(RXDESC_VALUE_KEY, dbfr);
                }
            }
        };
        // 
        AsynchClientTask updateRXList = new AsynchClientTask("updateRXList", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

            public void run(Hashtable<String, Object> hash) {
                ReactionDescription[] dbfr = (ReactionDescription[]) hash.get(RXDESC_VALUE_KEY);
                if (dbfr != null) {
                    jlist.setListData(dbfr);
                } else {
                    jlist.setListData(new ReactionDescription[0]);
                }
                afterSearchConfigure();
            }
        };
        // 
        Hashtable<String, Object> hashTemp = new Hashtable<String, Object>();
        ClientTaskDispatcher.dispatch(this, hashTemp, new AsynchClientTask[] { searchReactions, updateRXList }, false);
    }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) DocumentManager(cbit.vcell.clientdb.DocumentManager) JList(javax.swing.JList) ReactionQuerySpec(cbit.vcell.model.ReactionQuerySpec) ReactionDescription(cbit.vcell.model.ReactionDescription)

Aggregations

AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1 DocumentManager (cbit.vcell.clientdb.DocumentManager)1 ReactionDescription (cbit.vcell.model.ReactionDescription)1 ReactionQuerySpec (cbit.vcell.model.ReactionQuerySpec)1 Hashtable (java.util.Hashtable)1 JList (javax.swing.JList)1