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;
- protected JComboBox filterOptions = new JComboBox();
+ protected JComboBox<FilterOptions> filterOptionsComboBox = new JComboBox<FilterOptions>();
protected AlignmentPanel ap;
protected JButton cancel = new JButton();
- protected JButton selectFile = new JButton();
+ protected JButton pdbFromFile = new JButton();
protected JTextField search = new JTextField(16);
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<PDBResponseSummary> jListFoundStructures = new JList<PDBResponseSummary>();
protected JScrollPane foundStructuresScroller = new JScrollPane(
jListFoundStructures);
}
});
+ 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);
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);
@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();
}