From: Jim Procter Date: Mon, 15 Jun 2015 12:37:44 +0000 (+0100) Subject: Merge branch 'develop' into bug/JAL-1775 X-Git-Tag: Release_2_10_0~608^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c75ae0da287834282173560815959c4b4e7e6b2d;hp=f0658e24fa038198d566d8adfb75f0fd4915d3aa;p=jalview.git Merge branch 'develop' into bug/JAL-1775 --- diff --git a/src/jalview/api/ComplexAlignFile.java b/src/jalview/api/ComplexAlignFile.java index 0d731cd..133a739 100644 --- a/src/jalview/api/ComplexAlignFile.java +++ b/src/jalview/api/ComplexAlignFile.java @@ -4,14 +4,40 @@ import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; import jalview.schemes.ColourSchemeI; +/** + * This interface should be implemented by complex file parser with the ability + * to store linked data and complex view states in addition to Alignment data + * + * + */ public interface ComplexAlignFile { + /** + * Determines if Sequence features should be shown + * + * @return + */ public boolean isShowSeqFeatures(); + /** + * Obtains the colour scheme from a complex file parser + * + * @return + */ public ColourSchemeI getColourScheme(); + /** + * Retrieves the Column selection/hidden column from a complex file parser + * + * @return + */ public ColumnSelection getColumnSelection(); + /** + * Retrieves hidden sequences from a complex file parser + * + * @return + */ public SequenceI[] getHiddenSequences(); } diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index 5f38313..35cd3e5 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -20,17 +20,6 @@ */ package jalview.gui; -import jalview.bin.Cache; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.structure.SecondaryStructureListener; -import jalview.structure.SelectionListener; -import jalview.structure.SelectionSource; -import jalview.structure.StructureSelectionManager; -import jalview.structure.VamsasSource; -import jalview.util.ShiftList; - import java.awt.BorderLayout; import java.awt.Color; import java.util.ArrayList; @@ -41,10 +30,8 @@ import java.util.regex.Pattern; import javax.swing.JInternalFrame; import javax.swing.JSplitPane; - -import jalview.bin.Cache; -import jalview.util.MessageManager; -import jalview.util.ShiftList; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import fr.orsay.lri.varna.VARNAPanel; import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax; @@ -57,6 +44,18 @@ import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation; import fr.orsay.lri.varna.models.rna.ModeleBase; import fr.orsay.lri.varna.models.rna.RNA; +import jalview.bin.Cache; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.structure.SecondaryStructureListener; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.StructureSelectionManager; +import jalview.structure.VamsasSource; +import jalview.util.MessageManager; +import jalview.util.ShiftList; + public class AppVarna extends JInternalFrame implements InterfaceVARNAListener, SelectionListener, SecondaryStructureListener// implements @@ -134,6 +133,15 @@ public class AppVarna extends JInternalFrame implements // System.out.println(ssm.toString()); ssm.addStructureViewerListener(this); ssm.addSelectionListener(this); + addInternalFrameListener(new InternalFrameAdapter() + { + @Override + public void internalFrameClosed(InternalFrameEvent evt) + { + close(); + } + }); + } public void initVarna() @@ -447,4 +455,23 @@ public class AppVarna extends JInternalFrame implements } + /** + * Tidy up as necessary when the viewer panel is closed + */ + protected void close() + { + /* + * Deregister as a listener, to free references to this object + */ + if (ap != null) + { + StructureSelectionManager ssm = ap.getStructureSelectionManager(); + if (ssm != null) + { + ssm.removeStructureViewerListener(AppVarna.this, null); + ssm.removeSelectionListener(AppVarna.this); + } + } + } + } diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 3d52ee1..f3c4d87 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -237,21 +237,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer af.getViewport().setShowSequenceFeatures(showSeqFeatures); af.changeColour(cs); - // ((HtmlFile) source).applySettingsToAlignmentView(af); } - // else if (source instanceof JSONFile) - // { - // ColumnSelection colSel = ((JSONFile) source).getColumnSelection(); - // SequenceI[] hiddenSeqs = ((JSONFile) source).getHiddenSequences(); - // boolean showSeqFeatures = ((HtmlFile) source).isShowSeqFeatures(); - // ColourSchemeI cs = ((HtmlFile) source).getColourScheme(); - // af = new AlignFrame(al, hiddenSeqs, colSel, - // AlignFrame.DEFAULT_WIDTH, - // AlignFrame.DEFAULT_HEIGHT); - // af.getViewport().setShowSequenceFeatures(showSeqFeatures); - // af.changeColour(cs); - // // ((JSONFile) source).applySettingsToAlignmentView(af); - // } else { af = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index ff129a4..d2b8412 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -516,15 +516,12 @@ public class JSONFile extends AlignFile implements ComplexAlignFile public void parseHiddenCols(JSONObject jvSettingsJson) { - // hiddenColumns = new ArrayList(); String hiddenCols = (String) jvSettingsJson.get("hiddenCols"); if(hiddenCols != null && !hiddenCols.isEmpty()){ columnSelection = new ColumnSelection(); String[] rangeStrings = hiddenCols.split(";"); for(String rangeString : rangeStrings){ String[] range = rangeString.split("-"); - // hiddenColumns.add(new int[] - // { Integer.valueOf(range[0]), Integer.valueOf(range[1]) }); columnSelection.hideColumns(Integer.valueOf(range[0]), Integer.valueOf(range[1])); } @@ -547,9 +544,6 @@ public class JSONFile extends AlignFile implements ComplexAlignFile String descripiton = (String) jsonFeature.get("description"); String seqRef = (String) jsonFeature.get("sequenceRef"); Float score = Float.valueOf(jsonFeature.get("score").toString()); - // Hashtable otherDetails = (Hashtable) jsonFeature - // .get("otherDetails"); - // sequenceFeature.otherDetails = otherDetails; Sequence seq = seqMap.get(seqRef); SequenceFeature sequenceFeature = new SequenceFeature();