- new AnnotationColourChooser(viewport, alignPanel);
- }
-
- @Override
- public void annotationColumn_actionPerformed(ActionEvent e)
- {
- new AnnotationColumnChooser(viewport, alignPanel);
- }
-
- @Override
- public void rnahelicesColour_actionPerformed(ActionEvent e)
- {
- new RNAHelicesColourChooser(viewport, alignPanel);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- protected void applyToAllGroups_actionPerformed(ActionEvent e)
- {
- viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param cs
- * DOCUMENT ME!
- */
- public void changeColour(ColourSchemeI cs)
- {
- // TODO: pull up to controller method
-
- if (cs != null)
- {
- // Make sure viewport is up to date w.r.t. any sliders
- if (viewport.getAbovePIDThreshold())
- {
- int threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
- "Background");
- viewport.setThreshold(threshold);
- }
-
- if (viewport.getConservationSelected())
- {
- cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
- cs, "Background"));
- }
- }
-
- viewport.setGlobalColourScheme(cs);
-
- alignPanel.paintAlignment(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- protected void modifyPID_actionPerformed(ActionEvent e)
- {
- if (viewport.getAbovePIDThreshold()
- && viewport.getGlobalColourScheme() != null)
- {
- SliderPanel.setPIDSliderSource(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
- SliderPanel.showPIDSlider();
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- protected void modifyConservation_actionPerformed(ActionEvent e)
- {
- if (viewport.getConservationSelected()
- && viewport.getGlobalColourScheme() != null)
- {
- SliderPanel.setConservationSlider(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
- SliderPanel.showConservationSlider();
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- protected void conservationMenuItem_actionPerformed(ActionEvent e)
- {
- viewport.setConservationSelected(conservationMenuItem.isSelected());
-
- viewport.setAbovePIDThreshold(false);
- abovePIDThreshold.setSelected(false);
-
- changeColour(viewport.getGlobalColourScheme());
-
- modifyConservation_actionPerformed(null);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void abovePIDThreshold_actionPerformed(ActionEvent e)
- {
- viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
-
- conservationMenuItem.setSelected(false);
- viewport.setConservationSelected(false);
-
- changeColour(viewport.getGlobalColourScheme());
-
- modifyPID_actionPerformed(null);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void userDefinedColour_actionPerformed(ActionEvent e)
- {
- if (e.getActionCommand().equals(
- MessageManager.getString("action.user_defined")))
- {
- new UserDefinedColours(alignPanel, null);
- }
- else
- {
- UserColourScheme udc = (UserColourScheme) 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.isControlDown()
- || SwingUtilities.isRightMouseButton(evt))
- {
- radioItem.removeActionListener(radioItem.getActionListeners()[0]);
-
- int option = JOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop,
- MessageManager
- .getString("label.remove_from_default_list"),
- MessageManager
- .getString("label.remove_user_defined_colour"),
- JOptionPane.YES_NO_OPTION);
- if (option == JOptionPane.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!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void PIDColour_actionPerformed(ActionEvent e)
- {
- changeColour(new PIDColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void BLOSUM62Colour_actionPerformed(ActionEvent e)
- {
- changeColour(new Blosum62ColourScheme());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
- .getAlignment().getSequenceAt(0), null);
- addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
- viewport.getAlignment()));
- alignPanel.paintAlignment(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void sortIDMenuItem_actionPerformed(ActionEvent e)
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByID(viewport.getAlignment());
- addHistoryItem(new OrderCommand("ID Sort", oldOrder,
- viewport.getAlignment()));
- alignPanel.paintAlignment(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void sortLengthMenuItem_actionPerformed(ActionEvent e)
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByLength(viewport.getAlignment());
- addHistoryItem(new OrderCommand("Length Sort", oldOrder,
- viewport.getAlignment()));
- alignPanel.paintAlignment(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void sortGroupMenuItem_actionPerformed(ActionEvent e)
- {
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
- AlignmentSorter.sortByGroup(viewport.getAlignment());
- addHistoryItem(new OrderCommand("Group Sort", oldOrder,
- viewport.getAlignment()));
-
- alignPanel.paintAlignment(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
- {
- new RedundancyPanel(alignPanel, this);