X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FPDBDocFieldPreferences.java;h=4ec649afe12f91d462782f12ec81e50c436fbd3f;hb=5713273d984e4de3b840ae7295ca8b151d8743cc;hp=2021d0b6a27db5cbca15bcfcd41e0e464e514e0a;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/src/jalview/jbgui/PDBDocFieldPreferences.java b/src/jalview/jbgui/PDBDocFieldPreferences.java index 2021d0b..4ec649a 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 { @@ -51,15 +51,15 @@ public class PDBDocFieldPreferences extends JScrollPane { case SEARCH_SUMMARY: columnNames = new String[] - { "PDB Feild", "Show in search summary" }; + { "PDB Field", "Show in search summary" }; break; case STRUCTURE_CHOOSER: columnNames = new String[] - { "PDB Feild", "Show in structure summary" }; + { "PDB Field", "Show in structure summary" }; break; case PREFERENCES: columnNames = new String[] - { "PDB Feild", "Show in search summary", "Show in structure summary" }; + { "PDB Field", "Show in search summary", "Show in structure summary" }; break; default: break; @@ -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. */