From: Charles Ofoegbu Date: Mon, 2 Mar 2015 17:33:27 +0000 (+0000) Subject: house keeping X-Git-Tag: Jalview_2_9~71^2~12 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=f09bee67bc24f1e401b4834f8ecb14812620568c house keeping --- diff --git a/src/jalview/gui/EBIFetchPanel.java b/src/jalview/gui/EBIFetchPanel.java index 8c2ef29..7fe9f2e 100644 --- a/src/jalview/gui/EBIFetchPanel.java +++ b/src/jalview/gui/EBIFetchPanel.java @@ -12,6 +12,18 @@ import javax.swing.SwingUtilities; @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() @@ -51,9 +63,10 @@ public class EBIFetchPanel extends GEBIFetchPanel @Override public void okActionPerformed() { - System.out.println("ok! pressed!"); + processPDBResponseData(); } + @Override public void backActionPerformed() { @@ -66,4 +79,43 @@ public class EBIFetchPanel extends GEBIFetchPanel 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()); + // } + } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index fb94c05..2f4ace3 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -115,7 +115,7 @@ public class SequenceFetcher extends JPanel implements Runnable private static Thread initingThread = null; - int x = 0; + int debounceTrap = 0; /** * Blocking method that initialises and returns the shared instance of the * SequenceFetcher client @@ -357,17 +357,16 @@ public class SequenceFetcher extends JPanel implements Runnable @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(); } } @@ -388,10 +387,13 @@ public class SequenceFetcher extends JPanel implements Runnable } - private void hideX() + private void pdbSourceAction() { - this.setVisible(false); + databaseButt.setText(database.getSelectedItem()); + new EBIFetchPanel(this); + frame.dispose(); } + private void otherSourceAction() { try diff --git a/src/jalview/jbgui/GEBIFetchPanel.java b/src/jalview/jbgui/GEBIFetchPanel.java index 74091af..e00830b 100644 --- a/src/jalview/jbgui/GEBIFetchPanel.java +++ b/src/jalview/jbgui/GEBIFetchPanel.java @@ -53,6 +53,7 @@ public abstract class GEBIFetchPanel extends JPanel private BorderLayout mainLayout = new BorderLayout(); + public GEBIFetchPanel() { try diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java index a7b311b..d490df8 100755 --- a/src/jalview/util/Format.java +++ b/src/jalview/util/Format.java @@ -622,7 +622,7 @@ public class Format /** * Formats a character into a string (like sprintf in C) * - * @param x + * @param debounceTrap * the value to format * @return the formatted string */ @@ -641,7 +641,7 @@ public class Format /** * Formats a string into a larger string (like sprintf in C) * - * @param x + * @param debounceTrap * the value to format * @return the formatted string */ diff --git a/src/jalview/ws/dbsources/PDBRestClient.java b/src/jalview/ws/dbsources/PDBRestClient.java index c26c88f..0c41d61 100644 --- a/src/jalview/ws/dbsources/PDBRestClient.java +++ b/src/jalview/ws/dbsources/PDBRestClient.java @@ -39,6 +39,7 @@ public class PDBRestClient 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); diff --git a/src/jalview/ws/uimodel/PDBSummaryListModel.java b/src/jalview/ws/uimodel/PDBSummaryListModel.java index ef93aed..37c0855 100644 --- a/src/jalview/ws/uimodel/PDBSummaryListModel.java +++ b/src/jalview/ws/uimodel/PDBSummaryListModel.java @@ -13,16 +13,14 @@ public class PDBSummaryListModel extends DefaultListModel 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) { @@ -95,6 +93,16 @@ public class PDBSummaryListModel extends DefaultListModel this.summary = summary; } + public JSONObject getRawJson() + { + return rawJson; + } + + public void setRawJson(JSONObject rawJson) + { + this.rawJson = rawJson; + } + public String toString() { StringBuilder html = new StringBuilder(); @@ -104,5 +112,4 @@ public class PDBSummaryListModel extends DefaultListModel html.append(""); return html.toString(); } - }