From 6aae80a714d6cf5c2d28d02f74fbbf5296a0b71a Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 25 Apr 2011 13:55:48 +0000 Subject: [PATCH] toggle of inclusion/exclusion of views for colouring was't working --- src/jalview/gui/AppJmol.java | 19 ++++++++++++++----- src/jalview/gui/ViewSelectionMenu.java | 7 ++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 48c5143..f71cd30 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -153,6 +153,15 @@ public class AppJmol extends GStructureViewer implements Runnable, { seqColour.setSelected(jmb.isColourBySequence()); jmolColour.setSelected(!jmb.isColourBySequence()); + if (_colourwith==null) + { + _colourwith=new Vector(); + } + if (_alignwith==null) + { + _alignwith=new Vector(); + } + seqColourBy = new ViewSelectionMenu("Colour by ..", this, _colourwith, new ItemListener() { @@ -351,13 +360,13 @@ public class AppJmol extends GStructureViewer implements Runnable, /** * list of alignment panels to use for superposition */ - ArrayList _alignwith = new ArrayList(); + Vector _alignwith = new Vector(); /** * list of alignment panels that are used for colouring structures by aligned * sequences */ - ArrayList _colourwith = new ArrayList(); + Vector _colourwith = new Vector(); /** * set the primary alignmentPanel reference and add another alignPanel to the @@ -924,13 +933,13 @@ public class AppJmol extends GStructureViewer implements Runnable, jmb.setColourBySequence(seqColour.isSelected()); if (_colourwith == null) { - _colourwith = new ArrayList(); + _colourwith = new Vector(); } if (jmb.isColourBySequence()) { if (!jmb.isLoadingFromArchive()) { - if (ap!=null) { + if (_colourwith.size()==0 && ap!=null) { // Make the currently displayed alignment panel the associated view _colourwith.add(ap.alignFrame.alignPanel); } @@ -1143,7 +1152,7 @@ public class AppJmol extends GStructureViewer implements Runnable, { if (_alignwith == null) { - _alignwith = new ArrayList(); + _alignwith = new Vector(); } if (_alignwith.size() == 0 && ap != null) { diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index d34804b..bca2988 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -201,14 +201,19 @@ public class ViewSelectionMenu extends JMenu { if (append) { - if (e.getStateChange() == e.SELECTED) + enabled=false; + // toggle the inclusion state + if (_selectedviews.indexOf(p)==-1) { _selectedviews.add(p); + a.setSelected(true); } else { _selectedviews.remove(p); + a.setSelected(false); } + enabled=true; _handler.itemStateChanged(e); } else -- 1.7.10.2