Search in sources :

Example 1 with DictionaryQueryResults

use of cbit.vcell.dictionary.DictionaryQueryResults in project vcell by virtualcell.

the class SpeciesQueryPanel method setDictionaryQueryResults.

/**
 * Sets the dictionaryQueryResults property (cbit.vcell.dictionary.DictionaryQueryResults) value.
 * @param dictionaryQueryResults The new value for the property.
 * @see #getDictionaryQueryResults
 */
private void setDictionaryQueryResults(cbit.vcell.dictionary.DictionaryQueryResults dictionaryQueryResults) {
    DictionaryQueryResults oldValue = fieldDictionaryQueryResults;
    fieldDictionaryQueryResults = dictionaryQueryResults;
    firePropertyChange("dictionaryQueryResults", oldValue, dictionaryQueryResults);
}
Also used : DictionaryQueryResults(cbit.vcell.dictionary.DictionaryQueryResults)

Example 2 with DictionaryQueryResults

use of cbit.vcell.dictionary.DictionaryQueryResults in project vcell by virtualcell.

the class SpeciesQueryPanel method createDBSpecies.

/**
 * Comment
 */
private void createDBSpecies(javax.swing.event.ListSelectionEvent listSelectionEvent) {
    if (bIgnoreSelection) {
        return;
    }
    if (getDocumentManager() != null) {
        if (!listSelectionEvent.getValueIsAdjusting()) {
            if (!((javax.swing.ListSelectionModel) listSelectionEvent.getSource()).isSelectionEmpty()) {
                try {
                    javax.swing.JList selectionJList = null;
                    if (getCompoundJList().getSelectionModel() == listSelectionEvent.getSource()) {
                        selectionJList = getCompoundJList();
                    } else if (getEnzymeJList().getSelectionModel() == listSelectionEvent.getSource()) {
                        selectionJList = getEnzymeJList();
                    } else if (getProteinJList().getSelectionModel() == listSelectionEvent.getSource()) {
                        selectionJList = getProteinJList();
                    } else {
                        throw new RuntimeException("Unknown ListSelectionModel");
                    }
                    int[] selection = new int[1];
                    selection[0] = selectionJList.getSelectedIndex();
                    DBFormalSpecies[] dbFormalSpecies = jlistData.get(selectionJList);
                    String query = jlistQuery.get(selectionJList);
                    ButtonModel scope = jlistScope.get(selectionJList);
                    boolean bBound = (scope != getDictionaryJRadioButton().getModel());
                    boolean bOnlyUser = (scope == getMyModelJRadioButton().getModel());
                    DictionaryQueryResults dqr = null;
                    if (bBound) {
                        if (getDocumentManager().getUser() == null) {
                            throw new RuntimeException("Query results for 'My Model' can't be bound to null user");
                        }
                        org.vcell.util.document.User user = (bOnlyUser ? getDocumentManager().getUser() : null);
                        dqr = new DictionaryQueryResults(query, user, (DBSpecies[]) dbFormalSpecies, selection);
                    } else {
                        dqr = new DictionaryQueryResults(query, dbFormalSpecies, selection);
                    }
                    setDictionaryQueryResults(dqr);
                    // Clear other selections
                    bIgnoreSelection = true;
                    if (getCompoundJList() != selectionJList) {
                        getCompoundJList().clearSelection();
                    }
                    if (getEnzymeJList() != selectionJList) {
                        getEnzymeJList().clearSelection();
                    }
                    if (getProteinJList() != selectionJList) {
                        getProteinJList().clearSelection();
                    }
                    bIgnoreSelection = false;
                } catch (Exception e) {
                    e.printStackTrace();
                    PopupGenerator.showErrorDialog(this, "Error:\n" + e.getMessage(), e);
                }
            } else {
                setDictionaryQueryResults(null);
            }
        }
    }
}
Also used : JList(javax.swing.JList) DictionaryQueryResults(cbit.vcell.dictionary.DictionaryQueryResults) DBFormalSpecies(cbit.vcell.model.DBFormalSpecies) ButtonModel(javax.swing.ButtonModel)

Example 3 with DictionaryQueryResults

use of cbit.vcell.dictionary.DictionaryQueryResults in project vcell by virtualcell.

the class DBReactionWizardPanel method showSpeciesBrowser.

/**
 * Comment
 */
private DBFormalSpecies showSpeciesBrowser() {
    SpeciesQueryDialog sqd = new SpeciesQueryDialog((java.awt.Frame) null, true);
    sqd.setSearchableTypes(SpeciesQueryPanel.SEARCHABLE_ENZYME | SpeciesQueryPanel.SEARCHABLE_COMPOUND | (getSearchUserJRadioButton().isSelected() ? SpeciesQueryPanel.SEARCHABLE_PROTEIN : 0x00L));
    // boolean isDictSearch = getJTabbedPane1().getTitleAt(getJTabbedPane1().getSelectedIndex()).equals("Dictionary");
    // if(getSearchDictionaryJRadioButton().isSelected()){
    // if(getAnyJRadioButton().isSelected()){
    // sqd.setSearchableTypes(SpeciesQueryPanel.SEARCHABLE_ENZYME | SpeciesQueryPanel.SEARCHABLE_COMPOUND);
    // }else{
    // sqd.setSearchableTypes((getCatalystJRadioButton().isSelected()?SpeciesQueryPanel.SEARCHABLE_ENZYME:SpeciesQueryPanel.SEARCHABLE_COMPOUND));
    // }
    // }
    sqd.setDocumentManager(getDocumentManager());
    sqd.setSize(550, 500);
    BeanUtils.centerOnScreen(sqd);
    DialogUtils.showModalJDialogOnTop(sqd, this);
    // sqd.setVisible(true);
    DBFormalSpecies dbfs = null;
    DictionaryQueryResults dqr = sqd.getDictionaryQueryResults();
    if (dqr != null && dqr.getSelection() != null) {
        dbfs = dqr.getDBFormalSpecies()[dqr.getSelection()[0]];
    }
    if (dbfs != null) {
        setCurrentDBFormalSpecies(dbfs);
    }
    return dbfs;
}
Also used : DBFormalSpecies(cbit.vcell.model.DBFormalSpecies) DictionaryQueryResults(cbit.vcell.dictionary.DictionaryQueryResults)

Aggregations

DictionaryQueryResults (cbit.vcell.dictionary.DictionaryQueryResults)3 DBFormalSpecies (cbit.vcell.model.DBFormalSpecies)2 ButtonModel (javax.swing.ButtonModel)1 JList (javax.swing.JList)1