Polymorphism;comment(POLYMORPHISM);String;g7;50;1000;95;false;false
RNA editing;comment(RNA EDITING);String;g7;50;1000;95;false;false
Sequence caution;comment(SEQUENCE CAUTION);String;g7;50;1000;95;false;false
+Status;reviewed;String;g6;50;100;95;true;true
Length;length;int;g7;50;100;65;true;true
Mass;mass;String;g7;50;100;80;false;true
Sequence;sequence;String;g7;50;1000;95;false;true
Miscellaneous [CC];comment(GENERAL);String;g6;50;1000;95;false;false
Keywords;keywords;String;g6;50;1000;95;false;true
Protein existence;existence;String;g6;50;1000;95;false;true
-Status;reviewed;String;g6;50;100;95;true;true
ALL;Search All;String;g7;50;1000;95;false;true;
Subunit structure [CC];comment(SUBUNIT);String;g9;50;1000;95;false;false
Interacts with;interactor;String;g9;50;1000;95;false;true
label.invalid_font = Invalid Font
label.separate_multiple_accession_ids = Enter one or more accession IDs separated by a semi-colon ";"
label.separate_multiple_query_values = Enter one or more {0}s separated by a semi-colon ";"
-label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This Searches the entire PDB database)
+label.search_all = Enter one or more search values separated by a semi-colon ";" (Note: This Searches the entire database)
label.replace_commas_semicolons = Replace commas with semi-colons
label.parsing_failed_syntax_errors_shown_below_param = Parsing failed. Syntax errors shown below {0}
label.parsing_failed_unrecoverable_exception_thrown_param = \nParsing failed. An unrecoverable exception was thrown\:\n {0}
label.run_groovy = Run Groovy console script
label.run_groovy_tip = Run the script in the Groovy console over this alignment
label.couldnt_run_groovy_script = Failed to run Groovy script
-label.uniprot_sequence_fetcher = UniProt Sequence Fetcher
\ No newline at end of file
+label.uniprot_sequence_fetcher = UniProt Sequence Fetcher
+action.next_page= >>
+action.prev_page= <<
\ No newline at end of file
* @param isSearchInProgress
*/
public void setSearchInProgress(Boolean isSearchInProgress);
+
+ public void prevPageAction();
+
+ public void nextPageAction();
+
+ public boolean isPaginationEnabled();
}
@Override
public int getDefaultResponsePageSize()
{
+ if (dataColumns == null || dataColumns.isEmpty())
+ {
+ parseDataColumnsConfigFile();
+ }
return defaultResponsePageSize;
}
private int responseSize;
+ private int offSet;
+
private boolean isSortAscending;
private Collection<FTSDataColumnI> wantedFields;
{
this.facetPivotMinCount = facetPivotMinCount;
}
+
+ public int getOffSet()
+ {
+ return offSet;
+ }
+
+ public void setOffSet(int offSet)
+ {
+ this.offSet = offSet;
+ }
}
public static void configureTableColumn(JTable tbl_summary,
Collection<FTSDataColumnI> wantedFields)
{
- try
- {
- // wait for table model initialisation to complete
- Thread.sleep(1200);
- } catch (InterruptedException e1)
- {
- e1.printStackTrace();
- }
for (FTSDataColumnI wantedField : wantedFields)
{
try
private String lastSearchTerm = "";
+ protected JButton btn_next_page = new JButton();
+
+ protected JButton btn_prev_page = new JButton();
+
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
}
});
+ btn_next_page.setEnabled(false);
+ btn_next_page.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_next_page.setText(MessageManager.getString("action.next_page"));
+ btn_next_page.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ nextPageAction();
+ }
+ });
+ btn_next_page.addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyPressed(KeyEvent evt)
+ {
+ if (evt.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ nextPageAction();
+ }
+ }
+ });
+
+ btn_prev_page.setEnabled(false);
+ btn_prev_page.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_prev_page.setText(MessageManager.getString("action.prev_page"));
+ btn_prev_page.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ prevPageAction();
+ }
+ });
+ btn_prev_page.addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyPressed(KeyEvent evt)
+ {
+ if (evt.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ prevPageAction();
+ }
+ }
+ });
+
+ if (isPaginationEnabled())
+ {
+ btn_prev_page.setVisible(true);
+ btn_next_page.setVisible(true);
+ }
+ else
+ {
+ btn_prev_page.setVisible(false);
+ btn_next_page.setVisible(false);
+ }
+
btn_cancel.setFont(new java.awt.Font("Verdana", 0, 12));
btn_cancel.setText(MessageManager.getString("action.cancel"));
btn_cancel.addActionListener(new java.awt.event.ActionListener()
});
final DeferredTextInputListener listener = new DeferredTextInputListener(
- 1500,
+ 2500,
new ActionListener()
{
@Override
pnl_inputs.add(txt_search);
pnl_inputs.add(lbl_loading);
pnl_inputs.add(lbl_warning);
+ pnl_inputs.add(btn_prev_page);
+ pnl_inputs.add(btn_next_page);
this.setLayout(mainLayout);
this.add(pnl_inputs, java.awt.BorderLayout.NORTH);
}
+ @Override
+ public void prevPageAction()
+ {
+ // TODO pagination not yet implemented for PDB FTS
+
+ }
+
+ @Override
+ public void nextPageAction()
+ {
+ // TODO pagination not yet implemented for PDB FTS
+
+ }
+
+ @Override
+ public boolean isPaginationEnabled()
+ {
+ return false;
+ }
+
}
int responseSize = (uniportRestRequest.getResponseSize() == 0) ? getDefaultResponsePageSize()
: uniportRestRequest.getResponseSize();
+ int offSet = (uniportRestRequest.getOffSet() == 0) ? getDefaultResponsePageSize()
+ : uniportRestRequest.getOffSet();
+
String query = uniportRestRequest.getFieldToSearchBy()
.equalsIgnoreCase("Search All") ? uniportRestRequest
.getSearchTerm()
.queryParam("format", "tab")
.queryParam("columns", wantedFields)
.queryParam("limit", String.valueOf(responseSize))
+ .queryParam("offset", String.valueOf(offSet))
.queryParam("sort", "score")
.queryParam("query", query);
// Execute the REST request
private String ftsFrameTitle = defaultFTSFrameTitle;
+ private int resultSetCount;
+
+ private int offSet;
+
+ private static int pageLimit = UniProtFTSRestClient.getInstance()
+ .getDefaultResponsePageSize();
+
public UniprotFTSPanel(SequenceFetcher seqFetcher)
{
this.seqFetcher = seqFetcher;
@Override
public void searchAction()
{
+ offSet = 0;
+ executeSearch();
+ }
+
+ public void executeSearch()
+ {
new Thread()
{
@Override
FTSRestRequest request = new FTSRestRequest();
request.setFieldToSearchBy(searchTarget);
request.setSearchTerm(searchTerm);
+ request.setOffSet(offSet);
request.setWantedFields(wantedFields);
FTSRestClientI uniProtRestCleint = UniProtFTSRestClient
.getInstance();
{
getResultTable().setModel(
FTSRestResponse.getTableModel(request,
- resultList.getSearchSummary()));
+ resultList.getSearchSummary()));
FTSRestResponse.configureTableColumn(getResultTable(),
wantedFields);
getResultTable().setVisible(true);
}
long endTime = System.currentTimeMillis();
- int resultSetCount = resultList.getNumberOfItemsFound();
+ resultSetCount = resultList.getNumberOfItemsFound();
String result = (resultSetCount > 1) ? MessageManager
.getString("label.results") : MessageManager
.getString("label.result");
- updateSearchFrameTitle(defaultFTSFrameTitle + " - "
- + resultSetCount + " " + result + " ("
- + (endTime - startTime) + " milli secs)");
+ if (isPaginationEnabled() && resultSetCount > 1)
+ {
+ updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result
+ + " " + offSet + " to " + (offSet + resultSetCount)
+ + " " + " (" + (endTime - startTime) + " milli secs)");
+ }
+ else
+ {
+ updateSearchFrameTitle(defaultFTSFrameTitle + " - "
+ + resultSetCount + " " + result + " ("
+ + (endTime - startTime) + " milli secs)");
+ }
setSearchInProgress(false);
+ refreshPaginatorState();
}
}
}.start();
}
+
+
+ public void refreshPaginatorState()
+ {
+ // System.out.println("resultSet count : " + resultSetCount);
+ // System.out.println("offSet : " + offSet);
+ // System.out.println("page limit : " + pageLimit);
+ btn_prev_page.setEnabled(false);
+ btn_next_page.setEnabled(false);
+ if (resultSetCount >= pageLimit)
+ {
+ btn_next_page.setEnabled(true);
+ }
+ if (offSet >= pageLimit)
+ {
+ btn_prev_page.setEnabled(true);
+ }
+ }
+
+ @Override
+ public void prevPageAction()
+ {
+ if (offSet >= pageLimit)
+ {
+ offSet = offSet - pageLimit;
+ executeSearch();
+ }else{
+ refreshPaginatorState();
+ }
+ }
+
+ @Override
+ public void nextPageAction()
+ {
+ offSet = offSet + pageLimit;
+ executeSearch();
+
+ }
+
+ @Override
+ public boolean isPaginationEnabled()
+ {
+ return true;
+ }
+
@Override
public void okAction()
{