001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 * Created on Jul 16, 2010
021 * Author: ap3
022 *
023 */
024
025package org.biojava.nbio.structure.align.gui;
026
027import org.biojava.nbio.structure.align.util.UserConfiguration;
028import org.biojava.nbio.structure.align.webstart.WebStartMain;
029
030import javax.swing.*;
031import java.awt.event.ActionEvent;
032import java.awt.event.ActionListener;
033
034
035public class ShowPDBIDListener
036implements ActionListener {
037        @Override
038        public void actionPerformed(ActionEvent e) {
039                String cmd = e.getActionCommand();
040                if ( cmd.equals("Show By ID")){
041
042                        JCheckBox useBioAssembly = new JCheckBox("Show Biological Assembly");
043
044                        String msg = "Which ID to display?";
045                        Object[] params = {msg, useBioAssembly};
046
047                        String pdbId = JOptionPane.showInputDialog(null,
048                                        params,
049                                        "Enter PDB ID, PDB.chainName, or SCOP domain ID",
050                                        JOptionPane.QUESTION_MESSAGE);
051
052                        if ( pdbId != null) {
053                                try {
054                                        pdbId = pdbId.trim();
055                                        UserConfiguration config = WebStartMain.getWebStartConfig();
056
057                                        StructureLoaderThread r = new StructureLoaderThread(config,pdbId, useBioAssembly.isSelected());
058
059                                        StructureLoaderThread.showProgressBar();
060
061                                        r.execute();
062
063
064                                } catch (Exception ex){
065                                        ex.printStackTrace();
066                                }
067                        }
068                }
069        }
070
071
072
073
074}