X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fuimodel%2FPDBRestResponse.java;h=0a33672aa5d8cb124e650572c181dae6c704ff36;hb=a9252f4b00202399f793718bfb2bf4b3203c4c71;hp=fb227ee17bbd603f17c7a70971723e74f7a7d17b;hpb=49207bb4d5c7b380978923817742d095b3f685b3;p=jalview.git diff --git a/src/jalview/ws/uimodel/PDBRestResponse.java b/src/jalview/ws/uimodel/PDBRestResponse.java index fb227ee..0a33672 100644 --- a/src/jalview/ws/uimodel/PDBRestResponse.java +++ b/src/jalview/ws/uimodel/PDBRestResponse.java @@ -77,8 +77,8 @@ public class PDBRestResponse /** - * Convenience method to obtain a Table model for a given summary List and - * request + * Convenience method to obtain a Table model for a given summary List based + * on the request parameters * * @param request * the PDBRestRequest object which holds useful information for @@ -91,8 +91,14 @@ public class PDBRestResponse public static DefaultTableModel getTableModel(PDBRestRequest request, Collection summariesList) { - DefaultTableModel tableModel = new DefaultTableModel(); - + DefaultTableModel tableModel = new DefaultTableModel() + { + @Override + public boolean isCellEditable(int row, int column) + { + return false; + } + }; if (request.getAssociatedSequence() != null) { tableModel.addColumn("Sequence"); // Create sequence column header if @@ -109,14 +115,13 @@ public class PDBRestResponse tableModel.addRow(res.getSummaryData()); // Populate table rows with // summary list } + return tableModel; } /** * Model for a unique response summary * - * @author tcnofoegbu - * */ public class PDBResponseSummary { @@ -126,7 +131,7 @@ public class PDBRestResponse private String associatedSequence; - public PDBResponseSummary(JSONObject doc, PDBRestRequest request) + public PDBResponseSummary(JSONObject pdbJsonDoc, PDBRestRequest request) { Collection diplayFields = request.getWantedFields(); String associatedSeq = request.getAssociatedSequence(); @@ -135,18 +140,17 @@ public class PDBRestResponse .size() + 1 : diplayFields.size()]; if (associatedSeq != null) { - this.associatedSequence = (associatedSeq.length() > 18) ? associatedSeq - .substring(0, 18) : associatedSeq; + this.associatedSequence = associatedSeq; summaryRowData[0] = associatedSequence; colCounter = 1; } for (PDBDocField field : diplayFields) { - String fieldData = (doc.get(field.getCode()) == null) ? "" : doc + String fieldData = (pdbJsonDoc.get(field.getCode()) == null) ? "" + : pdbJsonDoc .get(field.getCode()).toString(); - if (field.equals(PDBDocField.PDB_ID) - && doc.get(PDBDocField.PDB_ID.getCode()) != null) + if (field.equals(PDBDocField.PDB_ID)) { this.pdbId = fieldData; summaryRowData[colCounter++] = this.pdbId; @@ -178,6 +182,9 @@ public class PDBRestResponse this.summaryRowData = summaryData; } + /** + * Returns a string representation of this object; + */ @Override public String toString() { @@ -189,12 +196,18 @@ public class PDBRestResponse return summaryFieldValues.toString(); } + /** + * Returns hash code value for this object + */ @Override public int hashCode() { return Objects.hash(this.pdbId, this.toString()); } + /** + * Indicates whether some object is equal to this one + */ @Override public boolean equals(Object that) {