import jalview.schemes.Blosum62ColourScheme;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.ClustalxColourScheme;
-import jalview.schemes.ColourSchemeI;
+import jalview.schemes.CollectionColourScheme;
++import jalview.schemes.CollectionColourSchemeI;
import jalview.schemes.HelixColourScheme;
import jalview.schemes.HydrophobicColourScheme;
+ import jalview.schemes.JalviewColourScheme;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.PurinePyrimidineColourScheme;
}
/**
+ * Select the menu item (if any) matching the current colour scheme. This
+ * works by matching the menu item name (not display text) to the canonical
+ * name of the colour scheme.
+ *
+ * @param cs
+ */
- protected void setSelectedColour(ColourSchemeI cs)
++ protected void setSelectedColour(CollectionColourSchemeI cs)
+ {
- if (cs == null)
++ if (cs == null || cs.getColourScheme() == null)
+ {
+ noColour.setState(true);
+ }
+ else
+ {
++ String name = cs.getColourScheme().getSchemeName();
+ for (int i = 0; i < colourMenu.getItemCount(); i++)
+ {
+ MenuItem item = colourMenu.getItem(i);
+ if (item instanceof CheckboxMenuItem)
+ {
- if (cs.getSchemeName().equals(item.getName()))
++ if (name.equals(item.getName()))
+ {
+ ((CheckboxMenuItem) item).setState(true);
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Adds a 'Link' menu item with a sub-menu item for each hyperlink provided.
*
* @param seq
@Override
public void itemStateChanged(ItemEvent evt)
{
- if (evt.getSource() == abovePIDColour)
- {
- abovePIDColour_itemStateChanged();
- }
- else if (evt.getSource() == showColourText)
- {
- showColourText_itemStateChanged();
- }
- else if (evt.getSource() == showText)
+ Object source = evt.getSource();
+ if (source == noColour)
{
- showText_itemStateChanged();
+ noColourmenuItem_actionPerformed();
}
- else if (evt.getSource() == showBoxes)
+ else if (source == clustalColour)
{
- showBoxes_itemStateChanged();
+ clustalColour_actionPerformed();
}
- else if (evt.getSource() == displayNonconserved)
+ else if (source == BLOSUM62Colour)
{
- this.showNonconserved_itemStateChanged();
+ BLOSUM62Colour_actionPerformed();
}
- }
-
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- Object source = evt.getSource();
- if (source == clustalColour)
- else if (source == PIDColour)
++ else if (evt.getSource() == PIDColour)
{
- clustalColour_actionPerformed();
+ PIDColour_actionPerformed();
}
else if (source == zappoColour)
{
return;
}
- if (conservationMenuItem.getState())
+ if (conservationColour.getState())
{
- Conservation conservation = Conservation.calculateConservation("Group", sg
- sg.cs.setConservation(Conservation.calculateConservation("Group", sg
++ Conservation conservation = Conservation.calculateConservation(
++ "Group", sg
.getSequences(ap.av.getHiddenRepSequences()), 0, ap.av
.getAlignment().getWidth(), false, ap.av.getConsPercGaps(),
- false));
+ false);
+ sg.getGroupColourScheme().setConservation(conservation);
SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());
SliderPanel.showConservationSlider();
}