X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Funiprot%2FUniprotFTSPanel.java;h=748088d4c84332665d7d225c6f71d63c21611914;hb=e3dcbe461d12e68b97cd81d599dc52d2e042dd28;hp=88442de1877d06e88ea91797b8e45e5e674df590;hpb=7b10124f09af29607ea0150726ad5d63da09fdaf;p=jalview.git diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index 88442de..748088d 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -40,8 +40,7 @@ public class UniprotFTSPanel extends GFTSPanel private static String defaultFTSFrameTitle = MessageManager .getString("label.uniprot_sequence_fetcher"); - - private static Map tempUserPrefs = new HashMap(); + private static Map tempUserPrefs = new HashMap<>(); private static final String UNIPROT_FTS_CACHE_KEY = "CACHE.UNIPROT_FTS"; @@ -51,14 +50,14 @@ public class UniprotFTSPanel extends GFTSPanel pageLimit = UniProtFTSRestClient.getInstance() .getDefaultResponsePageSize(); this.seqFetcher = seqFetcher; - this.progressIndicator = (seqFetcher == null) ? null : seqFetcher - .getProgressIndicator(); - initCache(); + this.progressIndicator = (seqFetcher == null) ? null + : seqFetcher.getProgressIndicator(); } @Override public void searchAction(boolean isFreshSearch) { + mainFrame.requestFocusInWindow(); if (isFreshSearch) { offSet = 0; @@ -74,14 +73,12 @@ public class UniprotFTSPanel extends GFTSPanel { setSearchInProgress(true); long startTime = System.currentTimeMillis(); - + searchInput = getTypedText(); String searchTarget = ((FTSDataColumnI) cmb_searchTarget .getSelectedItem()).getAltCode(); - wantedFields = UniProtFTSRestClient.getInstance() .getAllDefaultDisplayedFTSDataColumns(); - String searchTerm = decodeSearchTerm(getTypedText(), - searchTarget); + String searchTerm = decodeSearchTerm(searchInput, searchTarget); FTSRestRequest request = new FTSRestRequest(); request.setFieldToSearchBy(searchTarget); @@ -99,15 +96,15 @@ public class UniprotFTSPanel extends GFTSPanel e.printStackTrace(); setErrorMessage(e.getMessage()); checkForErrors(); + setSearchInProgress(false); return; } if (resultList.getSearchSummary() != null && resultList.getSearchSummary().size() > 0) { - getResultTable().setModel( - FTSRestResponse.getTableModel(request, - resultList.getSearchSummary())); + getResultTable().setModel(FTSRestResponse.getTableModel(request, + resultList.getSearchSummary())); FTSRestResponse.configureTableColumn(getResultTable(), wantedFields, tempUserPrefs); getResultTable().setVisible(true); @@ -117,14 +114,12 @@ public class UniprotFTSPanel extends GFTSPanel totalResultSetCount = resultList.getNumberOfItemsFound(); resultSetCount = resultList.getSearchSummary() == null ? 0 : resultList.getSearchSummary().size(); - String result = (resultSetCount > 0) ? MessageManager - .getString("label.results") : MessageManager - .getString("label.result"); + 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 " @@ -132,8 +127,8 @@ public class UniprotFTSPanel extends GFTSPanel .format((Number) (offSet + resultSetCount)) + " of " + totalNumberformatter - .format((Number) totalResultSetCount) + " " - + " (" + (endTime - startTime) + " milli secs)"); + .format((Number) totalResultSetCount) + + " " + " (" + (endTime - startTime) + " milli secs)"); } else { @@ -145,7 +140,7 @@ public class UniprotFTSPanel extends GFTSPanel refreshPaginatorState(); updateSummaryTableSelections(); } - updateCache(); + txt_search.updateCache(); } }.start(); @@ -189,12 +184,12 @@ public class UniprotFTSPanel extends GFTSPanel { disableActionButtons(); StringBuilder selectedIds = new StringBuilder(); - HashSet selectedIdsSet = new HashSet(); + HashSet selectedIdsSet = new HashSet<>(); int primaryKeyColIndex = 0; try { - primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex( - wantedFields, false); + primaryKeyColIndex = getFTSRestClient() + .getPrimaryKeyColumIndex(wantedFields, false); } catch (Exception e) { e.printStackTrace(); @@ -202,8 +197,8 @@ public class UniprotFTSPanel extends GFTSPanel int[] selectedRows = getResultTable().getSelectedRows(); for (int summaryRow : selectedRows) { - String idStr = getResultTable().getValueAt(summaryRow, - primaryKeyColIndex).toString(); + String idStr = getResultTable() + .getValueAt(summaryRow, primaryKeyColIndex).toString(); selectedIdsSet.add(idStr); } selectedIdsSet.addAll(paginatorCart);