X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Fpdb%2FPDBFTSPanel.java;h=b944b9b7cf2add3be0b530007d90d397456c55ab;hb=136c0793b90b72b928c4d77dc109dd5c644e00d3;hp=dc2b403fe099ffb8b658dbf060a7a7b704761f1b;hpb=ba7cba06e47fd8f46aafb04c5f2b33718db4f320;p=jalview.git diff --git a/src/jalview/fts/service/pdb/PDBFTSPanel.java b/src/jalview/fts/service/pdb/PDBFTSPanel.java index dc2b403..b944b9b 100644 --- a/src/jalview/fts/service/pdb/PDBFTSPanel.java +++ b/src/jalview/fts/service/pdb/PDBFTSPanel.java @@ -39,23 +39,24 @@ public class PDBFTSPanel extends GFTSPanel private static String defaultFTSFrameTitle = MessageManager .getString("label.pdb_sequence_fetcher"); - private String ftsFrameTitle = defaultFTSFrameTitle; private static Map tempUserPrefs = new HashMap(); + private static final String PDB_FTS_CACHE_KEY = "CACHE.PDB_FTS"; + public PDBFTSPanel(SequenceFetcher seqFetcher) { super(); pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize(); this.seqFetcher = seqFetcher; - this.progressIdicator = (seqFetcher == null) ? null : seqFetcher + this.progressIndicator = (seqFetcher == null) ? null : seqFetcher .getProgressIndicator(); } - @Override public void searchAction(boolean isFreshSearch) { + mainFrame.requestFocusInWindow(); if (isFreshSearch) { offSet = 0; @@ -65,7 +66,6 @@ public class PDBFTSPanel extends GFTSPanel @Override public void run() { - ftsFrameTitle = defaultFTSFrameTitle; reset(); boolean allowEmptySequence = false; if (getTypedText().length() > 0) @@ -77,7 +77,7 @@ public class PDBFTSPanel extends GFTSPanel .getSelectedItem()).getCode(); wantedFields = PDBFTSRestClient.getInstance() .getAllDefaultDisplayedFTSDataColumns(); - String searchTerm = decodeSearchTerm(txt_search.getText(), + String searchTerm = decodeSearchTerm(getTypedText(), searchTarget); FTSRestRequest request = new FTSRestRequest(); @@ -104,7 +104,7 @@ public class PDBFTSPanel extends GFTSPanel { getResultTable().setModel( FTSRestResponse.getTableModel(request, - resultList.getSearchSummary())); + resultList.getSearchSummary())); FTSRestResponse.configureTableColumn(getResultTable(), wantedFields, tempUserPrefs); getResultTable().setVisible(true); @@ -117,10 +117,12 @@ public class PDBFTSPanel extends GFTSPanel String result = (resultSetCount > 0) ? MessageManager .getString("label.results") : MessageManager .getString("label.result"); - + if (isPaginationEnabled() && resultSetCount > 0) { - updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result + updateSearchFrameTitle(defaultFTSFrameTitle + + " - " + + result + " " + totalNumberformatter.format((Number) (offSet + 1)) + " to " @@ -128,8 +130,8 @@ public class PDBFTSPanel extends GFTSPanel .format((Number) (offSet + resultSetCount)) + " of " + totalNumberformatter - .format((Number) totalResultSetCount) - + " " + " (" + (endTime - startTime) + " milli secs)"); + .format((Number) totalResultSetCount) + " " + + " (" + (endTime - startTime) + " milli secs)"); } else { @@ -137,11 +139,12 @@ public class PDBFTSPanel extends GFTSPanel + resultSetCount + " " + result + " (" + (endTime - startTime) + " milli secs)"); } - + setSearchInProgress(false); refreshPaginatorState(); updateSummaryTableSelections(); } + txt_search.updateCache(); } }.start(); } @@ -193,19 +196,17 @@ public class PDBFTSPanel extends GFTSPanel try { primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex( - wantedFields, - false); + wantedFields, false); } catch (Exception e) { e.printStackTrace(); } int[] selectedRows = getResultTable().getSelectedRows(); - String searchTerm = txt_search.getText(); + String searchTerm = getTypedText(); for (int summaryRow : selectedRows) { String idStr = getResultTable().getValueAt(summaryRow, - primaryKeyColIndex) - .toString(); + primaryKeyColIndex).toString(); selectedIdsSet.add(getPDBIdwithSpecifiedChain(idStr, searchTerm)); } @@ -227,7 +228,6 @@ public class PDBFTSPanel extends GFTSPanel delayAndEnableActionButtons(); } - public static String getPDBIdwithSpecifiedChain(String pdbId, String searchTerm) { @@ -263,7 +263,7 @@ public class PDBFTSPanel extends GFTSPanel @Override public String getFTSFrameTitle() { - return ftsFrameTitle; + return defaultFTSFrameTitle; } @Override @@ -278,4 +278,12 @@ public class PDBFTSPanel extends GFTSPanel return tempUserPrefs; } + + @Override + public String getCacheKey() + { + return PDB_FTS_CACHE_KEY; + } + + }