private FTSRestRequest lastPdbRequest;
- private FTSRestClientI pdbRestCleint;
+ private FTSRestClientI pdbRestClient;
private String selectedPdbFileName;
void fetchStructuresMetaData()
{
long startTime = System.currentTimeMillis();
- pdbRestCleint = PDBFTSRestClient.getInstance();
+ pdbRestClient = PDBFTSRestClient.getInstance();
Collection<FTSDataColumnI> wantedFields = pdbDocFieldPrefs
.getStructureSummaryFields();
FTSRestResponse resultList;
try
{
- resultList = pdbRestCleint.executeRequest(pdbRequest);
+ resultList = pdbRestClient.executeRequest(pdbRequest);
} catch (Exception e)
{
e.printStackTrace();
public void run()
{
long startTime = System.currentTimeMillis();
- pdbRestCleint = PDBFTSRestClient.getInstance();
+ pdbRestClient = PDBFTSRestClient.getInstance();
lbl_loading.setVisible(true);
Collection<FTSDataColumnI> wantedFields = pdbDocFieldPrefs
.getStructureSummaryFields();
FTSRestResponse resultList;
try
{
- resultList = pdbRestCleint.executeRequest(pdbRequest);
+ resultList = pdbRestClient.executeRequest(pdbRequest);
} catch (Exception e)
{
e.printStackTrace();
&& !discoveredStructuresSet.isEmpty();
}
+ protected int PDB_ID_MIN = 3;// or: (Jalview.isJS() ? 3 : 1); // Bob proposes this.
+ // Doing a search for "1" or "1c" is valuable?
+ // Those work but are enormously slow.
+
@Override
protected void txt_search_ActionPerformed()
{
+ String text = txt_search.getText().trim();
+ if (text.length() >= PDB_ID_MIN)
new Thread()
{
- @Override
+
+ @Override
public void run()
{
errorWarning.setLength(0);
isValidPBDEntry = false;
- if (txt_search.getText().length() > 0)
+ if (text.length() > 0)
{
- String searchTerm = txt_search.getText().toLowerCase();
+ String searchTerm = text.toLowerCase();
searchTerm = searchTerm.split(":")[0];
// System.out.println(">>>>> search term : " + searchTerm);
List<FTSDataColumnI> wantedFields = new ArrayList<>();
pdbRequest.setWantedFields(wantedFields);
pdbRequest.setSearchTerm(searchTerm + ")");
pdbRequest.setAssociatedSequence(selectedSequence);
- pdbRestCleint = PDBFTSRestClient.getInstance();
- wantedFields.add(pdbRestCleint.getPrimaryKeyColumn());
+ pdbRestClient = PDBFTSRestClient.getInstance();
+ wantedFields.add(pdbRestClient.getPrimaryKeyColumn());
FTSRestResponse resultList;
try
{
- resultList = pdbRestCleint.executeRequest(pdbRequest);
+ resultList = pdbRestClient.executeRequest(pdbRequest);
} catch (Exception e)
{
errorWarning.append(e.getMessage());
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 java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListCellRenderer;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
}
}
+ // 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)
+
+protected void closeAction(int preferredHeight)
{
// System.out.println(">>>>>>>>>> closing internal frame!!!");
// System.out.println("width : " + mainFrame.getWidth());