X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=ce719d0d0fceba41cd7e4bb69f58eccff84015b1;hb=614b72c437f14dd2ddd72ae918dada3fd5d64468;hp=f2244d5aab22d9f2cad69a3f01f62707c922fb91;hpb=cf746641bf5f17b1eabf6a8c16b9bb03aee6eccb;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index f2244d5..ce719d0 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -59,9 +59,7 @@ import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Random; -import java.util.Set; import java.util.Vector; import javax.swing.JCheckBoxMenuItem; @@ -196,7 +194,7 @@ public class ChimeraViewFrame extends StructureViewerBase public ChimeraViewFrame(PDBEntry pdbentry, SequenceI[] seq, String[] chains, final AlignmentPanel ap) { - super(); + this(); String pdbId = pdbentry.getId(); /* @@ -249,6 +247,7 @@ public class ChimeraViewFrame extends StructureViewerBase SequenceI[][] seqs) { createProgressBar(); + // FIXME extractChains needs pdbentries to match IDs to PDBEntry(s) on seqs String[][] chains = extractChains(seqs); jmb = new JalviewChimeraBindingModel(this, ap.getStructureSelectionManager(), pdbentrys, seqs, chains, @@ -303,6 +302,9 @@ public class ChimeraViewFrame extends StructureViewerBase .getAllPDBEntries(); if (pdbrefs != null && pdbrefs.size() > 0) { + // FIXME: SequenceI.PDBEntry[0] chain mapping used for + // ChimeraViewFrame. Is this even used ??? + chain = pdbrefs.get(0).getChainCode(); } } @@ -329,7 +331,7 @@ public class ChimeraViewFrame extends StructureViewerBase SequenceI[][] seqsArray, boolean colourByChimera, boolean colourBySequence, String newViewId) { - super(); + this(); setViewId(newViewId); this.chimeraSessionFile = chimeraSessionFile; openNewChimera(alignPanel, pdbArray, seqsArray); @@ -358,31 +360,22 @@ public class ChimeraViewFrame extends StructureViewerBase public ChimeraViewFrame(PDBEntry[] pe, SequenceI[][] seqs, AlignmentPanel ap) { - super(); + this(); openNewChimera(ap, pe, seqs); } - public ChimeraViewFrame(Map> toView, - AlignmentPanel alignPanel) + /** + * Default constructor + */ + public ChimeraViewFrame() { super(); /* - * Convert the map of sequences per pdb entry into the tied arrays expected - * by openNewChimera - * - * TODO pass the Map down to openNewChimera and its callees instead + * closeViewer will decide whether or not to close this frame + * depending on whether user chooses to Cancel or not */ - final Set pdbEntries = toView.keySet(); - PDBEntry[] pdbs = pdbEntries.toArray(new PDBEntry[pdbEntries.size()]); - SequenceI[][] seqsForPdbs = new SequenceI[pdbEntries.size()][]; - for (int i = 0; i < pdbs.length; i++) - { - final List seqsForPdb = toView.get(pdbs[i]); - seqsForPdbs[i] = seqsForPdb.toArray(new SequenceI[seqsForPdb.size()]); - } - - openNewChimera(alignPanel, pdbs, seqsForPdbs); + setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); } /** @@ -539,7 +532,15 @@ public class ChimeraViewFrame extends StructureViewerBase prompt = JvSwingUtils.wrapTooltip(true, prompt); int confirm = JOptionPane.showConfirmDialog(this, prompt, MessageManager.getString("label.close_viewer"), - JOptionPane.YES_NO_OPTION); + JOptionPane.YES_NO_CANCEL_OPTION); + /* + * abort closure if user hits escape or Cancel + */ + if (confirm == JOptionPane.CANCEL_OPTION + || confirm == JOptionPane.CLOSED_OPTION) + { + return; + } closeChimera = confirm == JOptionPane.YES_OPTION; } jmb.closeViewer(closeChimera); @@ -551,6 +552,7 @@ public class ChimeraViewFrame extends StructureViewerBase // TODO: check for memory leaks where instance isn't finalised because jmb // holds a reference to the window jmb = null; + dispose(); } /** @@ -656,7 +658,8 @@ public class ChimeraViewFrame extends StructureViewerBase { int pos = filePDBpos.get(num).intValue(); long startTime = startProgressBar("Chimera " - + MessageManager.getString("status.opening_file")); + + MessageManager.getString("status.opening_file_for") + + " " + pe.getId()); jmb.openFile(pe); jmb.addSequence(pos, jmb.getSequence()[pos]); File fl = new File(pe.getFile()); @@ -728,6 +731,7 @@ public class ChimeraViewFrame extends StructureViewerBase */ private String fetchPdbFile(PDBEntry processingEntry) throws Exception { + // FIXME: this is duplicated code with Jmol frame ? String filePath = null; Pdb pdbclient = new Pdb(); AlignmentI pdbseq = null;