package jalview.jbgui;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.analysis.GeneticCodeI;
+import jalview.analysis.GeneticCodes;
import jalview.api.SplitContainerI;
import jalview.bin.Cache;
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
import jalview.io.FileFormats;
+import jalview.schemes.ResidueColourScheme;
import jalview.util.MessageManager;
import jalview.util.Platform;
protected JMenu sortByAnnotScore = new JMenu();
- public JLabel statusBar = new JLabel();
+ protected JLabel statusBar = new JLabel();
protected JMenu outputTextboxMenu = new JMenu();
protected JMenuItem modifyPID;
- protected JMenuItem annotationColour;
+ protected JRadioButtonMenuItem annotationColour;
protected JMenu sortByTreeMenu = new JMenu();
protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
- protected JMenuItem showTranslation = new JMenuItem();
+ protected JMenu showTranslation = new JMenu();
protected JMenuItem showReverse = new JMenuItem();
protected JMenuItem runGroovy = new JMenuItem();
+ protected JMenuItem loadVcf;
+
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
- private SequenceAnnotationOrder annotationSortOrder;
+ private Map<KeyStroke, JMenuItem> accelerators = new HashMap<>();
- private boolean showAutoCalculatedAbove = false;
+ private SplitContainerI splitFrame;
- private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
+ protected JMenuItem sortAnnBySequence;
- private SplitContainerI splitFrame;
+ protected JMenuItem sortAnnByLabel;
+
+ protected JMenu annotationsMenu;
public GAlignFrame()
{
JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
- JMenu annotationsMenu = new JMenu(
+ annotationsMenu = new JMenu(
MessageManager.getString("action.annotations"));
JMenu showMenu = new JMenu(MessageManager.getString("action.show"));
colourMenu.setText(MessageManager.getString("action.colour"));
SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
.valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
SequenceAnnotationOrder.NONE.name()));
- final JCheckBoxMenuItem sortAnnBySequence = new JCheckBoxMenuItem(
+ sortAnnBySequence = new JCheckBoxMenuItem(
MessageManager.getString("label.sort_annotations_by_sequence"));
- final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem(
+ sortAnnByLabel = new JCheckBoxMenuItem(
MessageManager.getString("label.sort_annotations_by_label"));
- sortAnnBySequence.setSelected(
- sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
sortAnnBySequence.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- boolean newState = sortAnnBySequence.getState();
- sortAnnByLabel.setSelected(false);
- setAnnotationSortOrder(
- newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
- : SequenceAnnotationOrder.NONE);
- sortAnnotations_actionPerformed();
+ setAnnotationSortOrder(SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+ sortAnnotations();
}
});
- sortAnnByLabel.setSelected(
- sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
sortAnnByLabel.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- boolean newState = sortAnnByLabel.getState();
- sortAnnBySequence.setSelected(false);
- setAnnotationSortOrder(
- newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
- : SequenceAnnotationOrder.NONE);
- sortAnnotations_actionPerformed();
+ setAnnotationSortOrder(SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+ sortAnnotations();
}
});
colourTextMenuItem = new JCheckBoxMenuItem(
final boolean autoFirst = Cache
.getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false);
showAutoFirst.setSelected(autoFirst);
- setShowAutoCalculatedAbove(autoFirst);
showAutoFirst.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- setShowAutoCalculatedAbove(showAutoFirst.isSelected());
- sortAnnotations_actionPerformed();
+ if (setShowAutoCalculatedAbove(showAutoFirst.isSelected()))
+ {
+ sortAnnotations();
+ }
}
});
showAutoLast.setSelected(!showAutoFirst.isSelected());
@Override
public void actionPerformed(ActionEvent e)
{
- setShowAutoCalculatedAbove(!showAutoLast.isSelected());
- sortAnnotations_actionPerformed();
+ if (setShowAutoCalculatedAbove(!showAutoLast.isSelected()))
+ {
+ sortAnnotations();
+ }
}
});
vamsasStore_actionPerformed(e);
}
});
- showTranslation
- .setText(MessageManager.getString("label.translate_cDNA"));
- showTranslation.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
+
+ /*
+ * Translate as cDNA with sub-menu of translation tables
+ */
+ showTranslation.setText(MessageManager
+ .getString("label.translate_cDNA"));
+ boolean first = true;
+ for (final GeneticCodeI table : GeneticCodes.getInstance()
+ .getCodeTables())
+ {
+ JMenuItem item = new JMenuItem(table.getId() + " " + table.getName());
+ showTranslation.add(item);
+ item.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showTranslation_actionPerformed(table);
+ }
+ });
+ if (first)
{
- showTranslation_actionPerformed(e);
+ showTranslation.addSeparator();
}
- });
+ first = false;
+ }
+
showReverse.setText(MessageManager.getString("label.reverse"));
showReverse.addActionListener(new ActionListener()
{
associatedData_actionPerformed(e);
}
});
+ loadVcf = new JMenuItem(MessageManager.getString("label.load_vcf_file"));
+ loadVcf.setToolTipText(MessageManager.getString("label.load_vcf"));
+ loadVcf.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ loadVcf_actionPerformed();
+ }
+ });
autoCalculate.setText(
MessageManager.getString("label.autocalculate_consensus"));
autoCalculate.setState(
fileMenu.add(exportAnnotations);
fileMenu.add(loadTreeMenuItem);
fileMenu.add(associatedData);
+ fileMenu.add(loadVcf);
fileMenu.addSeparator();
fileMenu.add(closeMenuItem);
// selectMenu.add(listenToViewSelections);
}
+ protected void loadVcf_actionPerformed()
+ {
+ }
+
/**
* Constructs the entries on the Colour menu (but does not add them to the
* menu).
}
});
- annotationColour = new JMenuItem(
+ annotationColour = new JRadioButtonMenuItem(
MessageManager.getString("action.by_annotation"));
+ annotationColour.setName(ResidueColourScheme.ANNOTATION_COLOUR);
annotationColour.addActionListener(new ActionListener()
{
@Override
*
* @param sortOrder
*/
- protected void sortAnnotations_actionPerformed()
+ protected void sortAnnotations()
{
}
}
- public void showTranslation_actionPerformed(ActionEvent e)
+ public void showTranslation_actionPerformed(GeneticCodeI codeTable)
{
}
}
- protected boolean isShowAutoCalculatedAbove()
- {
- return showAutoCalculatedAbove;
- }
-
- protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
- {
- this.showAutoCalculatedAbove = showAutoCalculatedAbove;
- }
-
- protected SequenceAnnotationOrder getAnnotationSortOrder()
+ /**
+ * Sets the value of the flag for 'show autocalculated annotations above other
+ * annotations'. Answers true if the value changed, else false.
+ *
+ * @param showAutoCalculatedAbove
+ * @return
+ */
+ protected boolean setShowAutoCalculatedAbove(
+ boolean showAutoCalculatedAbove)
{
- return annotationSortOrder;
+ return false;
}
- protected void setAnnotationSortOrder(
+ public void setAnnotationSortOrder(
SequenceAnnotationOrder annotationSortOrder)
{
- this.annotationSortOrder = annotationSortOrder;
}
public Map<KeyStroke, JMenuItem> getAccelerators()