import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Vector;
* Temporary store to hold distinct calcId / type pairs for the tooltip.
* Using TreeMap means calcIds are shown in alphabetical order.
*/
- Map<String, String> tipEntries = new TreeMap<String, String>();
+ SortedMap<String, String> tipEntries = new TreeMap<String, String>();
final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<SequenceI, List<AlignmentAnnotation>>();
AlignmentI al = this.ap.av.getAlignment();
AlignmentUtils.findAddableReferenceAnnotations(forSequences,
noColourmenuItem.setLabel(MessageManager.getString("label.none"));
noColourmenuItem.addActionListener(this);
- clustalColour.setLabel(MessageManager
- .getString("label.clustalx_colours"));
+ clustalColour.setLabel(MessageManager.getString("label.clustalx"));
clustalColour.addActionListener(this);
zappoColour.setLabel(MessageManager.getString("label.zappo"));
zappoColour.addActionListener(this);
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.print.PageFormat;
import java.awt.print.PrinterJob;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation.setEnabled(!nucleotide);
showGroupConservation.setEnabled(!nucleotide);
+ clustalColour.setEnabled(!nucleotide);
+ zappoColour.setEnabled(!nucleotide);
+ taylorColour.setEnabled(!nucleotide);
+ hydrophobicityColour.setEnabled(!nucleotide);
+ helixColour.setEnabled(!nucleotide);
+ strandColour.setEnabled(!nucleotide);
+ turnColour.setEnabled(!nucleotide);
+ buriedColour.setEnabled(!nucleotide);
rnahelicesColour.setEnabled(nucleotide);
nucleotideColour.setEnabled(nucleotide);
purinePyrimidineColour.setEnabled(nucleotide);
showComplementMenuItem.setText(nucleotide ? MessageManager
.getString("label.protein") : MessageManager
.getString("label.nucleotide"));
- setColourSelected(jalview.bin.Cache.getDefault(
+ String selectedColourScheme = Cache.getDefault(
nucleotide ? Preferences.DEFAULT_COLOUR_NUC
- : Preferences.DEFAULT_COLOUR_PROT, "None"));
+ : Preferences.DEFAULT_COLOUR_PROT, "None");
+ setColourSelected(selectedColourScheme);
}
/**
}
@Override
- public void textColour_actionPerformed(ActionEvent e)
+ public void textColour_actionPerformed()
{
new TextColourChooser().chooseColour(alignPanel, null);
}
* DOCUMENT ME!
*/
@Override
- protected void noColourmenuItem_actionPerformed(ActionEvent e)
+ protected void noColourmenuItem_actionPerformed()
{
changeColour(null);
}
* DOCUMENT ME!
*/
@Override
- public void clustalColour_actionPerformed(ActionEvent e)
+ public void clustalColour_actionPerformed()
{
changeColour(new ClustalxColourScheme(viewport.getAlignment(),
viewport.getHiddenRepSequences()));
* DOCUMENT ME!
*/
@Override
- public void zappoColour_actionPerformed(ActionEvent e)
+ public void zappoColour_actionPerformed()
{
changeColour(new ZappoColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void taylorColour_actionPerformed(ActionEvent e)
+ public void taylorColour_actionPerformed()
{
changeColour(new TaylorColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void hydrophobicityColour_actionPerformed(ActionEvent e)
+ public void hydrophobicityColour_actionPerformed()
{
changeColour(new HydrophobicColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void helixColour_actionPerformed(ActionEvent e)
+ public void helixColour_actionPerformed()
{
changeColour(new HelixColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void strandColour_actionPerformed(ActionEvent e)
+ public void strandColour_actionPerformed()
{
changeColour(new StrandColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void turnColour_actionPerformed(ActionEvent e)
+ public void turnColour_actionPerformed()
{
changeColour(new TurnColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void buriedColour_actionPerformed(ActionEvent e)
+ public void buriedColour_actionPerformed()
{
changeColour(new BuriedColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void nucleotideColour_actionPerformed(ActionEvent e)
+ public void nucleotideColour_actionPerformed()
{
changeColour(new NucleotideColourScheme());
}
@Override
- public void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ public void purinePyrimidineColour_actionPerformed()
{
changeColour(new PurinePyrimidineColourScheme());
}
/*
- * public void covariationColour_actionPerformed(ActionEvent e) {
+ * public void covariationColour_actionPerformed() {
* changeColour(new
* CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation
* ()[0])); }
*/
@Override
- public void annotationColour_actionPerformed(ActionEvent e)
+ public void annotationColour_actionPerformed()
{
new AnnotationColourChooser(viewport, alignPanel);
}
}
@Override
- public void rnahelicesColour_actionPerformed(ActionEvent e)
+ public void rnahelicesColour_actionPerformed()
{
new RNAHelicesColourChooser(viewport, alignPanel);
}
/**
* DOCUMENT ME!
*
- * @param e
- * DOCUMENT ME!
*/
@Override
- protected void applyToAllGroups_actionPerformed(ActionEvent e)
+ protected void applyToAllGroups_actionPerformed()
{
viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
}
* DOCUMENT ME!
*/
@Override
- protected void modifyPID_actionPerformed(ActionEvent e)
+ protected void modifyPID_actionPerformed()
{
if (viewport.getAbovePIDThreshold()
&& viewport.getGlobalColourScheme() != null)
* DOCUMENT ME!
*/
@Override
- protected void modifyConservation_actionPerformed(ActionEvent e)
+ protected void modifyConservation_actionPerformed()
{
if (viewport.getConservationSelected()
&& viewport.getGlobalColourScheme() != null)
* DOCUMENT ME!
*/
@Override
- protected void conservationMenuItem_actionPerformed(ActionEvent e)
+ protected void conservationMenuItem_actionPerformed()
{
viewport.setConservationSelected(conservationMenuItem.isSelected());
changeColour(viewport.getGlobalColourScheme());
- modifyConservation_actionPerformed(null);
+ modifyConservation_actionPerformed();
}
/**
* DOCUMENT ME!
*/
@Override
- public void abovePIDThreshold_actionPerformed(ActionEvent e)
+ public void abovePIDThreshold_actionPerformed()
{
viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
changeColour(viewport.getGlobalColourScheme());
- modifyPID_actionPerformed(null);
+ modifyPID_actionPerformed();
}
/**
}
else
{
- UserColourScheme udc = (UserColourScheme) UserDefinedColours
+ UserColourScheme udc = UserDefinedColours
.getUserColourSchemes().get(e.getActionCommand());
changeColour(udc);
}
}
- public void updateUserColourMenu()
- {
-
- Component[] menuItems = colourMenu.getMenuComponents();
- int iSize = menuItems.length;
- for (int i = 0; i < iSize; i++)
- {
- if (menuItems[i].getName() != null
- && menuItems[i].getName().equals("USER_DEFINED"))
- {
- colourMenu.remove(menuItems[i]);
- iSize--;
- }
- }
- if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
- {
- java.util.Enumeration userColours = jalview.gui.UserDefinedColours
- .getUserColourSchemes().keys();
-
- while (userColours.hasMoreElements())
- {
- final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
- userColours.nextElement().toString());
- radioItem.setName("USER_DEFINED");
- radioItem.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mousePressed(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Mac
- {
- offerRemoval(radioItem);
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Windows
- {
- offerRemoval(radioItem);
- }
- }
-
- /**
- * @param radioItem
- */
- void offerRemoval(final JRadioButtonMenuItem radioItem)
- {
- radioItem.removeActionListener(radioItem.getActionListeners()[0]);
-
- int option = JvOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop, MessageManager
- .getString("label.remove_from_default_list"),
- MessageManager
- .getString("label.remove_user_defined_colour"),
- JvOptionPane.YES_NO_OPTION);
- if (option == JvOptionPane.YES_OPTION)
- {
- jalview.gui.UserDefinedColours
- .removeColourFromDefaults(radioItem.getText());
- colourMenu.remove(radioItem);
- }
- else
- {
- radioItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
- }
- }
- });
- radioItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
-
- colourMenu.insert(radioItem, 15);
- colours.add(radioItem);
- }
- }
- }
-
/**
* DOCUMENT ME!
*
* DOCUMENT ME!
*/
@Override
- public void PIDColour_actionPerformed(ActionEvent e)
+ public void PIDColour_actionPerformed()
{
changeColour(new PIDColourScheme());
}
* DOCUMENT ME!
*/
@Override
- public void BLOSUM62Colour_actionPerformed(ActionEvent e)
+ public void BLOSUM62Colour_actionPerformed()
{
changeColour(new Blosum62ColourScheme());
}
}
@Override
- protected void tcoffeeColorScheme_actionPerformed(ActionEvent e)
+ protected void tcoffeeColorScheme_actionPerformed()
{
changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
}
}
AlignmentI cdna = new Alignment(cdnaSeqs.toArray(new SequenceI[cdnaSeqs
.size()]));
- AlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH,
+ GAlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
cdna.alignAs(alignment);
String newtitle = "cDNA " + MessageManager.getString("label.for") + " "
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TaylorColourScheme;
import jalview.schemes.TurnColourScheme;
+import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
import javax.swing.JColorChooser;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
-import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
setJalviewColourScheme(new PurinePyrimidineColourScheme());
}
+ /**
+ * Action on either selecting a user-defined colour, or 'User Defined...'
+ */
@Override
- public void userColour_actionPerformed(ActionEvent actionEvent)
+ public void userColour_actionPerformed(ActionEvent e)
{
- userColour.setSelected(true);
- new UserDefinedColours(this, null);
+ if (e.getActionCommand().equals(
+ MessageManager.getString("action.user_defined")))
+ {
+ userColour.setSelected(true);
+ new UserDefinedColours(this, null);
+ }
+ else
+ {
+ UserColourScheme udc = UserDefinedColours.getUserColourSchemes().get(
+ e.getActionCommand());
+ jmb.setJalviewColourScheme(udc);
+ }
}
@Override
public void backGround_actionPerformed(ActionEvent actionEvent)
{
- java.awt.Color col = JColorChooser
- .showDialog(this, MessageManager
- .getString("label.select_backgroud_colour"), null);
+ Color col = JColorChooser.showDialog(this,
+ MessageManager.getString("label.select_background_colour"),
+ null);
if (col != null)
{
jmb.setBackgroundColour(col);
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Vector;
import javax.swing.JColorChooser;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
colourMenu.add(nucleotideMenuItem);
if (ap.getAlignment().isNucleotide())
{
- // JBPNote - commented since the colourscheme isn't functional
colourMenu.add(purinePyrimidineColour);
}
- colourMenu.add(userDefinedColour);
- if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
+ SortedMap<String, UserColourScheme> userColourSchemes = UserDefinedColours
+ .getUserColourSchemes();
+ if (userColourSchemes != null)
{
- java.util.Enumeration userColours = jalview.gui.UserDefinedColours
- .getUserColourSchemes().keys();
-
- while (userColours.hasMoreElements())
- {
- JMenuItem item = new JMenuItem(userColours.nextElement().toString());
+ for (String userColour : userColourSchemes.keySet())
+ {
+ JMenuItem item = new JMenuItem(userColour);
item.addActionListener(new ActionListener()
{
@Override
colourMenu.add(item);
}
}
+ colourMenu.add(userDefinedColour);
colourMenu.addSeparator();
colourMenu.add(abovePIDColour);
}
});
- clustalColour.setText(MessageManager
- .getString("label.clustalx_colours"));
+ clustalColour.setText(MessageManager.getString("label.clustalx"));
clustalColour.addActionListener(new java.awt.event.ActionListener()
{
@Override
PIDColour_actionPerformed();
}
});
- BLOSUM62Colour.setText(MessageManager.getString("label.blosum62"));
+ BLOSUM62Colour
+ .setText(MessageManager.getString("label.blosum62_score"));
BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()
{
@Override
* Temporary store to hold distinct calcId / type pairs for the tooltip.
* Using TreeMap means calcIds are shown in alphabetical order.
*/
- Map<String, String> tipEntries = new TreeMap<String, String>();
+ SortedMap<String, String> tipEntries = new TreeMap<String, String>();
final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<SequenceI, List<AlignmentAnnotation>>();
AlignmentI al = this.ap.av.getAlignment();
AlignmentUtils.findAddableReferenceAnnotations(forSequences,
}
else
{
- UserColourScheme udc = (UserColourScheme) UserDefinedColours
+ UserColourScheme udc = UserDefinedColours
.getUserColourSchemes().get(e.getActionCommand());
sg.cs = udc;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
import jalview.jbgui.GUserDefinedColours;
+import jalview.schemabinding.version2.Colour;
+import jalview.schemabinding.version2.JalviewUserColours;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.schemes.UserColourScheme;
import jalview.util.ColorUtils;
+import jalview.util.Format;
import jalview.util.MessageManager;
import java.awt.Color;
import java.awt.Font;
+import java.awt.Insets;
import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Hashtable;
+import java.util.List;
+import java.util.SortedMap;
import java.util.StringTokenizer;
+import java.util.TreeMap;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
public class UserDefinedColours extends GUserDefinedColours implements
ChangeListener
{
+ private static final Font VERDANA_BOLD_10 = new Font("Verdana", Font.BOLD, 10);
+
+ private static final String USER_DEFINED_COLOURS = "USER_DEFINED_COLOURS";
+
+ private static final String LAST_DIRECTORY = "LAST_DIRECTORY";
+
private static final int MY_FRAME_HEIGHT = 420;
private static final int MY_FRAME_WIDTH = 810;
private static final int MY_FRAME_WIDTH_CASE_SENSITIVE = 970;
+ static SortedMap<String, UserColourScheme> userColourSchemes;
+
AlignmentPanel ap;
SequenceGroup seqGroup;
- ArrayList<JButton> selectedButtons;
+ List<JButton> selectedButtons;
ColourSchemeI oldColourScheme;
JInternalFrame frame;
- JalviewStructureDisplayI jmol;
+ JalviewStructureDisplayI structureViewer;
- ArrayList<JButton> upperCaseButtons;
+ List<JButton> upperCaseButtons;
- ArrayList<JButton> lowerCaseButtons;
+ List<JButton> lowerCaseButtons;
/**
* Creates a new UserDefinedColours object.
*
* @param ap
- * DOCUMENT ME!
* @param sg
- * DOCUMENT ME!
*/
public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)
{
showFrame();
}
- public UserDefinedColours(JalviewStructureDisplayI jmol,
+ public UserDefinedColours(JalviewStructureDisplayI viewer,
ColourSchemeI oldcs)
{
super();
- this.jmol = jmol;
+ this.structureViewer = viewer;
colorChooser.getSelectionModel().addChangeListener(this);
}
/**
- * DOCUMENT ME!
+ * A helper method to update or make a colour button, whose background colour
+ * is the associated colour, and text colour a darker shade of the same. If
+ * the button is already in the list, then its text and margins are updated,
+ * if not then it is created and added. This method supports toggling between
+ * case-sensitive and case-insensitive button panels. The case-sensitive
+ * version has abbreviated button text in order to fit in more buttons.
*
* @param label
- * DOCUMENT ME!
- * @param aa
- * DOCUMENT ME!
+ * @param residue
+ * @param the
+ * list of buttons
+ * @param buttonIndex
+ * the button's position in the list
*/
- JButton makeButton(String label, String aa,
- ArrayList<JButton> caseSensitiveButtons, int buttonIndex)
+ JButton makeButton(String label, String residue,
+ List<JButton> buttons, int buttonIndex)
{
final JButton button;
Color col;
- if (buttonIndex < caseSensitiveButtons.size())
+ if (buttonIndex < buttons.size())
{
- button = caseSensitiveButtons.get(buttonIndex);
+ button = buttons.get(buttonIndex);
col = button.getBackground();
}
else
{
button = new JButton();
- button.addMouseListener(new java.awt.event.MouseAdapter()
+ button.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
}
});
- caseSensitiveButtons.add(button);
+ buttons.add(button);
col = Color.white;
if (oldColourScheme != null)
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1, null);
+ col = oldColourScheme.findColour(residue.charAt(0), -1, null);
} catch (Exception ex)
{
}
if (caseSensitive.isSelected())
{
- button.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ button.setMargin(new Insets(2, 2, 2, 2));
}
else
{
- button.setMargin(new java.awt.Insets(2, 14, 2, 14));
+ button.setMargin(new Insets(2, 14, 2, 14));
}
button.setOpaque(true); // required for the next line to have effect
button.setBackground(col);
button.setText(label);
button.setForeground(ColorUtils.darkerThan(col));
- button.setFont(new java.awt.Font("Verdana", Font.BOLD, 10));
+ button.setFont(VERDANA_BOLD_10);
return button;
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * On 'OK', check that at least one colour has been assigned to a residue (and
+ * if not issue a warning), and apply the chosen colour scheme and close the
+ * panel.
*/
@Override
- protected void okButton_actionPerformed(ActionEvent e)
+ protected void okButton_actionPerformed()
{
if (isNoSelectionMade())
{
}
else
{
- applyButton_actionPerformed(null);
+ applyButton_actionPerformed();
try
{
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * Applies the current colour scheme to the alignment, sequence group or
+ * structure view.
*/
@Override
- protected void applyButton_actionPerformed(ActionEvent e)
+ protected void applyButton_actionPerformed()
{
if (isNoSelectionMade())
{
{
ap.alignFrame.changeColour(ucs);
}
- else if (jmol != null)
+ else if (structureViewer != null)
{
- jmol.setJalviewColourScheme(ucs);
+ structureViewer.setJalviewColourScheme(ucs);
}
}
lowerCaseButtons = new ArrayList<JButton>();
JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"), "jc",
- "Jalview User Colours");
+ Cache.getProperty(LAST_DIRECTORY), "jc", "Jalview User Colours");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager
.getString("label.load_colour_scheme"));
int value = chooser.showOpenDialog(this);
- if (value == JalviewFileChooser.APPROVE_OPTION)
+ if (value != JalviewFileChooser.APPROVE_OPTION)
{
- File choice = chooser.getSelectedFile();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
- String defaultColours = jalview.bin.Cache.getDefault(
- "USER_DEFINED_COLOURS", choice.getPath());
- if (defaultColours.indexOf(choice.getPath()) == -1)
- {
- defaultColours = defaultColours.concat("|")
- .concat(choice.getPath());
- }
-
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", defaultColours);
-
- UserColourScheme ucs = loadColours(choice.getAbsolutePath());
- Color[] colors = ucs.getColours();
- schemeName.setText(ucs.getName());
-
- if (ucs.getLowerCaseColours() != null)
- {
- caseSensitive.setSelected(true);
- lcaseColour.setEnabled(true);
- resetButtonPanel(true);
- for (int i = 0; i < lowerCaseButtons.size(); i++)
- {
- JButton button = lowerCaseButtons.get(i);
- button.setBackground(ucs.getLowerCaseColours()[i]);
- }
+ return;
+ }
+ File choice = chooser.getSelectedFile();
+ Cache.setProperty(LAST_DIRECTORY, choice.getParent());
- }
- else
- {
- caseSensitive.setSelected(false);
- lcaseColour.setEnabled(false);
- resetButtonPanel(false);
- }
+ UserColourScheme ucs = loadColours(choice.getAbsolutePath());
+ Color[] colors = ucs.getColours();
+ schemeName.setText(ucs.getName());
- for (int i = 0; i < upperCaseButtons.size(); i++)
+ if (ucs.getLowerCaseColours() != null)
+ {
+ caseSensitive.setSelected(true);
+ lcaseColour.setEnabled(true);
+ resetButtonPanel(true);
+ for (int i = 0; i < lowerCaseButtons.size(); i++)
{
- JButton button = upperCaseButtons.get(i);
- button.setBackground(colors[i]);
+ JButton button = lowerCaseButtons.get(i);
+ button.setBackground(ucs.getLowerCaseColours()[i]);
}
+ }
+ else
+ {
+ caseSensitive.setSelected(false);
+ lcaseColour.setEnabled(false);
+ resetButtonPanel(false);
+ }
+ for (int i = 0; i < upperCaseButtons.size(); i++)
+ {
+ JButton button = upperCaseButtons.get(i);
+ button.setBackground(colors[i]);
}
+
+ addNewColourScheme(choice.getPath());
}
/**
{
UserColourScheme ret = null;
- String colours = jalview.bin.Cache.getProperty("USER_DEFINED_COLOURS");
+ String colours = Cache.getProperty(USER_DEFINED_COLOURS);
if (colours != null)
{
if (colours.indexOf("|") > -1)
userColourSchemes.remove(schemeName.getText());
}
JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"), "jc",
+ Cache.getProperty(LAST_DIRECTORY), "jc",
"Jalview User Colours");
chooser.setFileView(new JalviewFileView());
if (value == JalviewFileChooser.APPROVE_OPTION)
{
String choice = chooser.getSelectedFile().getPath();
- String defaultColours = jalview.bin.Cache.getDefault(
- "USER_DEFINED_COLOURS", choice);
- if (defaultColours.indexOf(choice) == -1)
+ addNewColourScheme(choice);
+ saveToFile(choice);
+ }
+ }
+
+ /**
+ * Adds the current colour scheme to the Jalview properties file so it is
+ * loaded on next startup, and updates the Colour menu in the parent
+ * AlignFrame (if there is one). Note this action does not including applying
+ * the colour scheme.
+ *
+ * @param filePath
+ */
+ protected void addNewColourScheme(String filePath)
+ {
+ /*
+ * update the delimited list of user defined colour files in
+ * Jalview property USER_DEFINED_COLOURS
+ */
+ String defaultColours = Cache
+ .getDefault(USER_DEFINED_COLOURS, filePath);
+ if (defaultColours.indexOf(filePath) == -1)
+ {
+ if (defaultColours.length() > 0)
{
- if (defaultColours.length() > 0)
- {
- defaultColours = defaultColours.concat("|");
- }
- defaultColours = defaultColours.concat(choice);
+ defaultColours = defaultColours.concat("|");
}
+ defaultColours = defaultColours.concat(filePath);
+ }
+ Cache.setProperty(USER_DEFINED_COLOURS, defaultColours);
- userColourSchemes.put(schemeName.getText(), getSchemeFromButtons());
-
- ap.alignFrame.updateUserColourMenu();
-
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", defaultColours);
-
- jalview.schemabinding.version2.JalviewUserColours ucs = new jalview.schemabinding.version2.JalviewUserColours();
+ /*
+ * add to the cache in this object
+ */
+ userColourSchemes.put(schemeName.getText(), getSchemeFromButtons());
- ucs.setSchemeName(schemeName.getText());
- try
- {
- PrintWriter out = new PrintWriter(new OutputStreamWriter(
- new FileOutputStream(choice), "UTF-8"));
+ /*
+ * update the Colour menu items
+ */
+ if (ap != null)
+ {
+ ap.alignFrame.buildColourMenu();// updateUserColourMenu();
+ }
+ }
- for (int i = 0; i < buttonPanel.getComponentCount(); i++)
- {
- JButton button = (JButton) buttonPanel.getComponent(i);
- jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour();
- col.setName(button.getText());
- col.setRGB(jalview.util.Format.getHexString(button
- .getBackground()));
- ucs.addColour(col);
- }
+ /**
+ * Saves the colour scheme to file in XML format
+ *
+ * @param filePath
+ */
+ protected void saveToFile(String filePath)
+ {
+ /*
+ * build a Java model of colour scheme as XML, and
+ * marshal to file
+ */
+ JalviewUserColours ucs = new JalviewUserColours();
+ ucs.setSchemeName(schemeName.getText());
+ try
+ {
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(
+ new FileOutputStream(filePath), "UTF-8"));
- ucs.marshal(out);
- out.close();
- } catch (Exception ex)
+ for (int i = 0; i < buttonPanel.getComponentCount(); i++)
{
- ex.printStackTrace();
+ JButton button = (JButton) buttonPanel.getComponent(i);
+ Colour col = new Colour();
+ col.setName(button.getText());
+ col.setRGB(Format.getHexString(button.getBackground()));
+ ucs.addColour(col);
}
+ ucs.marshal(out);
+ out.close();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
}
}
ap.paintAlignment(true);
}
- if (jmol != null)
+ if (structureViewer != null)
{
- jmol.setJalviewColourScheme(oldColourScheme);
+ structureViewer.setJalviewColourScheme(oldColourScheme);
}
try
}
}
- static Hashtable userColourSchemes;
-
- public static Hashtable getUserColourSchemes()
+ public static SortedMap<String, UserColourScheme> getUserColourSchemes()
{
return userColourSchemes;
}
public static void initUserColourSchemes(String files)
{
- userColourSchemes = new Hashtable();
+ userColourSchemes = new TreeMap<String, UserColourScheme>();
if (files == null || files.length() == 0)
{
{
if (coloursFound.toString().length() > 1)
{
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS",
- coloursFound.toString());
+ Cache.setProperty(USER_DEFINED_COLOURS, coloursFound.toString());
}
else
{
- jalview.bin.Cache.applicationProperties
- .remove("USER_DEFINED_COLOURS");
+ Cache.applicationProperties.remove(USER_DEFINED_COLOURS);
}
}
}
// In case colours can't be loaded, we'll remove them
// from the default list here.
- userColourSchemes = new Hashtable();
+ userColourSchemes = new TreeMap<String, UserColourScheme>();
StringBuffer coloursFound = new StringBuffer();
StringTokenizer st = new StringTokenizer(
- jalview.bin.Cache.getProperty("USER_DEFINED_COLOURS"), "|");
+ Cache.getProperty(USER_DEFINED_COLOURS), "|");
while (st.hasMoreElements())
{
if (coloursFound.toString().length() > 1)
{
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS",
- coloursFound.toString());
+ Cache.setProperty(USER_DEFINED_COLOURS, coloursFound.toString());
}
else
{
- jalview.bin.Cache.applicationProperties
- .remove("USER_DEFINED_COLOURS");
+ Cache.applicationProperties.remove(USER_DEFINED_COLOURS);
}
}
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.api.SplitContainerI;
import jalview.bin.Cache;
+import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
+import jalview.gui.UserDefinedColours;
import jalview.io.FileFormat;
import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.UserColourScheme;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Color;
public class GAlignFrame extends JInternalFrame
{
+ protected static final String USER_DEFINED_COLOUR_SCHEME = "USER_DEFINED";
+
protected JMenuBar alignFrameMenuBar = new JMenuBar();
protected JMenuItem closeMenuItem = new JMenuItem();
protected JMenuItem webServiceNoServices;
- public JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();
protected JMenu sortByAnnotScore = new JMenu();
protected JMenu outputTextboxMenu = new JMenu();
- protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem textColour;
+
+ protected JRadioButtonMenuItem clustalColour;
- protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem zappoColour;
- protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem taylorColour;
- protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem hydrophobicityColour;
- protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem helixColour;
- protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem strandColour;
- protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem turnColour;
- protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem buriedColour;
- protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem userDefinedColour;
- protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem PIDColour;
- protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem BLOSUM62Colour;
- protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem nucleotideColour;
- protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem purinePyrimidineColour;
- protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem RNAInteractionColour;
- // protected JRadioButtonMenuItem covariationColour = new
- // JRadioButtonMenuItem();
+ // protected JRadioButtonMenuItem covariationColour;
- protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem tcoffeeColour;
- public JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem showNonconservedMenuItem = new JCheckBoxMenuItem();
protected JMenuItem undoMenuItem = new JMenuItem();
protected JMenuItem redoMenuItem = new JMenuItem();
- public JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem conservationMenuItem;
- JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
+ JRadioButtonMenuItem noColourmenuItem;
- public JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem abovePIDThreshold;
public JCheckBoxMenuItem showSeqFeatures = new JCheckBoxMenuItem();
JMenu pasteMenu = new JMenu();
- public JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem applyToAllGroups;
+
+ protected JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
+
+ protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
- public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
+ protected JMenuItem modifyPID;
- public JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();
+ protected JMenuItem modifyConservation;
- protected JMenuItem modifyConservation = new JMenuItem();
+ protected JMenuItem annotationColour;
protected JMenu sortByTreeMenu = new JMenu();
protected JMenuItem runGroovy = new JMenuItem();
- protected JMenuItem rnahelicesColour = new JMenuItem();
+ protected JMenuItem rnahelicesColour;
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
System.err.println(e.toString());
}
- if (!jalview.util.Platform.isAMac())
+ if (!Platform.isAMac())
{
closeMenuItem.setMnemonic('C');
outputTextboxMenu.setMnemonic('T');
reload.setMnemonic('R');
}
- if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
- {
- java.util.Enumeration userColours = jalview.gui.UserDefinedColours
- .getUserColourSchemes().keys();
-
- while (userColours.hasMoreElements())
- {
- final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
- userColours.nextElement().toString());
- radioItem.setName("USER_DEFINED");
- radioItem.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mousePressed(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Mac
- {
- offerRemoval(radioItem);
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Windows
- {
- offerRemoval(radioItem);
- }
- }
-
- /**
- * @param radioItem
- */
- void offerRemoval(final JRadioButtonMenuItem radioItem)
- {
- radioItem.removeActionListener(radioItem.getActionListeners()[0]);
-
- int option = JvOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop, MessageManager
- .getString("label.remove_from_default_list"),
- MessageManager
- .getString("label.remove_user_defined_colour"),
- JvOptionPane.YES_NO_OPTION);
- if (option == JvOptionPane.YES_OPTION)
- {
- jalview.gui.UserDefinedColours
- .removeColourFromDefaults(radioItem.getText());
- colourMenu.remove(radioItem);
- }
- else
- {
- radioItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
- }
- }
- });
- radioItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent evt)
- {
- userDefinedColour_actionPerformed(evt);
- }
- });
- colourMenu.insert(radioItem, 15);
- colours.add(radioItem);
- }
- }
- colours.add(noColourmenuItem);
- colours.add(clustalColour);
- colours.add(zappoColour);
- colours.add(taylorColour);
- colours.add(hydrophobicityColour);
- colours.add(helixColour);
- colours.add(strandColour);
- colours.add(turnColour);
- colours.add(buriedColour);
- colours.add(userDefinedColour);
- colours.add(PIDColour);
- colours.add(BLOSUM62Colour);
- colours.add(nucleotideColour);
- colours.add(purinePyrimidineColour);
- // colours.add(covariationColour);
- colours.add(tcoffeeColour);
- colours.add(RNAInteractionColour);
- setColourSelected(jalview.bin.Cache.getDefault(
- Preferences.DEFAULT_COLOUR, "None"));
+ // Map<String, UserColourScheme> userColourSchemes = UserDefinedColours
+ // .getUserColourSchemes();
+ // if (userColourSchemes != null)
+ // {
+ // int insertionPoint = findUserDefinedColourPosition();
+ // for (String userColour : userColourSchemes.keySet())
+ // {
+ // final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
+ // userColour);
+ // radioItem.setName(USER_DEFINED_COLOUR_SCHEME);
+ // radioItem.addMouseListener(new MouseAdapter()
+ // {
+ // @Override
+ // public void mousePressed(MouseEvent evt)
+ // {
+ // if (evt.isPopupTrigger()) // Mac
+ // {
+ // offerRemoval();
+ // }
+ // }
+ //
+ // @Override
+ // public void mouseReleased(MouseEvent evt)
+ // {
+ // if (evt.isPopupTrigger()) // Windows
+ // {
+ // offerRemoval();
+ // }
+ // }
+ //
+ // void offerRemoval()
+ // {
+ // radioItem.removeActionListener(radioItem.getActionListeners()[0]);
+ //
+ // int option = JvOptionPane.showInternalConfirmDialog(
+ // Desktop.desktop, MessageManager
+ // .getString("label.remove_from_default_list"),
+ // MessageManager
+ // .getString("label.remove_user_defined_colour"),
+ // JvOptionPane.YES_NO_OPTION);
+ // if (option == JvOptionPane.YES_OPTION)
+ // {
+ // UserDefinedColours.removeColourFromDefaults(radioItem
+ // .getText());
+ // colourMenu.remove(radioItem);
+ // }
+ // else
+ // {
+ // radioItem.addActionListener(new ActionListener()
+ // {
+ // @Override
+ // public void actionPerformed(ActionEvent evt)
+ // {
+ // userDefinedColour_actionPerformed(evt);
+ // }
+ // });
+ // }
+ // }
+ // });
+ // radioItem.addActionListener(new ActionListener()
+ // {
+ // @Override
+ // public void actionPerformed(ActionEvent evt)
+ // {
+ // userDefinedColour_actionPerformed(evt);
+ // }
+ // });
+ // colourMenu.insert(radioItem, insertionPoint);
+ // insertionPoint++;
+ // colours.add(radioItem);
+ // }
+ // }
+ //
+ // /*
+ // * add colours to a ButtonGroup to make their
+ // * selection mutually exclusive
+ // */
+ // colours.add(noColourmenuItem);
+ // colours.add(clustalColour);
+ // colours.add(zappoColour);
+ // colours.add(taylorColour);
+ // colours.add(hydrophobicityColour);
+ // colours.add(helixColour);
+ // colours.add(strandColour);
+ // colours.add(turnColour);
+ // colours.add(buriedColour);
+ // colours.add(userDefinedColour);
+ // colours.add(PIDColour);
+ // colours.add(BLOSUM62Colour);
+ // colours.add(nucleotideColour);
+ // colours.add(purinePyrimidineColour);
+ // // colours.add(covariationColour);
+ // colours.add(tcoffeeColour);
+ // colours.add(RNAInteractionColour);
+ // setColourSelected(Cache.getDefault(Preferences.DEFAULT_COLOUR, "None"));
}
public void setColourSelected(String defaultColour)
private void jbInit() throws Exception
{
+ initColourMenu();
+ buildColourMenu();
+
JMenuItem saveAs = new JMenuItem(
MessageManager.getString("action.save_as"));
ActionListener al = new ActionListener()
saveAs_actionPerformed(e);
}
};
+
+ // FIXME getDefaultToolkit throws an exception in Headless mode
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit
.getDefaultToolkit().getMenuShortcutKeyMask()
| KeyEvent.SHIFT_MASK, false);
statusBar.setText(MessageManager.getString("label.status_bar"));
outputTextboxMenu.setText(MessageManager
.getString("label.out_to_textbox"));
- clustalColour.setText(MessageManager.getString("label.clustalx"));
- clustalColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- clustalColour_actionPerformed(e);
- }
- });
- zappoColour.setText(MessageManager.getString("label.zappo"));
- zappoColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- zappoColour_actionPerformed(e);
- }
- });
- taylorColour.setText(MessageManager.getString("label.taylor"));
- taylorColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- taylorColour_actionPerformed(e);
- }
- });
- hydrophobicityColour.setText(MessageManager
- .getString("label.hydrophobicity"));
- hydrophobicityColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hydrophobicityColour_actionPerformed(e);
- }
- });
- helixColour.setText(MessageManager.getString("label.helix_propensity"));
- helixColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- helixColour_actionPerformed(e);
- }
- });
- strandColour.setText(MessageManager
- .getString("label.strand_propensity"));
- strandColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- strandColour_actionPerformed(e);
- }
- });
- turnColour.setText(MessageManager.getString("label.turn_propensity"));
- turnColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- turnColour_actionPerformed(e);
- }
- });
- buriedColour.setText(MessageManager.getString("label.buried_index"));
- buriedColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- buriedColour_actionPerformed(e);
- }
- });
- userDefinedColour.setText(MessageManager
- .getString("action.user_defined"));
- userDefinedColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- userDefinedColour_actionPerformed(e);
- }
- });
- PIDColour
- .setText(MessageManager.getString("label.percentage_identity"));
- PIDColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- PIDColour_actionPerformed(e);
- }
- });
- BLOSUM62Colour
- .setText(MessageManager.getString("label.blosum62_score"));
- BLOSUM62Colour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- BLOSUM62Colour_actionPerformed(e);
- }
- });
- nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
- nucleotideColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- nucleotideColour_actionPerformed(e);
- }
- });
-
- purinePyrimidineColour.setText(MessageManager
- .getString("label.purine_pyrimidine"));
- purinePyrimidineColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- purinePyrimidineColour_actionPerformed(e);
- }
- });
- RNAInteractionColour.setText("RNA Interaction type");
- RNAInteractionColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- RNAInteractionColour_actionPerformed(e);
- }
- });
- /*
- * covariationColour.setText("Covariation");
- * covariationColour.addActionListener(new ActionListener() { public void
- * actionPerformed(ActionEvent e) { covariationColour_actionPerformed(e); }
- * });
- */
JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem(
MessageManager.getString("label.average_distance_bloslum62"));
sortAnnotations_actionPerformed();
}
});
- colourTextMenuItem.setText(MessageManager
+ colourTextMenuItem = new JCheckBoxMenuItem(
+ MessageManager
.getString("label.colour_text"));
colourTextMenuItem.addActionListener(new ActionListener()
{
};
addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
- conservationMenuItem.setText(MessageManager
- .getString("action.by_conservation"));
- conservationMenuItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- conservationMenuItem_actionPerformed(e);
- }
- });
- noColourmenuItem.setText(MessageManager.getString("label.none"));
- noColourmenuItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- noColourmenuItem_actionPerformed(e);
- }
- });
wrapMenuItem.setText(MessageManager.getString("label.wrap"));
wrapMenuItem.addActionListener(new ActionListener()
{
};
addMenuActionAndAccelerator(keyStroke, findMenuItem, al);
- abovePIDThreshold.setText(MessageManager
- .getString("label.above_identity_threshold"));
- abovePIDThreshold.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- abovePIDThreshold_actionPerformed(e);
- }
- });
showSeqFeatures.setText(MessageManager
.getString("label.show_sequence_features"));
showSeqFeatures.addActionListener(new ActionListener()
}
});
- nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
- nucleotideColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- nucleotideColour_actionPerformed(e);
- }
- });
-
- tcoffeeColour.setText(MessageManager.getString("label.tcoffee_scores"));
- tcoffeeColour.setEnabled(false);
- tcoffeeColour.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- tcoffeeColorScheme_actionPerformed(e);
- }
- });
-
JMenuItem deleteGroups = new JMenuItem(
MessageManager.getString("action.undefine_groups"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit
};
addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
+ JMenuItem annotationColumn = new JMenuItem(
+ MessageManager.getString("action.select_by_annotation"));
+ annotationColumn.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ annotationColumn_actionPerformed(e);
+ }
+ });
+
JMenuItem createGroup = new JMenuItem(
MessageManager.getString("action.create_groups"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit
};
addMenuActionAndAccelerator(keyStroke, pasteThis, al);
- applyToAllGroups.setText(MessageManager
- .getString("label.apply_colour_to_all_groups"));
- applyToAllGroups.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- applyToAllGroups_actionPerformed(e);
- }
- });
JMenuItem createPNG = new JMenuItem("PNG");
createPNG.addActionListener(new ActionListener()
{
});
- JMenuItem modifyPID = new JMenuItem(
- MessageManager.getString("label.modify_identity_threshold"));
- modifyPID.addActionListener(new ActionListener()
+ sortByTreeMenu
+ .setText(MessageManager.getString("action.by_tree_order"));
+ sort.setText(MessageManager.getString("action.sort"));
+ sort.addMenuListener(new MenuListener()
{
@Override
- public void actionPerformed(ActionEvent e)
+ public void menuSelected(MenuEvent e)
{
- modifyPID_actionPerformed(e);
- }
- });
- modifyConservation.setText(MessageManager
- .getString("label.modify_conservation_threshold"));
- modifyConservation.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- modifyConservation_actionPerformed(e);
- }
- });
- sortByTreeMenu
- .setText(MessageManager.getString("action.by_tree_order"));
- sort.setText(MessageManager.getString("action.sort"));
- sort.addMenuListener(new MenuListener()
- {
- @Override
- public void menuSelected(MenuEvent e)
- {
- buildTreeMenu();
+ buildTreeMenu();
}
@Override
}
});
- JMenuItem annotationColour = new JMenuItem(
- MessageManager.getString("action.by_annotation"));
- annotationColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- annotationColour_actionPerformed(e);
- }
- });
-
- JMenuItem annotationColumn = new JMenuItem(
- MessageManager.getString("action.select_by_annotation"));
- annotationColumn.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- annotationColumn_actionPerformed(e);
- }
- });
-
- rnahelicesColour.setText(MessageManager
- .getString("action.by_rna_helixes"));
- rnahelicesColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- rnahelicesColour_actionPerformed(e);
- }
- });
-
JMenuItem associatedData = new JMenuItem(
MessageManager.getString("label.load_features_annotations"));
associatedData.addActionListener(new ActionListener()
tabbedPane.setToolTipText("<html><i>"
+ MessageManager.getString("label.rename_tab_eXpand_reGroup")
+ "</i></html>");
- JMenuItem textColour = new JMenuItem(
- MessageManager.getString("action.set_text_colour"));
- textColour.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- textColour_actionPerformed(e);
- }
- });
+
formatMenu.setText(MessageManager.getString("action.format"));
JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
idRightAlign.setText(MessageManager
autoAnnMenu.add(showGroupConsensus);
annotationsMenu.add(autoAnnMenu);
- colourMenu.add(applyToAllGroups);
- colourMenu.add(textColour);
- colourMenu.addSeparator();
- colourMenu.add(noColourmenuItem);
- colourMenu.add(clustalColour);
- colourMenu.add(BLOSUM62Colour);
- colourMenu.add(PIDColour);
- colourMenu.add(zappoColour);
- colourMenu.add(taylorColour);
- colourMenu.add(hydrophobicityColour);
- colourMenu.add(helixColour);
- colourMenu.add(strandColour);
- colourMenu.add(turnColour);
- colourMenu.add(buriedColour);
- colourMenu.add(nucleotideColour);
- colourMenu.add(purinePyrimidineColour);
- // colourMenu.add(RNAInteractionColour);
- // colourMenu.add(covariationColour);
- colourMenu.add(tcoffeeColour);
- colourMenu.add(userDefinedColour);
- colourMenu.addSeparator();
- colourMenu.add(conservationMenuItem);
- colourMenu.add(modifyConservation);
- colourMenu.add(abovePIDThreshold);
- colourMenu.add(modifyPID);
- colourMenu.add(annotationColour);
- colourMenu.add(rnahelicesColour);
sort.add(sortIDMenuItem);
sort.add(sortLengthMenuItem);
// selectMenu.add(listenToViewSelections);
}
+ /**
+ * Rebuilds the Colour menu, including any user-defined colours which have
+ * been loaded either on startup or during the session
+ */
+ public void buildColourMenu()
+ {
+ colourMenu.removeAll();
+ colours = new ButtonGroup();
+
+ colourMenu.add(applyToAllGroups);
+ colourMenu.add(textColour);
+ colourMenu.addSeparator();
+ colourMenu.add(noColourmenuItem);
+ colourMenu.add(clustalColour);
+ colourMenu.add(BLOSUM62Colour);
+ colourMenu.add(PIDColour);
+ colourMenu.add(zappoColour);
+ colourMenu.add(taylorColour);
+ colourMenu.add(hydrophobicityColour);
+ colourMenu.add(helixColour);
+ colourMenu.add(strandColour);
+ colourMenu.add(turnColour);
+ colourMenu.add(buriedColour);
+ colourMenu.add(nucleotideColour);
+ colourMenu.add(purinePyrimidineColour);
+ // colourMenu.add(RNAInteractionColour);
+ // colourMenu.add(covariationColour);
+ colourMenu.add(tcoffeeColour);
+
+ /*
+ * add any user-defined colours
+ */
+ Map<String, UserColourScheme> userColourSchemes = UserDefinedColours
+ .getUserColourSchemes();
+ if (userColourSchemes != null)
+ {
+ for (String userColour : userColourSchemes.keySet())
+ {
+ final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
+ userColour);
+ radioItem.setName(USER_DEFINED_COLOUR_SCHEME);
+ radioItem.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Mac
+ {
+ offerRemoval();
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Windows
+ {
+ offerRemoval();
+ }
+ }
+
+ void offerRemoval()
+ {
+ radioItem.removeActionListener(radioItem.getActionListeners()[0]);
+
+ int option = JvOptionPane.showInternalConfirmDialog(
+ Desktop.desktop, MessageManager
+ .getString("label.remove_from_default_list"),
+ MessageManager
+ .getString("label.remove_user_defined_colour"),
+ JvOptionPane.YES_NO_OPTION);
+ if (option == JvOptionPane.YES_OPTION)
+ {
+ UserDefinedColours.removeColourFromDefaults(radioItem
+ .getText());
+ colourMenu.remove(radioItem);
+ }
+ else
+ {
+ radioItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ userDefinedColour_actionPerformed(evt);
+ }
+ });
+ }
+ }
+ });
+ radioItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ userDefinedColour_actionPerformed(evt);
+ }
+ });
+ colourMenu.add(radioItem);
+ colours.add(radioItem);
+ }
+ }
+
+ colourMenu.add(userDefinedColour);
+ colourMenu.addSeparator();
+ colourMenu.add(conservationMenuItem);
+ colourMenu.add(modifyConservation);
+ colourMenu.add(abovePIDThreshold);
+ colourMenu.add(modifyPID);
+ colourMenu.add(annotationColour);
+ colourMenu.add(rnahelicesColour);
+
+ /*
+ * add colours to a ButtonGroup to make their
+ * selection mutually exclusive
+ */
+ colours.add(noColourmenuItem);
+ colours.add(clustalColour);
+ colours.add(zappoColour);
+ colours.add(taylorColour);
+ colours.add(hydrophobicityColour);
+ colours.add(helixColour);
+ colours.add(strandColour);
+ colours.add(turnColour);
+ colours.add(buriedColour);
+ colours.add(userDefinedColour);
+ colours.add(PIDColour);
+ colours.add(BLOSUM62Colour);
+ colours.add(nucleotideColour);
+ colours.add(purinePyrimidineColour);
+ // colours.add(covariationColour);
+ colours.add(tcoffeeColour);
+ colours.add(RNAInteractionColour);
+ setColourSelected(Cache.getDefault(Preferences.DEFAULT_COLOUR, "None"));
+
+ }
+
+ /**
+ * Constructs the entries on the Colour menu (but does not add them to the
+ * menu)
+ */
+ protected void initColourMenu()
+ {
+ applyToAllGroups = new JCheckBoxMenuItem(
+ MessageManager.getString("label.apply_colour_to_all_groups"));
+ applyToAllGroups.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ applyToAllGroups_actionPerformed();
+ }
+ });
+
+ textColour = new JRadioButtonMenuItem(
+ MessageManager.getString("action.set_text_colour"));
+ textColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ textColour_actionPerformed();
+ }
+ });
+ clustalColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.clustalx"));
+ clustalColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ clustalColour_actionPerformed();
+ }
+ });
+ zappoColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.zappo"));
+ zappoColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ zappoColour_actionPerformed();
+ }
+ });
+ taylorColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.taylor"));
+ taylorColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ taylorColour_actionPerformed();
+ }
+ });
+ hydrophobicityColour = new JRadioButtonMenuItem(
+ MessageManager
+ .getString("label.hydrophobicity"));
+ hydrophobicityColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hydrophobicityColour_actionPerformed();
+ }
+ });
+ helixColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.helix_propensity"));
+ helixColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ helixColour_actionPerformed();
+ }
+ });
+ strandColour = new JRadioButtonMenuItem(
+ MessageManager
+ .getString("label.strand_propensity"));
+ strandColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ strandColour_actionPerformed();
+ }
+ });
+ turnColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.turn_propensity"));
+ turnColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ turnColour_actionPerformed();
+ }
+ });
+ buriedColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.buried_index"));
+ buriedColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ buriedColour_actionPerformed();
+ }
+ });
+ userDefinedColour = new JRadioButtonMenuItem(
+ MessageManager
+ .getString("action.user_defined"));
+ userDefinedColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ userDefinedColour_actionPerformed(e);
+ }
+ });
+ PIDColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.percentage_identity"));
+ PIDColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ PIDColour_actionPerformed();
+ }
+ });
+ BLOSUM62Colour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.blosum62_score"));
+ BLOSUM62Colour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ BLOSUM62Colour_actionPerformed();
+ }
+ });
+ nucleotideColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.nucleotide"));
+ nucleotideColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ nucleotideColour_actionPerformed();
+ }
+ });
+ purinePyrimidineColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.purine_pyrimidine"));
+ purinePyrimidineColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed();
+ }
+ });
+
+ tcoffeeColour = new JRadioButtonMenuItem(
+ MessageManager.getString("label.tcoffee_scores"));
+ tcoffeeColour.setEnabled(false);
+ tcoffeeColour.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ tcoffeeColorScheme_actionPerformed();
+ }
+ });
+
+ RNAInteractionColour = new JRadioButtonMenuItem("RNA Interaction type");
+ RNAInteractionColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ RNAInteractionColour_actionPerformed();
+ }
+ });
+ /*
+ * covariationColour = new JRadioButtonMenuItem("Covariation");
+ * covariationColour.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) { covariationColour_actionPerformed(); }
+ * });
+ */
+
+ conservationMenuItem = new JCheckBoxMenuItem(
+ MessageManager
+ .getString("action.by_conservation"));
+ conservationMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ conservationMenuItem_actionPerformed();
+ }
+ });
+ noColourmenuItem = new JRadioButtonMenuItem(
+ MessageManager.getString("label.none"));
+ noColourmenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ noColourmenuItem_actionPerformed();
+ }
+ });
+
+ abovePIDThreshold = new JCheckBoxMenuItem(
+ MessageManager.getString("label.above_identity_threshold"));
+ abovePIDThreshold.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ abovePIDThreshold_actionPerformed();
+ }
+ });
+ modifyPID = new JMenuItem(
+ MessageManager.getString("label.modify_identity_threshold"));
+ modifyPID.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ modifyPID_actionPerformed();
+ }
+ });
+ modifyConservation = new JMenuItem(
+ MessageManager
+ .getString("label.modify_conservation_threshold"));
+ modifyConservation.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ modifyConservation_actionPerformed();
+ }
+ });
+
+ annotationColour = new JMenuItem(
+ MessageManager.getString("action.by_annotation"));
+ annotationColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ annotationColour_actionPerformed();
+ }
+ });
+
+ rnahelicesColour = new JMenuItem(
+ MessageManager.getString("action.by_rna_helixes"));
+ rnahelicesColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ rnahelicesColour_actionPerformed();
+ }
+ });
+ }
+
protected void selectHighlightedColumns_actionPerformed(
ActionEvent actionEvent)
{
{
}
- protected void clustalColour_actionPerformed(ActionEvent e)
+ protected void clustalColour_actionPerformed()
{
}
- protected void zappoColour_actionPerformed(ActionEvent e)
+ protected void zappoColour_actionPerformed()
{
}
- protected void taylorColour_actionPerformed(ActionEvent e)
+ protected void taylorColour_actionPerformed()
{
}
- protected void hydrophobicityColour_actionPerformed(ActionEvent e)
+ protected void hydrophobicityColour_actionPerformed()
{
}
- protected void helixColour_actionPerformed(ActionEvent e)
+ protected void helixColour_actionPerformed()
{
}
- protected void strandColour_actionPerformed(ActionEvent e)
+ protected void strandColour_actionPerformed()
{
}
- protected void turnColour_actionPerformed(ActionEvent e)
+ protected void turnColour_actionPerformed()
{
}
- protected void buriedColour_actionPerformed(ActionEvent e)
+ protected void buriedColour_actionPerformed()
{
}
{
}
- protected void PIDColour_actionPerformed(ActionEvent e)
+ protected void PIDColour_actionPerformed()
{
}
- protected void BLOSUM62Colour_actionPerformed(ActionEvent e)
+ protected void BLOSUM62Colour_actionPerformed()
{
}
- protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ protected void purinePyrimidineColour_actionPerformed()
{
}
- protected void RNAInteractionColour_actionPerformed(ActionEvent e)
+ protected void RNAInteractionColour_actionPerformed()
{
}
/*
- * protected void covariationColour_actionPerformed(ActionEvent e) { }
+ * protected void covariationColour_actionPerformed() { }
*/
- protected void noColourmenuItem_actionPerformed(ActionEvent e)
+ protected void noColourmenuItem_actionPerformed()
{
}
- protected void conservationMenuItem_actionPerformed(ActionEvent e)
+ protected void conservationMenuItem_actionPerformed()
{
}
{
}
- protected void abovePIDThreshold_actionPerformed(ActionEvent e)
+ protected void abovePIDThreshold_actionPerformed()
{
}
{
}
- protected void nucleotideColour_actionPerformed(ActionEvent e)
+ protected void nucleotideColour_actionPerformed()
{
}
{
}
- protected void applyToAllGroups_actionPerformed(ActionEvent e)
+ protected void applyToAllGroups_actionPerformed()
{
}
* Template method to handle the 'Color T-Coffee scores' menu event.
* <p>
* Subclasses override this method to provide a custom action.
- *
- * @param event
- * The raised event
*/
- protected void tcoffeeColorScheme_actionPerformed(ActionEvent event)
+ protected void tcoffeeColorScheme_actionPerformed()
{
}
{
}
- protected void modifyPID_actionPerformed(ActionEvent e)
+ protected void modifyPID_actionPerformed()
{
}
- protected void modifyConservation_actionPerformed(ActionEvent e)
+ protected void modifyConservation_actionPerformed()
{
}
}
- public void annotationColour_actionPerformed(ActionEvent e)
+ public void annotationColour_actionPerformed()
{
-
}
public void annotationColumn_actionPerformed(ActionEvent e)
{
-
}
- public void rnahelicesColour_actionPerformed(ActionEvent e)
+ public void rnahelicesColour_actionPerformed()
{
}
}
- public void textColour_actionPerformed(ActionEvent e)
+ public void textColour_actionPerformed()
{
}
package jalview.jbgui;
import jalview.api.structures.JalviewStructureDisplayI;
+import jalview.gui.UserDefinedColours;
+import jalview.schemes.UserColourScheme;
import jalview.util.MessageManager;
+import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.util.Map;
import javax.swing.ButtonGroup;
import javax.swing.JInternalFrame;
{
// private AAStructureBindingModel bindingModel;
- protected JMenu savemenu = new JMenu();
+ protected JMenu savemenu;
- protected JMenu viewMenu = new JMenu();
+ protected JMenu viewMenu;
- protected JMenu chainMenu = new JMenu();
+ protected JMenu colourMenu;
- protected JMenu viewerActionMenu = new JMenu();
+ protected JMenu chainMenu;
- protected JMenuItem alignStructs = new JMenuItem();
+ protected JMenu viewerActionMenu;
- protected JMenuItem fitToWindow = new JMenuItem();
+ protected JMenuItem alignStructs;
- protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
+ protected JMenuItem fitToWindow;
- protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem seqColour;
- protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem chainColour;
- protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem chargeColour;
- protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem zappoColour;
- protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem taylorColour;
- protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem hydroColour;
- protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem strandColour;
- protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem helixColour;
- protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem turnColour;
- protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem buriedColour;
- protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem nucleotideColour;
- protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem purinePyrimidineColour;
- protected JMenuItem helpItem = new JMenuItem();
+ protected JRadioButtonMenuItem userColour;
- protected JLabel statusBar = new JLabel();
+ protected JRadioButtonMenuItem viewerColour;
- protected JPanel statusPanel = new JPanel();
+ protected JMenuItem helpItem;
+
+ protected JLabel statusBar;
+
+ protected JPanel statusPanel;
/**
* Constructor
JMenu fileMenu = new JMenu();
fileMenu.setText(MessageManager.getString("action.file"));
+ savemenu = new JMenu();
savemenu.setActionCommand(MessageManager.getString("action.save_image"));
savemenu.setText(MessageManager.getString("action.save_as"));
viewMapping_actionPerformed(actionEvent);
}
});
+
+ viewMenu = new JMenu();
viewMenu.setText(MessageManager.getString("action.view"));
+ chainMenu = new JMenu();
chainMenu.setText(MessageManager.getString("action.show_chain"));
+ fitToWindow = new JMenuItem();
fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
fitToWindow.addActionListener(new ActionListener()
{
}
});
- JMenu colourMenu = new JMenu();
+ JMenu helpMenu = new JMenu();
+ helpMenu.setText(MessageManager.getString("action.help"));
+ helpItem = new JMenuItem();
+ helpItem.setText(MessageManager.getString("label.jmol_help"));
+ helpItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ showHelp_actionPerformed(actionEvent);
+ }
+ });
+ alignStructs = new JMenuItem();
+ alignStructs
+ .setText(MessageManager.getString("label.align_structures"));
+ alignStructs.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ alignStructs_actionPerformed(actionEvent);
+ }
+ });
+
+ viewerActionMenu = new JMenu(MessageManager.getString("label.jmol"));
+ viewerActionMenu.setVisible(false);
+ viewerActionMenu.add(alignStructs);
+ colourMenu = new JMenu();
+ buildColourMenu();
+ fileMenu.add(savemenu);
+ fileMenu.add(viewMapping);
+ savemenu.add(pdbFile);
+ savemenu.add(png);
+ savemenu.add(eps);
+ viewMenu.add(chainMenu);
+ helpMenu.add(helpItem);
+
+ menuBar.add(fileMenu);
+ menuBar.add(viewMenu);
+ menuBar.add(colourMenu);
+ menuBar.add(viewerActionMenu);
+ menuBar.add(helpMenu);
+
+ statusPanel = new JPanel();
+ statusPanel.setLayout(new GridLayout());
+ this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
+ statusBar = new JLabel();
+ statusPanel.add(statusBar, null);
+ }
+
+ /**
+ * Builds the colour menu
+ */
+ protected void buildColourMenu()
+ {
+ colourMenu.removeAll();
colourMenu.setText(MessageManager.getString("label.colours"));
JMenuItem backGround = new JMenuItem();
backGround_actionPerformed(actionEvent);
}
});
+ seqColour = new JRadioButtonMenuItem();
seqColour.setSelected(false);
seqColour.setText(MessageManager.getString("action.by_sequence"));
seqColour.addActionListener(new ActionListener()
seqColour_actionPerformed(actionEvent);
}
});
+ chainColour = new JRadioButtonMenuItem();
chainColour.setText(MessageManager.getString("action.by_chain"));
chainColour.addActionListener(new ActionListener()
{
chainColour_actionPerformed(actionEvent);
}
});
+ chargeColour = new JRadioButtonMenuItem();
chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
chargeColour.addActionListener(new ActionListener()
{
chargeColour_actionPerformed(actionEvent);
}
});
+ zappoColour = new JRadioButtonMenuItem();
zappoColour.setText(MessageManager.getString("label.zappo"));
zappoColour.addActionListener(new ActionListener()
{
zappoColour_actionPerformed(actionEvent);
}
});
+ taylorColour = new JRadioButtonMenuItem();
taylorColour.setText(MessageManager.getString("label.taylor"));
taylorColour.addActionListener(new ActionListener()
{
taylorColour_actionPerformed(actionEvent);
}
});
+ hydroColour = new JRadioButtonMenuItem();
hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
hydroColour.addActionListener(new ActionListener()
{
hydroColour_actionPerformed(actionEvent);
}
});
+ strandColour = new JRadioButtonMenuItem();
strandColour.setText(MessageManager
.getString("label.strand_propensity"));
strandColour.addActionListener(new ActionListener()
strandColour_actionPerformed(actionEvent);
}
});
+ helixColour = new JRadioButtonMenuItem();
helixColour.setText(MessageManager.getString("label.helix_propensity"));
helixColour.addActionListener(new ActionListener()
{
helixColour_actionPerformed(actionEvent);
}
});
+ turnColour = new JRadioButtonMenuItem();
turnColour.setText(MessageManager.getString("label.turn_propensity"));
turnColour.addActionListener(new ActionListener()
{
turnColour_actionPerformed(actionEvent);
}
});
+ buriedColour = new JRadioButtonMenuItem();
buriedColour.setText(MessageManager.getString("label.buried_index"));
buriedColour.addActionListener(new ActionListener()
{
buriedColour_actionPerformed(actionEvent);
}
});
+ nucleotideColour = new JRadioButtonMenuItem();
+ nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
+ nucleotideColour.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ nucleotideColour_actionPerformed(actionEvent);
+ }
+ });
+ purinePyrimidineColour = new JRadioButtonMenuItem();
purinePyrimidineColour.setText(MessageManager
.getString("label.purine_pyrimidine"));
purinePyrimidineColour.addActionListener(new ActionListener()
purinePyrimidineColour_actionPerformed(actionEvent);
}
});
-
+ userColour = new JRadioButtonMenuItem();
userColour.setText(MessageManager.getString("action.user_defined"));
userColour.addActionListener(new ActionListener()
{
userColour_actionPerformed(actionEvent);
}
});
+ viewerColour = new JRadioButtonMenuItem();
viewerColour.setSelected(false);
viewerColour
.setText(MessageManager.getString("label.colour_with_jmol"));
}
});
- JMenu helpMenu = new JMenu();
- helpMenu.setText(MessageManager.getString("action.help"));
- helpItem.setText(MessageManager.getString("label.jmol_help"));
- helpItem.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent actionEvent)
- {
- showHelp_actionPerformed(actionEvent);
- }
- });
- alignStructs
- .setText(MessageManager.getString("label.align_structures"));
- alignStructs.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent actionEvent)
- {
- alignStructs_actionPerformed(actionEvent);
- }
- });
- viewerActionMenu.setText(MessageManager.getString("label.jmol"));
- menuBar.add(fileMenu);
- menuBar.add(viewMenu);
- menuBar.add(colourMenu);
- menuBar.add(viewerActionMenu);
- viewerActionMenu.setVisible(false);
- menuBar.add(helpMenu);
- fileMenu.add(savemenu);
- fileMenu.add(viewMapping);
- savemenu.add(pdbFile);
- savemenu.add(png);
- savemenu.add(eps);
- viewMenu.add(chainMenu);
+ /*
+ * add colour buttons to a group so their selection
+ * is mutually exclusive
+ */
+ ButtonGroup colourButtons = new ButtonGroup();
colourMenu.add(seqColour);
colourMenu.add(chainColour);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(purinePyrimidineColour);
+
+ /*
+ * add any user-defined colours that are loaded
+ */
+ Map<String, UserColourScheme> userColourSchemes = UserDefinedColours
+ .getUserColourSchemes();
+ if (userColourSchemes != null)
+ {
+ for (String schemeName : userColourSchemes.keySet())
+ {
+ final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
+ schemeName);
+ radioItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ userColour_actionPerformed(evt);
+ }
+ });
+ colourMenu.add(radioItem);
+ colourButtons.add(radioItem);
+ }
+ }
colourMenu.add(userColour);
colourMenu.add(viewerColour);
colourMenu.add(backGround);
- ButtonGroup colourButtons = new ButtonGroup();
-
colourButtons.add(seqColour);
colourButtons.add(chainColour);
colourButtons.add(chargeColour);
colourButtons.add(purinePyrimidineColour);
colourButtons.add(userColour);
colourButtons.add(viewerColour);
-
- helpMenu.add(helpItem);
- viewerActionMenu.add(alignStructs);
-
- statusPanel.setLayout(new GridLayout());
- this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
- statusPanel.add(statusBar, null);
}
protected void fitToWindow_actionPerformed()
}
+ public void nucleotideColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
{
okButton.setText(MessageManager.getString("action.ok"));
okButton.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- okButton_actionPerformed(e);
+ okButton_actionPerformed();
}
});
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
applyButton.setText(MessageManager.getString("action.apply"));
- applyButton.addActionListener(new java.awt.event.ActionListener()
+ applyButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- applyButton_actionPerformed(e);
+ applyButton_actionPerformed();
}
});
loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
loadbutton.setText(MessageManager.getString("action.load_scheme"));
loadbutton.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
loadbutton_actionPerformed(e);
savebutton.setText(MessageManager.getString("action.save_scheme"));
savebutton.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
savebutton_actionPerformed(e);
cancelButton.setText(MessageManager.getString("action.cancel"));
cancelButton.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
cancelButton_actionPerformed(e);
caseSensitive.setText(MessageManager.getString("label.case_sensitive"));
caseSensitive.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
caseSensitive_actionPerformed(e);
.setText(MessageManager.getString("label.lower_case_colour"));
lcaseColour.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
lcaseColour_actionPerformed(e);
/**
* DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
*/
- protected void okButton_actionPerformed(ActionEvent e)
+ protected void okButton_actionPerformed()
{
}
/**
* DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
*/
- protected void applyButton_actionPerformed(ActionEvent e)
+ protected void applyButton_actionPerformed()
{
}
public class Jalview2xmlTests extends Jalview2xmlBase
{
+ @Override
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
{
assertTrue("Didn't read input file " + inFile, af != null);
int olddsann = countDsAnn(af.getViewport());
assertTrue("Didn't find any dataset annotations", olddsann > 0);
- af.rnahelicesColour_actionPerformed(null);
+ af.rnahelicesColour_actionPerformed();
assertTrue(
"Couldn't apply RNA helices colourscheme",
af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);