- SliderPanel.setPIDSliderSource(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
- SliderPanel.showPIDSlider();
- }
- }
-
- /**
- * DOCUMENT ME!
- */
- @Override
- protected void modifyConservation_actionPerformed()
- {
- if (viewport.getConservationSelected()
- && viewport.getGlobalColourScheme() != null)
- {
- SliderPanel.setConservationSlider(alignPanel,
- viewport.getGlobalColourScheme(), "Background");
- SliderPanel.showConservationSlider();
- }
- }
-
- /**
- * Action on selecting or deselecting (Colour) By Conservation
- */
- @Override
- protected void conservationMenuItem_actionPerformed()
- {
- boolean selected = conservationMenuItem.isSelected();
- modifyConservation.setEnabled(selected);
- viewport.setConservationSelected(selected);
-
- changeColour(viewport.getGlobalColourScheme());
- if (selected)
- {
- modifyConservation_actionPerformed();
- }
- else
- {
- SliderPanel.hideConservationSlider();
- }
- }
-
- /**
- * Action on selecting or deselecting (Colour) Above PID Threshold
- */
- @Override
- public void abovePIDThreshold_actionPerformed()
- {
- boolean selected = abovePIDThreshold.isSelected();
- modifyPID.setEnabled(selected);
- viewport.setAbovePIDThreshold(selected);
-
- changeColour(viewport.getGlobalColourScheme());
- if (selected)
- {
- modifyPID_actionPerformed();
- }
- else
- {
- SliderPanel.hidePIDSlider();
- }
- }
-
- /**
- * 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.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!
- *
- * @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);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
- {
- if ((viewport.getSelectionGroup() == null)
- || (viewport.getSelectionGroup().getSize() < 2))
- {
- JvOptionPane.showInternalMessageDialog(this, MessageManager
- .getString("label.you_must_select_least_two_sequences"),
- MessageManager.getString("label.invalid_selection"),
- JvOptionPane.WARNING_MESSAGE);
- }
- else
- {
- JInternalFrame frame = new JInternalFrame();
- frame.setContentPane(new PairwiseAlignPanel(viewport));
- Desktop.addInternalFrame(frame,
- MessageManager.getString("action.pairwise_alignment"), 600,
- 500);
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- @Override
- public void PCAMenuItem_actionPerformed(ActionEvent e)
- {
- if (((viewport.getSelectionGroup() != null)
- && (viewport.getSelectionGroup().getSize() < 4) && (viewport
- .getSelectionGroup().getSize() > 0))
- || (viewport.getAlignment().getHeight() < 4))
- {
- JvOptionPane
- .showInternalMessageDialog(
- this,
- MessageManager
- .getString("label.principal_component_analysis_must_take_least_four_input_sequences"),
- MessageManager
- .getString("label.sequence_selection_insufficient"),
- JvOptionPane.WARNING_MESSAGE);
-
- return;
- }
-
- new PCAPanel(alignPanel);
- }
-
- @Override
- public void autoCalculate_actionPerformed(ActionEvent e)
- {
- viewport.autoCalculateConsensus = autoCalculate.isSelected();
- if (viewport.autoCalculateConsensus)
- {
- viewport.firePropertyChange("alignment", null, viewport
- .getAlignment().getSequences());