import jalview.gui.IProgressIndicator;
import jalview.gui.JvSwingUtils;
import jalview.gui.SequenceFetcher;
-import jalview.io.cache.AppCache;
-import jalview.io.cache.Cacheable;
+import jalview.io.cache.JvCacheableInputBox;
import jalview.util.MessageManager;
import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
-import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
*/
@SuppressWarnings("serial")
-public abstract class GFTSPanel extends JPanel implements GFTSPanelI, Cacheable
+public abstract class GFTSPanel extends JPanel implements GFTSPanelI
{
protected JInternalFrame mainFrame = new JInternalFrame(
getFTSFrameTitle());
protected JButton btn_cancel = new JButton();
- protected JComboBox<String> txt_search;
+ protected JvCacheableInputBox<String> txt_search;
protected SequenceFetcher seqFetcher;
private void jbInit() throws Exception
{
- txt_search = new JComboBox<String>();
- txt_search.setEditable(true);
- txt_search
- .setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
+ txt_search = new JvCacheableInputBox<String>(getCacheKey());
populateCmbSearchTargetOptions();
Integer width = getTempUserPrefs().get("FTSPanel.width") == null ? 800
: getTempUserPrefs().get("FTSPanel.width");
});
-
txt_search.setFont(new java.awt.Font("Verdana", 0, 12));
txt_search.getEditor().getEditorComponent()
}
}
});
-
final DeferredTextInputListener listener = new DeferredTextInputListener(
1500, new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- if (!getTypedText().equalsIgnoreCase(lastSearchTerm))
+ String typed = getTypedText();
+ if (!typed.equalsIgnoreCase(lastSearchTerm))
{
searchAction(true);
paginatorCart.clear();
- lastSearchTerm = getTypedText();
+ lastSearchTerm = typed;
}
}
}, false);
getTempUserPrefs().put("FTSPanel.x", mainFrame.getX());
getTempUserPrefs().put("FTSPanel.y", mainFrame.getY());
mainFrame.dispose();
+ txt_search.persistCache();
}
public class DeferredTextInputListener implements DocumentListener
@Override
public String getTypedText()
{
- return txt_search.getEditor().getItem() == null ? "" : txt_search
- .getEditor().getItem().toString().trim();
+ return txt_search.getUserInput();
}
@Override
{
lbl_blank.setVisible(!isSearchInProgress);
lbl_loading.setVisible(isSearchInProgress);
+ txt_search.setEditable(!isSearchInProgress);
}
@Override
}
- protected void fireCache()
- {
- AppCache.getInstance().updateCache(this);
- }
-
- @Override
- public void init()
- {
- // reset();
- }
-
- @Override
- public JComponent getNextFocusableElement()
- {
- return mainFrame;
- }
-
- @Override
- public String getCacheKey()
- {
- return getCacheKey();
- }
-
- @Override
- public JComboBox<String> getCacheComboBox()
- {
- return txt_search;
- }
-
-
}