/**
- * 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
public static DefaultTableModel getTableModel(PDBRestRequest request,
Collection<PDBResponseSummary> 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
tableModel.addRow(res.getSummaryData()); // Populate table rows with
// summary list
}
+
return tableModel;
}
/**
* Model for a unique response summary
*
- * @author tcnofoegbu
- *
*/
public class PDBResponseSummary
{
private String associatedSequence;
- public PDBResponseSummary(JSONObject doc, PDBRestRequest request)
+ public PDBResponseSummary(JSONObject pdbJsonDoc, PDBRestRequest request)
{
Collection<PDBDocField> diplayFields = request.getWantedFields();
String associatedSeq = request.getAssociatedSequence();
.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;
this.summaryRowData = summaryData;
}
+ /**
+ * Returns a string representation of this object;
+ */
@Override
public String toString()
{
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)
{