import java.util.List;
import java.util.Vector;
+import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
import javax.swing.JInternalFrame;
colourMenu.add(textColour);
colourMenu.addSeparator();
- ColourMenuHelper.addMenuItems(colourMenu, this, viewport.getAlignment(),
- false);
+ ButtonGroup bg = ColourMenuHelper.addMenuItems(colourMenu, this,
+ viewport.getAlignment(), false);
+ colourMenu.add(annotationColour);
+ bg.add(annotationColour);
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
colourMenu.add(modifyConservation);
colourMenu.add(abovePIDThreshold);
colourMenu.add(modifyPID);
- colourMenu.add(annotationColour);
ColourSchemeI colourScheme = viewport.getGlobalColourScheme();
ColourMenuHelper.setColourSelected(colourMenu, colourScheme);
@Override
public void reset()
{
- av.setGlobalColourScheme(oldcs);
+ this.ap.alignFrame.changeColour(oldcs);
if (av.getAlignment().getGroups() != null)
{
acg.setThresholdIsMinMax(thresholdIsMin.isSelected());
- av.setGlobalColourScheme(acg);
+ this.ap.alignFrame.changeColour(acg);
if (av.getAlignment().getGroups() != null)
{
super.sliderDragReleased();
ap.paintAlignment(true, true);
}
-
}
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
import jalview.io.FileFormats;
+import jalview.schemes.ResidueColourScheme;
import jalview.util.MessageManager;
import jalview.util.Platform;
protected JMenuItem modifyPID;
- protected JMenuItem annotationColour;
+ protected JRadioButtonMenuItem annotationColour;
protected JMenu sortByTreeMenu = new JMenu();
private boolean showAutoCalculatedAbove = false;
- private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
+ private Map<KeyStroke, JMenuItem> accelerators = new HashMap<>();
private SplitContainerI splitFrame;
}
});
- annotationColour = new JMenuItem(
+ annotationColour = new JRadioButtonMenuItem(
MessageManager.getString("action.by_annotation"));
+ annotationColour.setName(ResidueColourScheme.ANNOTATION_COLOUR);
annotationColour.addActionListener(new ActionListener()
{
@Override
}
else
{
- seqannot = new IdentityHashMap<SequenceI, AlignmentAnnotation>();
+ seqannot = new IdentityHashMap<>();
}
// resolve the context containing all the annotation for the sequence
AnnotatedCollectionI alcontext = alignment instanceof AlignmentI
@Override
public String getSchemeName()
{
- return "Annotation";
+ return ANNOTATION_COLOUR;
}
@Override
public static final String USER_DEFINED_MENU = "*User Defined*";
/*
+ * the canonical name of the annotation colour scheme
+ * (may be used to identify it in menu items)
+ */
+ public static final String ANNOTATION_COLOUR = "Annotation";
+
+ /*
* lookup up by character value e.g. 'G' to the colors array index
* e.g. if symbolIndex['K'] = 11 then colors[11] is the colour for K
*/