From 9e31b7ef69779d6d6a162b92900ee639d0f6cd95 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 4 Aug 2015 11:25:15 +0100 Subject: [PATCH] updated the reference sequence column of cached structure summary table to hold the actual object --- src/jalview/gui/StructureChooser.java | 30 ++++++++++++++++++++++++------ src/jalview/jbgui/GStructureChooser.java | 1 + 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 3db26f3..f456817 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -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 selectedSeqsToView = new ArrayList(); 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) { diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 9c016f9..d335188 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -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) -- 1.7.10.2