@SuppressWarnings("serial")
public class EBIFetchPanel extends GEBIFetchPanel
{
+ private SequenceFetcher seqFetcher;
+
+ public EBIFetchPanel()
+ {
+ }
+
+ public EBIFetchPanel(SequenceFetcher seqFetcher)
+ {
+ this();
+ this.seqFetcher = seqFetcher;
+ }
+
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
@Override
public void okActionPerformed()
{
- System.out.println("ok! pressed!");
+ processPDBResponseData();
}
+
@Override
public void backActionPerformed()
{
mainFrame.dispose();
}
+ private void processPDBResponseData()
+ {
+ mainFrame.dispose();
+ StringBuilder selectedIds = new StringBuilder();
+ for (PDBSummaryListModel dataSelected : jListSearchResult
+ .getSelectedValuesList())
+ {
+ selectedIds.append(";").append(dataSelected.getPdbId());
+ }
+ String ids = selectedIds.deleteCharAt(0).toString();
+ seqFetcher.textArea.setText(ids);
+ Thread worker = new Thread(seqFetcher);
+
+ // Thread worker = new Thread(this);
+ worker.start();
+ }
+
+ // @Override
+ // public void run()
+ // {
+ // for (PDBSummaryListModel sum : jListSearchResult
+ // .getSelectedValuesList())
+ // {
+ // System.out.println("you selected ------------> " + sum.getPdbId());
+ // }
+ // seqFetcher.guiWindow.setProgressBar(MessageManager
+ // .getString("status.processing"), Thread.currentThread()
+ // .hashCode());
+ // try
+ // {
+ // Thread.sleep(1000 * 2);
+ // } catch (InterruptedException e)
+ // {
+ // e.printStackTrace();
+ // }
+ // seqFetcher.guiWindow.setProgressBar(null, Thread.currentThread()
+ // .hashCode());
+ // }
+
}
private static Thread initingThread = null;
- int x = 0;
+ int debounceTrap = 0;
/**
* Blocking method that initialises and returns the shared instance of the
* SequenceFetcher client
@Override
public void actionPerformed(ActionEvent e)
{
- x++;
+ debounceTrap++;
String currentSelection = database.getSelectedItem();
if (!currentSelection.equalsIgnoreCase("pdb"))
{
otherSourceAction();
}
- if (currentSelection.equalsIgnoreCase("pdb") && ((x % 2) == 0))
+ if (currentSelection.equalsIgnoreCase("pdb") && ((debounceTrap % 2) == 0))
{
- frame.dispose();
- new EBIFetchPanel();
+ pdbSourceAction();
}
}
}
- private void hideX()
+ private void pdbSourceAction()
{
- this.setVisible(false);
+ databaseButt.setText(database.getSelectedItem());
+ new EBIFetchPanel(this);
+ frame.dispose();
}
+
private void otherSourceAction()
{
try
private BorderLayout mainLayout = new BorderLayout();
+
public GEBIFetchPanel()
{
try
/**
* Formats a character into a string (like sprintf in C)
*
- * @param x
+ * @param debounceTrap
* the value to format
* @return the formatted string
*/
/**
* Formats a string into a larger string (like sprintf in C)
*
- * @param x
+ * @param debounceTrap
* the value to format
* @return the formatted string
*/
Client client = Client.create(clientConfig);
WebResource webResource = client.resource(pdbSearchEndpoint)
.queryParam("wt", "json")
+.queryParam("rows", "100")
.queryParam("q", qParam + ":" + searchTerm);
ClientResponse clientResponse = webResource.accept(
MediaType.APPLICATION_JSON).get(ClientResponse.class);
private String summary;
+ private JSONObject rawJson;
+
private int width = 480;
- public PDBSummaryListModel(String pdbId, String summary)
- {
- this.pdbId = pdbId;
- this.summary = summary;
- }
public PDBSummaryListModel(JSONObject doc)
{
+ this.rawJson = doc;
StringBuilder summary = new StringBuilder();
if (doc.get("molecule_type") != null)
{
this.summary = summary;
}
+ public JSONObject getRawJson()
+ {
+ return rawJson;
+ }
+
+ public void setRawJson(JSONObject rawJson)
+ {
+ this.rawJson = rawJson;
+ }
+
public String toString()
{
StringBuilder html = new StringBuilder();
html.append("</div></html>");
return html.toString();
}
-
}