X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FViewSelectionMenu.java;h=cdbb4fa8f1e9d828cd38878c624d10b3ea712daf;hb=833fafa77f2f63bea98ce1d6e1e4ee3e46e7bd53;hp=b90f742699c0a3819bb0e7605eaa05b493c52ea6;hpb=b2f9a8d7bce642ff4011bc6d49e02bb0569fbb11;p=jalview.git
diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java
index b90f742..cdbb4fa 100644
--- a/src/jalview/gui/ViewSelectionMenu.java
+++ b/src/jalview/gui/ViewSelectionMenu.java
@@ -1,19 +1,21 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* 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.
+ * 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
@@ -25,8 +27,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.util.List;
import javax.swing.JCheckBoxMenuItem;
@@ -148,9 +150,10 @@ public class ViewSelectionMenu extends JMenu
{
// 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(MessageManager.getString("label.toggle_enabled_views"));
+ toggleview = new JCheckBoxMenuItem(
+ MessageManager.getString("label.select_many_views"), append);
+ toggleview.setToolTipText(
+ MessageManager.getString("label.toggle_enabled_views"));
toggleview.addItemListener(new ItemListener()
{
@@ -168,7 +171,8 @@ public class ViewSelectionMenu extends JMenu
});
add(toggleview);
- add(selectAll = new JMenuItem(MessageManager.getString("label.select_all_views")));
+ add(selectAll = new JMenuItem(
+ MessageManager.getString("label.select_all_views")));
selectAll.addActionListener(new ActionListener()
{
@@ -190,7 +194,8 @@ public class ViewSelectionMenu extends JMenu
}
}
});
- add(invertSel = new JMenuItem(MessageManager.getString("label.invert_selection")));
+ add(invertSel = new JMenuItem(
+ MessageManager.getString("label.invert_selection")));
invertSel.addActionListener(new ActionListener()
{
@@ -212,15 +217,15 @@ public class ViewSelectionMenu extends JMenu
invertSel.setEnabled(append);
selectAll.setEnabled(append);
}
- for (AlignmentPanel ap : allviews)
+ for (final AlignmentPanel ap : allviews)
{
- String nm = ((ap.getViewName() == null || ap.getViewName().length() == 0) ? ""
- : ap.getViewName() + " for ")
+ String nm = ((ap.getViewName() == null
+ || ap.getViewName().length() == 0) ? ""
+ : ap.getViewName() + " for ")
+ ap.alignFrame.getTitle();
- final JCheckBoxMenuItem a = new JCheckBoxMenuItem(nm,
+ final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(nm,
_selectedviews.contains(ap));
- final AlignmentPanel p = ap;
- a.addItemListener(new ItemListener()
+ checkBox.addItemListener(new ItemListener()
{
@Override
public void itemStateChanged(ItemEvent e)
@@ -231,15 +236,15 @@ public class ViewSelectionMenu extends JMenu
{
enabled = false;
// toggle the inclusion state
- if (_selectedviews.indexOf(p) == -1)
+ if (_selectedviews.indexOf(ap) == -1)
{
- _selectedviews.add(p);
- a.setSelected(true);
+ _selectedviews.add(ap);
+ checkBox.setSelected(true);
}
else
{
- _selectedviews.remove(p);
- a.setSelected(false);
+ _selectedviews.remove(ap);
+ checkBox.setSelected(false);
}
enabled = true;
_handler.itemStateChanged(e);
@@ -248,13 +253,13 @@ public class ViewSelectionMenu extends JMenu
{
// Deselect everything and select this item only
_selectedviews.clear();
- _selectedviews.add(p);
+ _selectedviews.add(ap);
enabled = false;
for (Component c : getMenuComponents())
{
if (c instanceof JCheckBoxMenuItem)
{
- ((JCheckBoxMenuItem) c).setSelected(a == c);
+ ((JCheckBoxMenuItem) c).setSelected(checkBox == c);
}
}
enabled = true;
@@ -264,54 +269,31 @@ public class ViewSelectionMenu extends JMenu
}
}
});
- a.addMouseListener(new MouseListener()
+ checkBox.addMouseListener(new MouseAdapter()
{
-
- @Override
- public void mouseReleased(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mousePressed(MouseEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
@Override
public void mouseExited(MouseEvent e)
{
try
{
- p.setSelected(false);
+ ap.setSelected(false);
} catch (Exception ex)
{
}
- ;
}
@Override
public void mouseEntered(MouseEvent e)
{
-
try
{
- p.setSelected(true);
+ ap.setSelected(true);
} catch (Exception ex)
{
}
- ;
- }
-
- @Override
- public void mouseClicked(MouseEvent e)
- {
}
});
- add(a);
+ add(checkBox);
}
}