/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListCellRenderer;
+import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
protected String frameTitle = MessageManager
.getString("label.structure_chooser");
- protected JInternalFrame mainFrame = new JInternalFrame(frameTitle);
+ public JInternalFrame mainFrame = new JInternalFrame(frameTitle);
- protected JComboBox<FilterOption> cmb_filterOption = new JComboBox<>();
+ public JComboBox<FilterOption> cmb_filterOption = new JComboBox<>();
- protected AlignmentPanel ap;
+ public AlignmentPanel ap;
- protected StringBuilder errorWarning = new StringBuilder();
+ public StringBuilder errorWarning = new StringBuilder();
protected JButton btn_add;
protected JCheckBox chk_superpose = new JCheckBox(
MessageManager.getString("label.superpose_structures"));
- protected JTextField txt_search = new JTextField(14);
+ public JTextField txt_search = new JTextField(14);
protected JPanel pnl_switchableViews = new JPanel(new CardLayout());
protected CardLayout layout_switchableViews = (CardLayout) (pnl_switchableViews
.getLayout());
- protected JCheckBox chk_invertFilter = new JCheckBox(
+ public JCheckBox chk_invertFilter = new JCheckBox(
MessageManager.getString("label.invert"));
protected ImageIcon loadingImage = new ImageIcon(
protected ImageIcon warningImage = new ImageIcon(
getClass().getResource("/images/warning.gif"));
- protected JLabel lbl_loading = new JLabel(loadingImage);
+ public JLabel lbl_loading = new JLabel(loadingImage);
protected JLabel lbl_pdbManualFetchStatus = new JLabel(errorImage);
protected JLabel lbl_fromFileStatus = new JLabel(errorImage);
- protected AssociateSeqPanel idInputAssSeqPanel = new AssociateSeqPanel();
+ public AssociateSeqPanel idInputAssSeqPanel = new AssociateSeqPanel();
- protected AssociateSeqPanel fileChooserAssSeqPanel = new AssociateSeqPanel();
+ public AssociateSeqPanel fileChooserAssSeqPanel = new AssociateSeqPanel();
protected JComboBox<StructureViewer> targetView = new JComboBox<>();
- protected JTable tbl_local_pdb = new JTable();
+ public JTable tbl_local_pdb = new JTable();
protected JTabbedPane pnl_filter = new JTabbedPane();
- protected FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
+ public FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
PreferenceSource.STRUCTURE_CHOOSER,
PDBFTSRestClient.getInstance());
protected FTSDataColumnI[] previousWantedFields;
- protected static Map<String, Integer> tempUserPrefs = new HashMap<>();
+ public static Map<String, Integer> tempUserPrefs = new HashMap<>();
private JTable tbl_summary = new JTable()
{
mainFrame.pack();
} catch (Exception e)
{
+ System.out.println(e); // for JavaScript TypeError
e.printStackTrace();
}
}
+ // BH SwingJS optimization
+ // (a) 100-ms interruptable timer for text entry -- BH 1/10/2019
+ // (b) two-character minimum, at least for JavaScript.
+
+ private Timer timer;
+
+ protected void txt_search_ActionPerformedDelayed() {
+ if (timer != null) {
+ timer.stop();
+ }
+ timer = new Timer(300, new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ txt_search_ActionPerformed();
+ }
+ });
+ timer.setRepeats(false);
+ timer.start();
+ }
+ //
+
/**
* Initializes the GUI default properties
*
@Override
public void insertUpdate(DocumentEvent e)
{
- txt_search_ActionPerformed();
+ txt_search_ActionPerformedDelayed();
}
@Override
public void removeUpdate(DocumentEvent e)
{
- txt_search_ActionPerformed();
+ txt_search_ActionPerformedDelayed();
}
@Override
public void changedUpdate(DocumentEvent e)
{
- txt_search_ActionPerformed();
+ txt_search_ActionPerformedDelayed();
}
});
Desktop.addInternalFrame(mainFrame, frameTitle, width, height);
}
- protected void closeAction(int preferredHeight)
+
+ public void closeAction(int preferredHeight)
{
// System.out.println(">>>>>>>>>> closing internal frame!!!");
// System.out.println("width : " + mainFrame.getWidth());