X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Funiprot%2FUniprotFTSPanel.java;h=4f9e6081edebb5573401a0859c6ef4e9797581d0;hb=eae7b74da9179b461f4b63c65f488f87b1d26757;hp=bff0d802d306a7a3c84b965097b05b1f2172af7f;hpb=221f613b5d235a11c602b989598afe97b5b7b203;p=jalview.git diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index bff0d80..4f9e608 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -40,24 +40,24 @@ 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"; - public UniprotFTSPanel(SequenceFetcher seqFetcher) + public UniprotFTSPanel(SequenceFetcher fetcher) { - super(); + super(fetcher); pageLimit = UniProtFTSRestClient.getInstance() .getDefaultResponsePageSize(); - this.seqFetcher = seqFetcher; - this.progressIndicator = (seqFetcher == null) ? null : seqFetcher - .getProgressIndicator(); + this.seqFetcher = fetcher; + this.progressIndicator = (fetcher == null) ? null + : fetcher.getProgressIndicator(); } @Override public void searchAction(boolean isFreshSearch) { + mainFrame.requestFocusInWindow(); if (isFreshSearch) { offSet = 0; @@ -85,26 +85,25 @@ public class UniprotFTSPanel extends GFTSPanel request.setSearchTerm(searchTerm); request.setOffSet(offSet); request.setWantedFields(wantedFields); - FTSRestClientI uniProtRestCleint = UniProtFTSRestClient + FTSRestClientI uniProtRestClient = UniProtFTSRestClient .getInstance(); FTSRestResponse resultList; try { - resultList = uniProtRestCleint.executeRequest(request); + resultList = uniProtRestClient.executeRequest(request); } catch (Exception e) { - 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); @@ -114,14 +113,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 " @@ -129,8 +126,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 { @@ -186,12 +183,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(); @@ -199,8 +196,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);