X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FPDBDocFieldPreferences.java;h=96e27e6f4f88490fe58c974c5eb3ac59dd42f9e8;hb=466c5639624028f92e214121672dc409ad10514b;hp=2021d0b6a27db5cbca15bcfcd41e0e464e514e0a;hpb=2adcb5e0e4901454a89b1aa37354f15f01b01ca1;p=jalview.git diff --git a/src/jalview/jbgui/PDBDocFieldPreferences.java b/src/jalview/jbgui/PDBDocFieldPreferences.java index 2021d0b..96e27e6 100644 --- a/src/jalview/jbgui/PDBDocFieldPreferences.java +++ b/src/jalview/jbgui/PDBDocFieldPreferences.java @@ -4,7 +4,7 @@ import jalview.ws.dbsources.PDBRestClient.PDBDocField; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashSet; import javax.swing.JScrollPane; import javax.swing.JTable; @@ -20,9 +20,9 @@ public class PDBDocFieldPreferences extends JScrollPane private HashMap map = new HashMap(); - private static Collection searchSummaryFields = new HashSet(); + private static Collection searchSummaryFields = new LinkedHashSet(); - private static Collection structureSummaryFields = new HashSet(); + private static Collection structureSummaryFields = new LinkedHashSet(); public enum PreferenceSource { @@ -171,10 +171,32 @@ public class PDBDocFieldPreferences extends JScrollPane { // Note that the data/cell address is constant, // no matter where the cell appears onscreen. - return col == 1 || col == 2; + // !isPDBID(row, col) ensures the PDB_Id cell is never editable as it + // serves as a unique id for each row. + return (col == 1 || col == 2) && !isPDBID(row, col); } + /** + * Determines whether the data in a given cell is a PDB ID. + * + * @param row + * @param col + * @return + */ + + public boolean isPDBID(int row, int col) + { + boolean matched = false; + String name = getValueAt(row, 0).toString(); + PDBDocField pdbField = map.get(name); + if (pdbField == PDBDocField.PDB_ID) + { + matched = true; + } + return matched; + } + /* * Don't need to implement this method unless your table's data can change. */