X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FViewSelectionMenu.java;h=26c52c991b5a303c321c66e28d85979118aa45c9;hb=48b925b3dd950c86b1add0f2a90a2d0f8b6e316e;hp=b3ac40560ae68e8012cc570627ee8e3468931411;hpb=e0edfabf5128547419e2fd192e98c74fd0f81faa;p=jalview.git diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index b3ac405..26c52c9 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -1,3 +1,20 @@ +/******************************************************************************* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + *******************************************************************************/ package jalview.gui; import java.awt.Component; @@ -20,6 +37,8 @@ import javax.swing.event.MenuListener; * dialog/menu which allows the user to select/deselect specific views from a * list of associated views. * + * Includes patches related to JAL-641 + * * @author JimP * */ @@ -119,9 +138,10 @@ public class ViewSelectionMenu extends JMenu } if (allviews.length >= 2) { - + // ensure we update menu state to reflect external selection list state + append = append || _selectedviews.size()>1; toggleview = new JCheckBoxMenuItem("Select many views",append); - toggleview.setToolTipText("When selected, toggles whether a particular view is used to colour the alignment."); + toggleview.setToolTipText("When enabled, allows many views to be selected."); toggleview.addItemListener(new ItemListener() { @Override @@ -199,14 +219,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