2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.Color;
24 import java.awt.Dimension;
26 import java.awt.FontMetrics;
27 import java.awt.Graphics;
28 import java.awt.Graphics2D;
29 import java.awt.Image;
30 import java.awt.MediaTracker;
31 import java.awt.RenderingHints;
32 import java.awt.Toolkit;
33 import java.awt.datatransfer.StringSelection;
34 import java.awt.event.ActionEvent;
35 import java.awt.event.ActionListener;
36 import java.awt.event.MouseEvent;
37 import java.awt.event.MouseListener;
38 import java.awt.event.MouseMotionListener;
39 import java.awt.geom.AffineTransform;
40 import java.awt.image.BufferedImage;
41 import java.util.ArrayList;
42 import java.util.Arrays;
43 import java.util.Collections;
44 import java.util.regex.Pattern;
46 import javax.swing.JCheckBoxMenuItem;
47 import javax.swing.JMenuItem;
48 import javax.swing.JPanel;
49 import javax.swing.JPopupMenu;
50 import javax.swing.SwingUtilities;
51 import javax.swing.ToolTipManager;
53 import jalview.analysis.AlignmentUtils;
54 import jalview.datamodel.Alignment;
55 import jalview.datamodel.AlignmentAnnotation;
56 import jalview.datamodel.Annotation;
57 import jalview.datamodel.Sequence;
58 import jalview.datamodel.SequenceGroup;
59 import jalview.datamodel.SequenceI;
60 import jalview.io.FormatAdapter;
61 import jalview.util.MessageManager;
69 public class AnnotationLabels extends JPanel implements MouseListener,
70 MouseMotionListener, ActionListener
72 private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern.compile("<");
74 String TOGGLE_LABELSCALE = MessageManager.getString("label.scale_label_to_column");
76 String ADDNEW = MessageManager.getString("label.add_new_row");
78 String EDITNAME = MessageManager.getString("label.edit_label_description");
80 String HIDE = MessageManager.getString("label.hide_row");
82 String DELETE = MessageManager.getString("label.delete_row");
84 String SHOWALL = MessageManager.getString("label.show_all_hidden_rows");
86 String OUTPUT_TEXT = MessageManager.getString("label.export_annotation");
88 String COPYCONS_SEQ = MessageManager.getString("label.copy_consensus_sequence");
90 boolean resizePanel = false;
98 boolean resizing = false;
100 MouseEvent dragEvent;
106 private int scrollOffset = 0;
108 Font font = new Font("Arial", Font.PLAIN, 11);
110 private boolean hasHiddenRows;
113 * Creates a new AnnotationLabels object.
118 public AnnotationLabels(AlignmentPanel ap)
122 ToolTipManager.sharedInstance().registerComponent(this);
124 java.net.URL url = getClass().getResource("/images/idwidth.gif");
129 temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);
134 MediaTracker mt = new MediaTracker(this);
135 mt.addImage(temp, 0);
137 } catch (Exception ex)
141 BufferedImage bi = new BufferedImage(temp.getHeight(this),
142 temp.getWidth(this), BufferedImage.TYPE_INT_RGB);
143 Graphics2D g = (Graphics2D) bi.getGraphics();
144 g.rotate(Math.toRadians(90));
145 g.drawImage(temp, 0, -bi.getWidth(this), this);
148 addMouseListener(this);
149 addMouseMotionListener(this);
150 addMouseWheelListener(ap.getAnnotationPanel());
153 public AnnotationLabels(AlignViewport av)
164 public void setScrollOffset(int y)
171 * sets selectedRow to -2 if no annotation preset, -1 if no visible row is at
175 * coordinate position to search for a row
177 void getSelectedRow(int y)
180 AlignmentAnnotation[] aa = ap.av.getAlignment()
181 .getAlignmentAnnotation();
185 for (int i = 0; i < aa.length; i++)
193 height += aa[i].height;
211 public void actionPerformed(ActionEvent evt)
213 AlignmentAnnotation[] aa = ap.av.getAlignment()
214 .getAlignmentAnnotation();
216 if (evt.getActionCommand().equals(ADDNEW))
218 AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
219 null, new Annotation[ap.av.getAlignment().getWidth()]);
221 if (!editLabelDescription(newAnnotation))
226 ap.av.getAlignment().addAnnotation(newAnnotation);
227 ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
229 else if (evt.getActionCommand().equals(EDITNAME))
231 editLabelDescription(aa[selectedRow]);
234 else if (evt.getActionCommand().equals(HIDE))
236 aa[selectedRow].visible = false;
238 else if (evt.getActionCommand().equals(DELETE))
240 ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
242 else if (evt.getActionCommand().equals(SHOWALL))
244 for (int i = 0; i < aa.length; i++)
246 if (!aa[i].visible && aa[i].annotations != null)
248 aa[i].visible = true;
252 else if (evt.getActionCommand().equals(OUTPUT_TEXT))
254 new AnnotationExporter().exportAnnotations(ap,
255 new AlignmentAnnotation[]
256 { aa[selectedRow] });
258 else if (evt.getActionCommand().equals(COPYCONS_SEQ))
260 SequenceI cons = null;
261 if (aa[selectedRow].groupRef != null)
263 cons = aa[selectedRow].groupRef.getConsensusSeq();
267 cons = av.getConsensusSeq();
271 copy_annotseqtoclipboard(cons);
275 else if (evt.getActionCommand().equals(TOGGLE_LABELSCALE))
277 aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
287 protected void refresh()
289 ap.validateAnnotationDimensions(false);
300 boolean editLabelDescription(AlignmentAnnotation annotation)
302 EditNameDialog dialog = new EditNameDialog(annotation.label,
303 annotation.description, " Annotation Name ",
304 "Annotation Description ", "Edit Annotation Name/Description",
312 annotation.label = dialog.getName();
314 String text = dialog.getDescription();
315 if (text != null && text.length() == 0)
319 annotation.description = text;
330 public void mousePressed(MouseEvent evt)
332 getSelectedRow(evt.getY() - getScrollOffset());
342 public void mouseReleased(MouseEvent evt)
344 int start = selectedRow;
345 getSelectedRow(evt.getY() - getScrollOffset());
346 int end = selectedRow;
350 // Swap these annotations
351 AlignmentAnnotation startAA = ap.av.getAlignment()
352 .getAlignmentAnnotation()[start];
355 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
357 AlignmentAnnotation endAA = ap.av.getAlignment()
358 .getAlignmentAnnotation()[end];
360 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
361 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
367 ap.getAnnotationPanel().repaint();
376 public void mouseEntered(MouseEvent evt)
391 public void mouseExited(MouseEvent evt)
393 if (dragEvent == null)
406 public void mouseDragged(MouseEvent evt)
412 Dimension d = ap.annotationScroller.getPreferredSize();
413 int dif = evt.getY() - oldY;
415 dif /= ap.av.getCharHeight();
416 dif *= ap.av.getCharHeight();
418 if ((d.height - dif) > 20)
420 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
422 d = ap.annotationSpaceFillerHolder.getPreferredSize();
423 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
424 d.width, d.height - dif));
425 ap.paintAlignment(true);
442 public void mouseMoved(MouseEvent evt)
444 resizePanel = evt.getY() < 10;
446 getSelectedRow(evt.getY() - getScrollOffset());
449 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
451 AlignmentAnnotation aa = ap.av.getAlignment()
452 .getAlignmentAnnotation()[selectedRow];
454 StringBuffer desc = new StringBuffer();
455 if (aa.description != null
456 && !aa.description.equals("New description"))
458 // TODO: we could refactor and merge this code with the code in
459 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
461 desc.append(aa.getDescription(true).trim());
462 // check to see if the description is an html fragment.
463 if (desc.length() < 6
464 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
466 // clean the description ready for embedding in html
467 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
468 .replaceAll("<"));
469 desc.insert(0, "<html>");
473 // remove terminating html if any
474 int i = desc.substring(desc.length() - 7).toLowerCase()
475 .lastIndexOf("</html>");
478 desc.setLength(desc.length() - 7 + i);
483 desc.append("<br/>");
485 // if (aa.hasProperties())
487 // desc.append("<table>");
488 // for (String prop : aa.getProperties())
490 // desc.append("<tr><td>" + prop + "</td><td>"
491 // + aa.getProperty(prop) + "</td><tr>");
493 // desc.append("</table>");
498 // begin the tooltip's html fragment
499 desc.append("<html>");
502 // TODO: limit precision of score to avoid noise from imprecise
504 // (64.7 becomes 64.7+/some tiny value).
505 desc.append(" Score: " + aa.score);
508 if (desc.length() > 6)
510 desc.append("</html>");
511 this.setToolTipText(desc.toString());
515 this.setToolTipText(null);
526 public void mouseClicked(MouseEvent evt)
528 final AlignmentAnnotation[] aa = ap.av.getAlignment()
529 .getAlignmentAnnotation();
530 if (SwingUtilities.isLeftMouseButton(evt))
532 if (selectedRow > -1 && selectedRow < aa.length)
534 if (aa[selectedRow].groupRef != null)
536 if (evt.getClickCount() >= 2)
538 // todo: make the ap scroll to the selection - not necessary, first
539 // click highlights/scrolls, second selects
540 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
541 ap.av.setSelectionGroup(// new SequenceGroup(
542 aa[selectedRow].groupRef); // );
543 ap.paintAlignment(false);
544 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
545 ap.av.sendSelection();
549 ap.getSeqPanel().ap.getIdPanel()
550 .highlightSearchResults(aa[selectedRow].groupRef
551 .getSequences(null));
555 else if (aa[selectedRow].sequenceRef != null)
557 if (evt.getClickCount() == 1)
559 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(Arrays
560 .asList(new SequenceI[]
561 { aa[selectedRow].sequenceRef }));
563 else if (evt.getClickCount() >= 2)
565 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
566 SequenceGroup sg = ap.av.getSelectionGroup();
569 // we make a copy rather than edit the current selection if no modifiers pressed
570 // see Enhancement JAL-1557
571 if (!(evt.isControlDown() || evt.isShiftDown()))
573 sg = new SequenceGroup(sg);
575 sg.addSequence(aa[selectedRow].sequenceRef, false);
577 if (evt.isControlDown())
579 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
581 // notionally, we should also add intermediate sequences from last added sequence ?
582 sg.addSequence(aa[selectedRow].sequenceRef, true);
586 sg = new SequenceGroup();
588 sg.setEndRes(ap.av.getAlignment().getWidth()-1);
589 sg.addSequence(aa[selectedRow].sequenceRef, false);
591 ap.av.setSelectionGroup(sg);
592 ap.av.sendSelection();
593 ap.paintAlignment(false);
594 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
600 if (!SwingUtilities.isRightMouseButton(evt))
605 JPopupMenu pop = new JPopupMenu(
606 MessageManager.getString("label.annotations"));
607 JMenuItem item = new JMenuItem(ADDNEW);
608 item.addActionListener(this);
613 { // let the user make everything visible again
614 item = new JMenuItem(SHOWALL);
615 item.addActionListener(this);
618 pop.show(this, evt.getX(), evt.getY());
621 item = new JMenuItem(EDITNAME);
622 item.addActionListener(this);
624 item = new JMenuItem(HIDE);
625 item.addActionListener(this);
627 // JAL-1264 hide all sequence-specific annotations of this type
628 if (selectedRow < aa.length)
630 if (aa[selectedRow].sequenceRef != null)
632 final String label = aa[selectedRow].label;
633 JMenuItem hideType = new JMenuItem();
634 String text = MessageManager.getString("label.hide_all") + " " + label;
635 hideType.setText(text);
636 hideType.addActionListener(new ActionListener()
639 public void actionPerformed(ActionEvent e)
641 AlignmentUtils.showOrHideSequenceAnnotations(
642 ap.av.getAlignment(), Collections.singleton(label),
644 // for (AlignmentAnnotation ann : ap.av.getAlignment()
645 // .getAlignmentAnnotation())
647 // if (ann.sequenceRef != null && ann.label != null
648 // && ann.label.equals(label))
650 // ann.visible = false;
659 item = new JMenuItem(DELETE);
660 item.addActionListener(this);
664 item = new JMenuItem(SHOWALL);
665 item.addActionListener(this);
668 item = new JMenuItem(OUTPUT_TEXT);
669 item.addActionListener(this);
671 // TODO: annotation object should be typed for autocalculated/derived
673 if (selectedRow < aa.length)
675 final String label = aa[selectedRow].label;
676 if (!aa[selectedRow].autoCalculated)
678 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
680 // display formatting settings for this row.
682 // av and sequencegroup need to implement same interface for
683 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
684 aa[selectedRow].scaleColLabel);
685 item.addActionListener(this);
689 else if (label.indexOf("Consensus") > -1)
692 // av and sequencegroup need to implement same interface for
693 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
694 MessageManager.getString("label.ignore_gaps_consensus"),
695 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
696 .getIgnoreGapsConsensus() : ap.av
697 .isIgnoreGapsConsensus());
698 final AlignmentAnnotation aaa = aa[selectedRow];
699 cbmi.addActionListener(new ActionListener()
701 public void actionPerformed(ActionEvent e)
703 if (aaa.groupRef != null)
705 // TODO: pass on reference to ap so the view can be updated.
706 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
707 ap.getAnnotationPanel().paint(ap.getAnnotationPanel().getGraphics());
711 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
716 // av and sequencegroup need to implement same interface for
717 if (aaa.groupRef != null)
719 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
720 MessageManager.getString("label.show_group_histogram"),
721 aa[selectedRow].groupRef.isShowConsensusHistogram());
722 chist.addActionListener(new ActionListener()
724 public void actionPerformed(ActionEvent e)
726 // TODO: pass on reference
732 aaa.groupRef.setShowConsensusHistogram(chist.getState());
734 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
738 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
739 MessageManager.getString("label.show_group_logo"),
740 aa[selectedRow].groupRef.isShowSequenceLogo());
741 cprofl.addActionListener(new ActionListener()
743 public void actionPerformed(ActionEvent e)
745 // TODO: pass on reference
751 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
753 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
757 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
758 MessageManager.getString("label.normalise_group_logo"),
759 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
760 cproflnorm.addActionListener(new ActionListener()
762 public void actionPerformed(ActionEvent e)
765 // TODO: pass on reference
771 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
772 // automatically enable logo display if we're clicked
773 aaa.groupRef.setshowSequenceLogo(true);
775 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
782 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
783 MessageManager.getString("label.show_histogram"), av.isShowConsensusHistogram());
784 chist.addActionListener(new ActionListener()
786 public void actionPerformed(ActionEvent e)
788 // TODO: pass on reference
794 av.setShowConsensusHistogram(chist.getState());
795 ap.alignFrame.setMenusForViewport();
797 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
801 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
802 MessageManager.getString("label.show_logo"), av.isShowSequenceLogo());
803 cprof.addActionListener(new ActionListener()
805 public void actionPerformed(ActionEvent e)
807 // TODO: pass on reference
813 av.setShowSequenceLogo(cprof.getState());
814 ap.alignFrame.setMenusForViewport();
816 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
820 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
821 MessageManager.getString("label.normalise_logo"), av.isNormaliseSequenceLogo());
822 cprofnorm.addActionListener(new ActionListener()
824 public void actionPerformed(ActionEvent e)
826 // TODO: pass on reference
832 av.setShowSequenceLogo(true);
833 av.setNormaliseSequenceLogo(cprofnorm.getState());
834 ap.alignFrame.setMenusForViewport();
836 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
841 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
842 consclipbrd.addActionListener(this);
843 pop.add(consclipbrd);
846 pop.show(this, evt.getX(), evt.getY());
850 * do a single sequence copy to jalview and the system clipboard
853 * sequence to be copied to clipboard
855 protected void copy_annotseqtoclipboard(SequenceI sq)
857 SequenceI[] seqs = new SequenceI[]
859 String[] omitHidden = null;
860 SequenceI[] dseqs = new SequenceI[]
861 { sq.getDatasetSequence() };
862 if (dseqs[0] == null)
864 dseqs[0] = new Sequence(sq);
865 dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(
866 jalview.util.Comparison.GapChars, sq.getSequenceAsString()));
868 sq.setDatasetSequence(dseqs[0]);
870 Alignment ds = new Alignment(dseqs);
871 if (av.hasHiddenColumns())
873 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
874 sq.getLength(), seqs);
877 String output = new FormatAdapter().formatSequences("Fasta", seqs,
880 Toolkit.getDefaultToolkit().getSystemClipboard()
881 .setContents(new StringSelection(output), Desktop.instance);
883 ArrayList<int[]> hiddenColumns = null;
884 if (av.hasHiddenColumns())
886 hiddenColumns = new ArrayList<int[]>();
887 for (int[] region : av.getColumnSelection().getHiddenColumns())
889 hiddenColumns.add(new int[]
890 { region[0], region[1] });
894 Desktop.jalviewClipboard = new Object[]
895 { seqs, ds, // what is the dataset of a consensus sequence ? need to flag
896 // sequence as special.
906 public void paintComponent(Graphics g)
909 int width = getWidth();
912 width = ap.calculateIdWidth().width + 4;
915 Graphics2D g2 = (Graphics2D) g;
918 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
919 RenderingHints.VALUE_ANTIALIAS_ON);
922 drawComponent(g2, true, width);
927 * Draw the full set of annotation Labels for the alignment at the given
931 * Graphics2D instance (needed for font scaling)
933 * Width for scaling labels
936 public void drawComponent(Graphics g, int width)
938 drawComponent(g, false, width);
941 private final boolean debugRedraw = false;
944 * Draw the full set of annotation Labels for the alignment at the given
948 * Graphics2D instance (needed for font scaling)
950 * - true indicates that only current visible area needs to be
953 * Width for scaling labels
955 public void drawComponent(Graphics g, boolean clip, int width)
957 if (av.getFont().getSize() < 10)
963 g.setFont(av.getFont());
966 FontMetrics fm = g.getFontMetrics(g.getFont());
967 g.setColor(Color.white);
968 g.fillRect(0, 0, getWidth(), getHeight());
970 g.translate(0, getScrollOffset());
971 g.setColor(Color.black);
973 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
974 int fontHeight = g.getFont().getSize();
979 Font baseFont = g.getFont();
980 FontMetrics baseMetrics = fm;
981 int ofontH = fontHeight;
984 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap.getAnnotationPanel()
985 .getVisibleVRange() : null;
986 if (clip && visr != null)
991 boolean visible = true, before = false, after = false;
994 hasHiddenRows = false;
996 for (int i = 0; i < aa.length; i++)
1001 hasHiddenRows = true;
1014 System.out.println("before vis: " + i);
1018 // don't draw what isn't visible
1021 if (olY > visHeight)
1028 System.out.println("Scroll offset: " + sOffset
1029 + " after vis: " + i);
1033 // don't draw what isn't visible
1037 g.setColor(Color.black);
1039 offset = -aa[i].height / 2;
1043 offset += fm.getHeight() / 2;
1044 offset -= fm.getDescent();
1048 offset += fm.getDescent();
1051 x = width - fm.stringWidth(aa[i].label) - 3;
1053 if (aa[i].graphGroup > -1)
1056 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1057 // computed efficiently for all visible labels
1058 for (int gg = 0; gg < aa.length; gg++)
1060 if (aa[gg].graphGroup == aa[i].graphGroup)
1065 if (groupSize * (fontHeight + 8) < aa[i].height)
1067 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1071 // scale font to fit
1072 float h = aa[i].height / (float) groupSize, s;
1079 fontHeight = -8 + (int) h;
1080 s = ((float) fontHeight) / (float) ofontH;
1081 Font f = baseFont.deriveFont(AffineTransform
1082 .getScaleInstance(s, s));
1084 fm = g.getFontMetrics();
1085 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1090 for (int gg = 0; gg < aa.length; gg++)
1092 if (aa[gg].graphGroup == aa[i].graphGroup)
1094 x = width - fm.stringWidth(aa[gg].label) - 3;
1095 g.drawString(aa[gg].label, x, y - graphExtras);
1097 if (aa[gg]._linecolour != null)
1100 g.setColor(aa[gg]._linecolour);
1101 g.drawLine(x, y - graphExtras + 3,
1102 x + fm.stringWidth(aa[gg].label), y - graphExtras
1106 g.setColor(Color.black);
1107 graphExtras += fontHeight + 8;
1111 g.setFont(baseFont);
1113 fontHeight = ofontH;
1117 g.drawString(aa[i].label, x, y + offset);
1124 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1126 else if (dragEvent != null && aa != null)
1128 g.setColor(Color.lightGray);
1129 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1130 dragEvent.getY() - getScrollOffset());
1133 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1135 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1136 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1141 public int getScrollOffset()
1143 return scrollOffset;