X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGStructureChooser.java;h=9569006de08c07c012addfd190e130650413a828;hb=e4a49e444d89dc2d8d35913813bddc3a0dabcad6;hp=69b1fe69d23160ec54b833570049a3b32b21cf8a;hpb=7d76e402efd4e04e179bc9bb264551bc2d3df936;p=jalview.git diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 69b1fe6..9569006 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -3,6 +3,7 @@ package jalview.jbgui; import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; import jalview.util.MessageManager; +import jalview.ws.uimodel.PDBSearchResponse.PDBResponseSummary; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -34,7 +35,7 @@ public abstract class GStructureChooser extends JPanel implements - protected JComboBox filterOptions = new JComboBox(); + protected JComboBox filterOptionsComboBox = new JComboBox(); protected AlignmentPanel ap; @@ -44,7 +45,7 @@ public abstract class GStructureChooser extends JPanel implements protected JButton cancel = new JButton(); - protected JButton selectFile = new JButton(); + protected JButton pdbFromFile = new JButton(); protected JTextField search = new JTextField(16); @@ -70,13 +71,13 @@ public abstract class GStructureChooser extends JPanel implements protected JCheckBox rememberSettings = new JCheckBox("Don't ask me again"); - protected static final String VIEWS_AUTO = "auto_view"; + protected static final String VIEWS_FILTER = "VIEWS_FILTER"; - protected static final String VIEWS_FILE = "file_view"; + protected static final String VIEWS_FROM_FILE = "VIEWS_FROM_FILE"; - protected static final String VIEWS_ID = "id_view"; + protected static final String VIEWS_ENTER_ID = "VIEWS_ENTER_ID"; - protected JList jListFoundStructures = new JList(); + protected JList jListFoundStructures = new JList(); protected JScrollPane foundStructuresScroller = new JScrollPane( jListFoundStructures); @@ -116,6 +117,16 @@ public abstract class GStructureChooser extends JPanel implements } }); + pdbFromFile.setFont(new java.awt.Font("Verdana", 0, 12)); + pdbFromFile.setText(" Select PDB File "); + pdbFromFile.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + pdbFromFile_actionPerformed(); + } + }); + jListFoundStructures .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); jListFoundStructures.setLayoutOrientation(JList.VERTICAL); @@ -128,30 +139,28 @@ public abstract class GStructureChooser extends JPanel implements actionPanel.add(ok); actionPanel.add(cancel); - filterOptions.addItemListener(this); + filterOptionsComboBox.addItemListener(this); filterPanel.add(resultLabel); - filterPanel.add(filterOptions); + filterPanel.add(filterOptionsComboBox); idInputPanel.setLayout(new FlowLayout()); idInputPanel.add(search); - selectFile.setText(" Select File "); fileChooserPanel.setLayout(new FlowLayout()); - fileChooserPanel.add(selectFile); + fileChooserPanel.add(pdbFromFile); - switchableViewsPanel.add(fileChooserPanel, VIEWS_FILE); - switchableViewsPanel.add(idInputPanel, VIEWS_ID); - switchableViewsPanel.add(foundStructuresScroller, VIEWS_AUTO); + switchableViewsPanel.add(fileChooserPanel, VIEWS_FROM_FILE); + switchableViewsPanel.add(idInputPanel, VIEWS_ENTER_ID); + switchableViewsPanel.add(foundStructuresScroller, VIEWS_FILTER); this.setLayout(mainLayout); this.add(filterPanel, java.awt.BorderLayout.NORTH); this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER); this.add(actionPanel, java.awt.BorderLayout.SOUTH); - populateFilterOptions(); - updateCurrentView(); + mainFrame.setVisible(true); mainFrame.setContentPane(this); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); @@ -161,12 +170,67 @@ public abstract class GStructureChooser extends JPanel implements @Override public void itemStateChanged(ItemEvent e) { - updateCurrentView(); + stateChanged(); + } + + public class FilterOptions + { + private String name; + + private String value; + + private String view; + + public FilterOptions(String name, String value, String view) + { + this.name = name; + this.value = value; + this.view = view; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getValue() + { + return value; + } + + public void setValue(String value) + { + this.value = value; + } + + public String getView() + { + return view; + } + + public void setView(String view) + { + this.view = view; + } + + public String toString() + { + return this.name; + } } + protected abstract void stateChanged(); + protected abstract void updateCurrentView(); protected abstract void ok_ActionPerformed(); protected abstract void populateFilterOptions(); + + protected abstract void pdbFromFile_actionPerformed(); }