From 46f8b484bb166375423eab4387dca05b48a9a8ff Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 5 Jan 2017 11:35:21 +0000 Subject: [PATCH] JAL-2373 set state of Above PID, By Conservation in Popup Menu --- src/jalview/appletgui/APopupMenu.java | 25 +++++++++++++++---------- src/jalview/gui/PopupMenu.java | 11 ++++++++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 015734f..6e5f130 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -244,8 +244,12 @@ public class APopupMenu extends java.awt.PopupMenu implements { menu1.setLabel(MessageManager.getString("action.edit_group")); groupMenu.remove(createGroupMenuItem); + if (sg.cs != null) + { + abovePIDColour.setState(sg.cs.getThreshold() > 0); + conservationMenuItem.setState(sg.cs.conservationApplied()); + } } - } else { @@ -500,23 +504,28 @@ public class APopupMenu extends java.awt.PopupMenu implements @Override public void itemStateChanged(ItemEvent evt) { - if (evt.getSource() == abovePIDColour) + Object source = evt.getSource(); + if (source == abovePIDColour) { abovePIDColour_itemStateChanged(); } - else if (evt.getSource() == showColourText) + else if (source == conservationMenuItem) + { + conservationMenuItem_itemStateChanged(); + } + else if (source == showColourText) { showColourText_itemStateChanged(); } - else if (evt.getSource() == showText) + else if (source == showText) { showText_itemStateChanged(); } - else if (evt.getSource() == showBoxes) + else if (source == showBoxes) { showBoxes_itemStateChanged(); } - else if (evt.getSource() == displayNonconserved) + else if (source == displayNonconserved) { this.showNonconserved_itemStateChanged(); } @@ -579,10 +588,6 @@ public class APopupMenu extends java.awt.PopupMenu implements { noColourmenuItem_actionPerformed(); } - else if (source == conservationMenuItem) - { - conservationMenuItem_itemStateChanged(); - } else if (source == unGroupMenuItem) { unGroupMenuItem_actionPerformed(); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index e1b2560..a93c92e 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -79,7 +79,6 @@ import javax.swing.JCheckBoxMenuItem; import javax.swing.JColorChooser; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JRadioButtonMenuItem; @@ -249,7 +248,6 @@ public class PopupMenu extends JPopupMenu colours.add(strandColour); colours.add(turnColour); colours.add(buriedColour); - colours.add(abovePIDColour); colours.add(userDefinedColour); colours.add(PIDColour); colours.add(BLOSUM62Colour); @@ -536,9 +534,16 @@ public class PopupMenu extends JPopupMenu noColourmenuItem.setSelected(true); } - if (sg.cs != null && sg.cs.conservationApplied()) + if (sg.cs != null) { + if (sg.cs.conservationApplied()) + { conservationMenuItem.setSelected(true); + } + if (sg.cs.getThreshold() > 0) + { + abovePIDColour.setSelected(true); + } } displayNonconserved.setSelected(sg.getShowNonconserved()); showText.setSelected(sg.getDisplayText()); -- 1.7.10.2