updated the reference sequence column of cached structure summary table to hold...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 4 Aug 2015 10:25:15 +0000 (11:25 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 4 Aug 2015 10:25:15 +0000 (11:25 +0100)
src/jalview/gui/StructureChooser.java
src/jalview/jbgui/GStructureChooser.java

index 3db26f3..f456817 100644 (file)
@@ -207,8 +207,15 @@ public class StructureChooser extends GStructureChooser
 
   public void loadLocalCachedPDBEntries()
   {
-    DefaultTableModel tableModel = new DefaultTableModel();
-    tableModel.addColumn("Sequence");
+    DefaultTableModel tableModel = new DefaultTableModel()
+    {
+      @Override
+      public boolean isCellEditable(int row, int column)
+      {
+        return false;
+      }
+    };
+    tableModel.addColumn("Ref Sequence");
     tableModel.addColumn("PDB Id");
     tableModel.addColumn("Chain");
     tableModel.addColumn("Type");
@@ -224,8 +231,8 @@ public class StructureChooser extends GStructureChooser
 
           String chain = pdbEntry.getChainCode() == null ? "_" : pdbEntry
                   .getChainCode();
-          String[] pdbEntryRowData = new String[]
-          { seq.getDisplayId(false), pdbEntry.getId(),
+          Object[] pdbEntryRowData = new Object[]
+          { seq, pdbEntry.getId(),
  chain,
               pdbEntry.getType(),
               pdbEntry.getFile() };
@@ -710,14 +717,25 @@ public class StructureChooser extends GStructureChooser
       int[] selectedRows = tbl_local_pdb.getSelectedRows();
       PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
       int count = 0;
+      int pdbIdColIndex = tbl_local_pdb.getColumn(
+              PDBRestClient.PDBDocField.PDB_ID.getName()).getModelIndex();
+      int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
+              .getModelIndex();
+      ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
       for (int row : selectedRows)
       {
-        String entryKey = tbl_local_pdb.getValueAt(row, 1).toString()
+        String entryKey = tbl_local_pdb.getValueAt(row, pdbIdColIndex)
+                .toString()
                 .toLowerCase();
         pdbEntriesToView[count++] = cachedEntryMap.get(entryKey);
+        SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(row,
+                refSeqColIndex);
+        selectedSeqsToView.add(selectedSeq);
       }
+      SequenceI[] selectedSeqs = selectedSeqsToView
+              .toArray(new SequenceI[selectedSeqsToView.size()]);
       launchStructureViewer(ap.getStructureSelectionManager(),
-              pdbEntriesToView, ap, selectedSequences);
+              pdbEntriesToView, ap, selectedSeqs);
     }
     else if (currentView == VIEWS_ENTER_ID)
     {
index 9c016f9..d335188 100644 (file)
@@ -183,6 +183,7 @@ public abstract class GStructureChooser extends JPanel implements
     tbl_summary.setAutoCreateRowSorter(true);
     tbl_summary.getTableHeader().setReorderingAllowed(false);
     tbl_local_pdb.setAutoCreateRowSorter(true);
+    tbl_local_pdb.getTableHeader().setReorderingAllowed(false);
     tbl_local_pdb.addMouseListener(new MouseAdapter()
     {
       public void mouseClicked(MouseEvent e)