import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.io.FileFormat;
import jalview.io.FormatAdapter;
import jalview.util.MessageManager;
private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern
.compile("<");
+
String TOGGLE_LABELSCALE = MessageManager
.getString("label.scale_label_to_column");
aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
}
- refresh(fullRepaint);
+ ap.refresh(fullRepaint);
}
/**
- * Redraw sensibly.
- *
- * @adjustHeight if true, try to recalculate panel height for visible
- * annotations
- */
- protected void refresh(boolean adjustHeight)
- {
- ap.validateAnnotationDimensions(adjustHeight);
- ap.addNotify();
- if (adjustHeight)
- {
- // sort, repaint, update overview
- ap.paintAlignment(true);
- }
- else
- {
- // lightweight repaint
- ap.repaint();
- }
- }
-
- /**
* DOCUMENT ME!
*
* @param e
// ann.visible = false;
// }
// }
- refresh(true);
+ ap.refresh(true);
}
});
pop.add(hideType);
if (selectedRow < aa.length)
{
final String label = aa[selectedRow].label;
- if (!aa[selectedRow].autoCalculated)
+ if (!(aa[selectedRow].autoCalculated
+ || label.indexOf("Information Content") > -1))
{
if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
{
}
else if (label.indexOf("Consensus") > -1)
{
+
+
pop.addSeparator();
// av and sequencegroup need to implement same interface for
+ final AlignmentAnnotation aaa = aa[selectedRow];
+
final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
- MessageManager.getString("label.ignore_gaps_consensus"),
+ MessageManager.getString("label.ignore_gaps_consensus"),
(aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
.getIgnoreGapsConsensus() : ap.av
.isIgnoreGapsConsensus());
- final AlignmentAnnotation aaa = aa[selectedRow];
+
cbmi.addActionListener(new ActionListener()
{
@Override
{
ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
}
+ ap.alignmentChanged();
}
});
pop.add(cbmi);
consclipbrd.addActionListener(this);
pop.add(consclipbrd);
}
+ else if (label.indexOf("Information Content") > -1) // TODO create labels
+ // in message resource
+ // for these
+ {
+ pop.addSeparator();
+ final AlignmentAnnotation aaa = aa[selectedRow];
+
+ final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
+ "Ignore Below Background Frequency",
+ (aa[selectedRow].groupRef != null)
+ ? aa[selectedRow].groupRef
+ .getIgnoreBelowBackground()
+ : ap.av.isIgnoreBelowBackground());
+
+ cbmi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (aaa.groupRef != null)
+ {
+ // TODO: pass on reference to ap so the view can be updated.
+ aaa.groupRef.setIgnoreBelowBackground(cbmi.getState());
+ ap.getAnnotationPanel()
+ .paint(ap.getAnnotationPanel().getGraphics());
+ }
+ else
+ {
+ ap.av.setIgnoreBelowBackground(cbmi.getState(), ap);
+ }
+ ap.alignmentChanged();
+ }
+ });
+ pop.add(cbmi);
+ if (aaa.groupRef != null)
+ {
+ final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_group_histogram"),
+ aa[selectedRow].groupRef.isShowInformationHistogram());
+ chist.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setShowInformationHistogram(chist.getState());
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(chist);
+ final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_group_logo"),
+ aa[selectedRow].groupRef.isShowHMMSequenceLogo());
+ cprofl.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setshowHMMSequenceLogo(cprofl.getState());
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprofl);
+ final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+ MessageManager.getString("label.normalise_group_logo"),
+ aa[selectedRow].groupRef.isNormaliseHMMSequenceLogo());
+ cproflnorm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef
+ .setNormaliseHMMSequenceLogo(cproflnorm.getState());
+ // automatically enable logo display if we're clicked
+ aaa.groupRef.setshowHMMSequenceLogo(true);
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cproflnorm);
+ }
+ else
+ {
+ final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_histogram"),
+ av.isShowInformationHistogram());
+ chist.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowInformationHistogram(chist.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(chist);
+ final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_logo"),
+ av.isShowHMMSequenceLogo());
+ cprof.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowHMMSequenceLogo(cprof.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprof);
+ final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
+ MessageManager.getString("label.normalise_logo"),
+ av.isNormaliseHMMSequenceLogo());
+ cprofnorm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowHMMSequenceLogo(true);
+ av.setNormaliseHMMSequenceLogo(cprofnorm.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprofnorm);
+ }
+ final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
+ consclipbrd.addActionListener(this);
+ pop.add(consclipbrd);
+ }
}
pop.show(this, evt.getX(), evt.getY());
}
Alignment ds = new Alignment(dseqs);
if (av.hasHiddenColumns())
{
- omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
+ omitHidden = av.getAlignment().getHiddenColumns()
+ .getVisibleSequenceStrings(0,
sq.getLength(), seqs);
}
int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
- List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
+ List<int[]> hiddenCols = av.getAlignment().getHiddenColumns()
+ .getHiddenRegions();
if (hiddenCols != null)
{
alignmentStartEnd = av.getAlignment().getVisibleStartAndEndIndex(
hiddenCols);
}
- String output = new FormatAdapter().formatSequences("Fasta", seqs,
- omitHidden, alignmentStartEnd);
+ String output = new FormatAdapter().formatSequences(FileFormat.Fasta,
+ seqs, omitHidden, alignmentStartEnd);
Toolkit.getDefaultToolkit().getSystemClipboard()
.setContents(new StringSelection(output), Desktop.instance);
ArrayList<int[]> hiddenColumns = null;
if (av.hasHiddenColumns())
{
- hiddenColumns = new ArrayList<int[]>();
- for (int[] region : av.getColumnSelection().getHiddenColumns())
+ hiddenColumns = new ArrayList<>();
+ for (int[] region : av.getAlignment().getHiddenColumns()
+ .getHiddenRegions())
{
hiddenColumns.add(new int[] { region[0], region[1] });
}