import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import javax.swing.JScrollPane;
import javax.swing.JTable;
private HashMap<String, PDBDocField> map = new HashMap<String, PDBDocField>();
- private static Collection<PDBDocField> searchSummaryFields = new HashSet<PDBDocField>();
+ private static Collection<PDBDocField> searchSummaryFields = new LinkedHashSet<PDBDocField>();
- private static Collection<PDBDocField> structureSummaryFields = new HashSet<PDBDocField>();
+ private static Collection<PDBDocField> structureSummaryFields = new LinkedHashSet<PDBDocField>();
public enum PreferenceSource
{
{
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;
{
// 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.
*/