--- /dev/null
+package jalview.ws.uimodel;
+
+import javax.swing.DefaultListModel;
+
+import org.json.simple.JSONObject;
+
+
+@SuppressWarnings(
+{ "serial", "rawtypes" })
+public class PDBSummaryListModel extends DefaultListModel
+{
+ private String pdbId;
+
+ private String summary;
+
+ private int width = 480;
+
+ public PDBSummaryListModel(String pdbId, String summary)
+ {
+ this.pdbId = pdbId;
+ this.summary = summary;
+ }
+
+ public PDBSummaryListModel(JSONObject doc)
+ {
+ StringBuilder summary = new StringBuilder();
+ if (doc.get("molecule_type") != null)
+ {
+ String moleculeType = doc.get("molecule_type").toString();
+ if (moleculeType.equalsIgnoreCase("protein"))
+ {
+ summary.append("<img src=\""
+ + getClass().getResource("/images/protein.png").toString()
+ + "\">");
+ }
+ if (moleculeType.equalsIgnoreCase("dna"))
+ {
+ summary.append("<img src=\""
+ + getClass().getResource("/images/dna.png").toString()
+ + "\">");
+ }
+ if (moleculeType.equalsIgnoreCase("rna"))
+ {
+ summary.append("<img src=\""
+ + getClass().getResource("/images/dna.png").toString()
+ + "\">");
+ }
+ if (moleculeType.equalsIgnoreCase("sugar"))
+ {
+ summary.append("<img src=\""
+ + getClass().getResource("/images/sugar.png").toString()
+ + "\">");
+ }
+ }
+ this.pdbId = doc.get("pdb_id").toString();
+ summary.append("PDB ID: ").append(pdbId);
+
+
+ if (doc.get("molecule_name") != null)
+ {
+ summary.append(" | Molecule Name: ").append(doc.get("molecule_name"));
+ }
+ if (doc.get("gene_name") != null)
+ {
+ summary.append(" | Gene Name: ").append(doc.get("gene_name"));
+ }
+ if (doc.get("genus") != null)
+ {
+ summary.append(" | Genus: ").append(doc.get("genus"));
+ }
+ if (doc.get("title") != null)
+ {
+ summary.append(" | Title: ").append(doc.get("title"));
+ }
+ this.summary = summary.toString();
+ }
+
+ public String getPdbId()
+ {
+ return pdbId;
+ }
+
+ public void setPdbId(String pdbId)
+ {
+ this.pdbId = pdbId;
+ }
+
+ public String getSummary()
+ {
+ return summary;
+ }
+
+ public void setSummary(String summary)
+ {
+ this.summary = summary;
+ }
+
+ public String toString()
+ {
+ StringBuilder html = new StringBuilder();
+ html.append("<html><div style=\"width:" + width
+ + "; word-wrap: break-word; border-bottom-style: dotted;\"> ");
+ html.append(summary);
+ html.append("</div></html>");
+ return html.toString();
+ }
+
+}