/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
* Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
Font font = new Font("Arial", Font.PLAIN, 11);
+ private boolean hasHiddenRows;
+
/**
* Creates a new AnnotationLabels object.
*
{
}
- BufferedImage bi = new BufferedImage(temp.getHeight(this), temp
- .getWidth(this), BufferedImage.TYPE_INT_RGB);
+ BufferedImage bi = new BufferedImage(temp.getHeight(this),
+ temp.getWidth(this), BufferedImage.TYPE_INT_RGB);
Graphics2D g = (Graphics2D) bi.getGraphics();
g.rotate(Math.toRadians(90));
g.drawImage(temp, 0, -bi.getWidth(this), this);
repaint();
}
+ /**
+ * sets selectedRow to -2 if no annotation preset, -1 if no visible row is at
+ * y
+ *
+ * @param y
+ * coordinate position to search for a row
+ */
void getSelectedRow(int y)
{
int height = 0;
AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
-
+ selectedRow = -2;
if (aa != null)
{
for (int i = 0; i < aa.length; i++)
{
+ selectedRow = -1;
if (!aa[i].visible)
{
continue;
break;
}
}
- } else {
- selectedRow = -1;
}
}
else if (evt.getActionCommand().equals(HIDE))
{
aa[selectedRow].visible = false;
-
- if (aa[selectedRow].label.equals("Quality"))
- {
- ap.av.quality = null;
- }
}
else if (evt.getActionCommand().equals(DELETE))
{
aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
}
- ap.annotationPanel.adjustPanelHeight();
- ap.annotationScroller.validate();
- ap.paintAlignment(true);
+ ap.validateAnnotationDimensions(false);
+ ap.addNotify();
+ ap.repaint();
+ //validate();
+ //ap.paintAlignment(true);
}
/**
{
EditNameDialog dialog = new EditNameDialog(annotation.label,
annotation.description, " Annotation Name ",
- "Annotation Description ", "Edit Annotation Name/Description");
+ "Annotation Description ", "Edit Annotation Name/Description",
+ ap.alignFrame);
if (!dialog.accept)
{
// Swap these annotations
AlignmentAnnotation startAA = ap.av.alignment
.getAlignmentAnnotation()[start];
+ if (end == -1)
+ {
+ end = ap.av.alignment.getAlignmentAnnotation().length - 1;
+ }
AlignmentAnnotation endAA = ap.av.alignment.getAlignmentAnnotation()[end];
ap.av.alignment.getAlignmentAnnotation()[end] = startAA;
AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
if (SwingUtilities.isLeftMouseButton(evt))
{
- if (aa!=null && selectedRow < aa.length)
+ if (selectedRow > -1 && selectedRow < aa.length)
{
if (aa[selectedRow].groupRef != null)
{
if (evt.getClickCount() >= 2)
{
- // todo: make the ap scroll to the selection
+ // todo: make the ap scroll to the selection - not necessary, first click highlights/scrolls, second selects
ap.seqPanel.ap.idPanel.highlightSearchResults(null);
ap.av.setSelectionGroup(// new SequenceGroup(
- aa[selectedRow].groupRef); // );
+ aa[selectedRow].groupRef); // );
ap.paintAlignment(false);
+ PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
+ ap.av.sendSelection();
}
else
{
SequenceGroup sg = new SequenceGroup();
sg.addSequence(aa[selectedRow].sequenceRef, false);
ap.av.setSelectionGroup(sg);
+ ap.av.sendSelection();
ap.paintAlignment(false);
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
}
JPopupMenu pop = new JPopupMenu("Annotations");
JMenuItem item = new JMenuItem(ADDNEW);
item.addActionListener(this);
-
- if ((aa == null) || (aa.length == 0))
+ pop.add(item);
+ if (selectedRow < 0)
{
- item = new JMenuItem(SHOWALL);
- item.addActionListener(this);
- pop.add(item);
+ if (hasHiddenRows)
+ { // let the user make everything visible again
+ item = new JMenuItem(SHOWALL);
+ item.addActionListener(this);
+ pop.add(item);
+ }
pop.show(this, evt.getX(), evt.getY());
return;
}
-
- pop.add(item);
item = new JMenuItem(EDITNAME);
item.addActionListener(this);
pop.add(item);
item = new JMenuItem(DELETE);
item.addActionListener(this);
pop.add(item);
- item = new JMenuItem(SHOWALL);
- item.addActionListener(this);
- pop.add(item);
+ if (hasHiddenRows)
+ {
+ item = new JMenuItem(SHOWALL);
+ item.addActionListener(this);
+ pop.add(item);
+ }
item = new JMenuItem(OUTPUT_TEXT);
item.addActionListener(this);
pop.add(item);
final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
"Ignore Gaps In Consensus",
(aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
- .getIgnoreGapsConsensus()
- : ap.av.getIgnoreGapsConsensus());
+ .getIgnoreGapsConsensus() : ap.av
+ .getIgnoreGapsConsensus());
final AlignmentAnnotation aaa = aa[selectedRow];
cbmi.addActionListener(new ActionListener()
{
if (aaa.groupRef != null)
{
final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- "Show Group Histogram", aa[selectedRow].groupRef
- .isShowConsensusHistogram());
+ "Show Group Histogram",
+ aa[selectedRow].groupRef.isShowConsensusHistogram());
chist.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
}
});
pop.add(chist);
- final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
- "Show Group Logo", aa[selectedRow].groupRef
- .isShowSequenceLogo());
- cprof.addActionListener(new ActionListener()
+ final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
+ "Show Group Logo",
+ aa[selectedRow].groupRef.isShowSequenceLogo());
+ cprofl.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// view
// can be
// updated.
- aaa.groupRef.setIncludeAllConsSymbols(cprof.getState());
+ aaa.groupRef.setshowSequenceLogo(cprofl.getState());
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
- pop.add(cprof);
+ pop.add(cprofl);
}
else
{
String output = new FormatAdapter().formatSequences("Fasta", seqs,
omitHidden);
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
- new StringSelection(output), Desktop.instance);
+ Toolkit.getDefaultToolkit().getSystemClipboard()
+ .setContents(new StringSelection(output), Desktop.instance);
Vector hiddenColumns = null;
if (av.hasHiddenColumns)
if (aa != null)
{
+ hasHiddenRows = false;
for (int i = 0; i < aa.length; i++)
{
g.setColor(Color.black);
if (!aa[i].visible)
{
+ hasHiddenRows = true;
continue;
}
g.setColor(aa[gg].annotations[0].colour);
}
- g.drawLine(x, y - graphExtras - 3, x
- + fm.stringWidth(aa[gg].label), y - graphExtras - 3);
+ g.drawLine(x, y - graphExtras - 3,
+ x + fm.stringWidth(aa[gg].label), y - graphExtras - 3);
g.setColor(Color.black);
graphExtras += fontHeight + 8;
else if (dragEvent != null && aa != null)
{
g.setColor(Color.lightGray);
- g.drawString(aa[selectedRow].label, dragEvent.getX(), dragEvent
- .getY()
- - scrollOffset);
+ g.drawString(aa[selectedRow].label, dragEvent.getX(),
+ dragEvent.getY() - scrollOffset);
}
if ((aa == null) || (aa.length < 1))