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 jalview.analysis.AlignSeq;
24 import jalview.analysis.AlignmentUtils;
25 import jalview.datamodel.Alignment;
26 import jalview.datamodel.AlignmentAnnotation;
27 import jalview.datamodel.Annotation;
28 import jalview.datamodel.Sequence;
29 import jalview.datamodel.SequenceGroup;
30 import jalview.datamodel.SequenceI;
31 import jalview.io.FormatAdapter;
32 import jalview.util.Comparison;
33 import jalview.util.MessageManager;
35 import java.awt.Color;
36 import java.awt.Dimension;
38 import java.awt.FontMetrics;
39 import java.awt.Graphics;
40 import java.awt.Graphics2D;
41 import java.awt.Image;
42 import java.awt.MediaTracker;
43 import java.awt.RenderingHints;
44 import java.awt.Toolkit;
45 import java.awt.datatransfer.StringSelection;
46 import java.awt.event.ActionEvent;
47 import java.awt.event.ActionListener;
48 import java.awt.event.MouseEvent;
49 import java.awt.event.MouseListener;
50 import java.awt.event.MouseMotionListener;
51 import java.awt.geom.AffineTransform;
52 import java.awt.image.BufferedImage;
53 import java.util.ArrayList;
54 import java.util.Arrays;
55 import java.util.Collections;
56 import java.util.regex.Pattern;
58 import javax.swing.JCheckBoxMenuItem;
59 import javax.swing.JMenuItem;
60 import javax.swing.JPanel;
61 import javax.swing.JPopupMenu;
62 import javax.swing.SwingUtilities;
63 import javax.swing.ToolTipManager;
71 public class AnnotationLabels extends JPanel implements MouseListener,
72 MouseMotionListener, ActionListener
74 private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern.compile("<");
76 String TOGGLE_LABELSCALE = MessageManager.getString("label.scale_label_to_column");
78 String ADDNEW = MessageManager.getString("label.add_new_row");
80 String EDITNAME = MessageManager.getString("label.edit_label_description");
82 String HIDE = MessageManager.getString("label.hide_row");
84 String DELETE = MessageManager.getString("label.delete_row");
86 String SHOWALL = MessageManager.getString("label.show_all_hidden_rows");
88 String OUTPUT_TEXT = MessageManager.getString("label.export_annotation");
90 String COPYCONS_SEQ = MessageManager.getString("label.copy_consensus_sequence");
92 boolean resizePanel = false;
100 boolean resizing = false;
102 MouseEvent dragEvent;
108 private int scrollOffset = 0;
110 Font font = new Font("Arial", Font.PLAIN, 11);
112 private boolean hasHiddenRows;
115 * Creates a new AnnotationLabels object.
120 public AnnotationLabels(AlignmentPanel ap)
124 ToolTipManager.sharedInstance().registerComponent(this);
126 java.net.URL url = getClass().getResource("/images/idwidth.gif");
131 temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);
136 MediaTracker mt = new MediaTracker(this);
137 mt.addImage(temp, 0);
139 } catch (Exception ex)
143 BufferedImage bi = new BufferedImage(temp.getHeight(this),
144 temp.getWidth(this), BufferedImage.TYPE_INT_RGB);
145 Graphics2D g = (Graphics2D) bi.getGraphics();
146 g.rotate(Math.toRadians(90));
147 g.drawImage(temp, 0, -bi.getWidth(this), this);
150 addMouseListener(this);
151 addMouseMotionListener(this);
152 addMouseWheelListener(ap.getAnnotationPanel());
155 public AnnotationLabels(AlignViewport av)
166 public void setScrollOffset(int y)
173 * sets selectedRow to -2 if no annotation preset, -1 if no visible row is at
177 * coordinate position to search for a row
179 void getSelectedRow(int y)
182 AlignmentAnnotation[] aa = ap.av.getAlignment()
183 .getAlignmentAnnotation();
187 for (int i = 0; i < aa.length; i++)
195 height += aa[i].height;
213 public void actionPerformed(ActionEvent evt)
215 AlignmentAnnotation[] aa = ap.av.getAlignment()
216 .getAlignmentAnnotation();
218 if (evt.getActionCommand().equals(ADDNEW))
220 AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
221 null, new Annotation[ap.av.getAlignment().getWidth()]);
223 if (!editLabelDescription(newAnnotation))
228 ap.av.getAlignment().addAnnotation(newAnnotation);
229 ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
231 else if (evt.getActionCommand().equals(EDITNAME))
233 editLabelDescription(aa[selectedRow]);
236 else if (evt.getActionCommand().equals(HIDE))
238 aa[selectedRow].visible = false;
240 else if (evt.getActionCommand().equals(DELETE))
242 ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
244 else if (evt.getActionCommand().equals(SHOWALL))
246 for (int i = 0; i < aa.length; i++)
248 if (!aa[i].visible && aa[i].annotations != null)
250 aa[i].visible = true;
254 else if (evt.getActionCommand().equals(OUTPUT_TEXT))
256 new AnnotationExporter().exportAnnotations(ap,
257 new AlignmentAnnotation[]
258 { aa[selectedRow] });
260 else if (evt.getActionCommand().equals(COPYCONS_SEQ))
262 SequenceI cons = null;
263 if (aa[selectedRow].groupRef != null)
265 cons = aa[selectedRow].groupRef.getConsensusSeq();
269 cons = av.getConsensusSeq();
273 copy_annotseqtoclipboard(cons);
277 else if (evt.getActionCommand().equals(TOGGLE_LABELSCALE))
279 aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
289 protected void refresh()
291 ap.validateAnnotationDimensions(false);
302 boolean editLabelDescription(AlignmentAnnotation annotation)
304 EditNameDialog dialog = new EditNameDialog(annotation.label,
305 annotation.description, " Annotation Name ",
306 "Annotation Description ", "Edit Annotation Name/Description",
314 annotation.label = dialog.getName();
316 String text = dialog.getDescription();
317 if (text != null && text.length() == 0)
321 annotation.description = text;
332 public void mousePressed(MouseEvent evt)
334 getSelectedRow(evt.getY() - getScrollOffset());
344 public void mouseReleased(MouseEvent evt)
346 int start = selectedRow;
347 getSelectedRow(evt.getY() - getScrollOffset());
348 int end = selectedRow;
352 // Swap these annotations
353 AlignmentAnnotation startAA = ap.av.getAlignment()
354 .getAlignmentAnnotation()[start];
357 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
359 AlignmentAnnotation endAA = ap.av.getAlignment()
360 .getAlignmentAnnotation()[end];
362 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
363 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
369 ap.getAnnotationPanel().repaint();
378 public void mouseEntered(MouseEvent evt)
393 public void mouseExited(MouseEvent evt)
395 if (dragEvent == null)
408 public void mouseDragged(MouseEvent evt)
414 Dimension d = ap.annotationScroller.getPreferredSize();
415 int dif = evt.getY() - oldY;
417 dif /= ap.av.getCharHeight();
418 dif *= ap.av.getCharHeight();
420 if ((d.height - dif) > 20)
422 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
424 d = ap.annotationSpaceFillerHolder.getPreferredSize();
425 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
426 d.width, d.height - dif));
427 ap.paintAlignment(true);
444 public void mouseMoved(MouseEvent evt)
446 resizePanel = evt.getY() < 10;
448 getSelectedRow(evt.getY() - getScrollOffset());
451 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
453 AlignmentAnnotation aa = ap.av.getAlignment()
454 .getAlignmentAnnotation()[selectedRow];
456 StringBuffer desc = new StringBuffer();
457 if (aa.description != null
458 && !aa.description.equals("New description"))
460 // TODO: we could refactor and merge this code with the code in
461 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
463 desc.append(aa.getDescription(true).trim());
464 // check to see if the description is an html fragment.
465 if (desc.length() < 6
466 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
468 // clean the description ready for embedding in html
469 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
470 .replaceAll("<"));
471 desc.insert(0, "<html>");
475 // remove terminating html if any
476 int i = desc.substring(desc.length() - 7).toLowerCase()
477 .lastIndexOf("</html>");
480 desc.setLength(desc.length() - 7 + i);
485 desc.append("<br/>");
487 // if (aa.hasProperties())
489 // desc.append("<table>");
490 // for (String prop : aa.getProperties())
492 // desc.append("<tr><td>" + prop + "</td><td>"
493 // + aa.getProperty(prop) + "</td><tr>");
495 // desc.append("</table>");
500 // begin the tooltip's html fragment
501 desc.append("<html>");
504 // TODO: limit precision of score to avoid noise from imprecise
506 // (64.7 becomes 64.7+/some tiny value).
507 desc.append(" Score: " + aa.score);
510 if (desc.length() > 6)
512 desc.append("</html>");
513 this.setToolTipText(desc.toString());
517 this.setToolTipText(null);
528 public void mouseClicked(MouseEvent evt)
530 final AlignmentAnnotation[] aa = ap.av.getAlignment()
531 .getAlignmentAnnotation();
532 if (SwingUtilities.isLeftMouseButton(evt))
534 if (selectedRow > -1 && selectedRow < aa.length)
536 if (aa[selectedRow].groupRef != null)
538 if (evt.getClickCount() >= 2)
540 // todo: make the ap scroll to the selection - not necessary, first
541 // click highlights/scrolls, second selects
542 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
543 ap.av.setSelectionGroup(// new SequenceGroup(
544 aa[selectedRow].groupRef); // );
545 ap.paintAlignment(false);
546 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
547 ap.av.sendSelection();
551 ap.getSeqPanel().ap.getIdPanel()
552 .highlightSearchResults(aa[selectedRow].groupRef
553 .getSequences(null));
557 else if (aa[selectedRow].sequenceRef != null)
559 if (evt.getClickCount() == 1)
561 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(Arrays
562 .asList(new SequenceI[]
563 { aa[selectedRow].sequenceRef }));
565 else if (evt.getClickCount() >= 2)
567 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
568 SequenceGroup sg = ap.av.getSelectionGroup();
571 // we make a copy rather than edit the current selection if no modifiers pressed
572 // see Enhancement JAL-1557
573 if (!(evt.isControlDown() || evt.isShiftDown()))
575 sg = new SequenceGroup(sg);
577 sg.addSequence(aa[selectedRow].sequenceRef, false);
579 if (evt.isControlDown())
581 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
583 // notionally, we should also add intermediate sequences from last added sequence ?
584 sg.addSequence(aa[selectedRow].sequenceRef, true);
588 sg = new SequenceGroup();
590 sg.setEndRes(ap.av.getAlignment().getWidth()-1);
591 sg.addSequence(aa[selectedRow].sequenceRef, false);
593 ap.av.setSelectionGroup(sg);
594 ap.av.sendSelection();
595 ap.paintAlignment(false);
596 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
602 if (!SwingUtilities.isRightMouseButton(evt))
607 JPopupMenu pop = new JPopupMenu(
608 MessageManager.getString("label.annotations"));
609 JMenuItem item = new JMenuItem(ADDNEW);
610 item.addActionListener(this);
615 { // let the user make everything visible again
616 item = new JMenuItem(SHOWALL);
617 item.addActionListener(this);
620 pop.show(this, evt.getX(), evt.getY());
623 item = new JMenuItem(EDITNAME);
624 item.addActionListener(this);
626 item = new JMenuItem(HIDE);
627 item.addActionListener(this);
629 // JAL-1264 hide all sequence-specific annotations of this type
630 if (selectedRow < aa.length)
632 if (aa[selectedRow].sequenceRef != null)
634 final String label = aa[selectedRow].label;
635 JMenuItem hideType = new JMenuItem();
636 String text = MessageManager.getString("label.hide_all") + " " + label;
637 hideType.setText(text);
638 hideType.addActionListener(new ActionListener()
641 public void actionPerformed(ActionEvent e)
643 AlignmentUtils.showOrHideSequenceAnnotations(
644 ap.av.getAlignment(), Collections.singleton(label),
646 // for (AlignmentAnnotation ann : ap.av.getAlignment()
647 // .getAlignmentAnnotation())
649 // if (ann.sequenceRef != null && ann.label != null
650 // && ann.label.equals(label))
652 // ann.visible = false;
661 item = new JMenuItem(DELETE);
662 item.addActionListener(this);
666 item = new JMenuItem(SHOWALL);
667 item.addActionListener(this);
670 item = new JMenuItem(OUTPUT_TEXT);
671 item.addActionListener(this);
673 // TODO: annotation object should be typed for autocalculated/derived
675 if (selectedRow < aa.length)
677 final String label = aa[selectedRow].label;
678 if (!aa[selectedRow].autoCalculated)
680 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
682 // display formatting settings for this row.
684 // av and sequencegroup need to implement same interface for
685 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
686 aa[selectedRow].scaleColLabel);
687 item.addActionListener(this);
691 else if (label.indexOf("Consensus") > -1)
694 // av and sequencegroup need to implement same interface for
695 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
696 MessageManager.getString("label.ignore_gaps_consensus"),
697 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
698 .getIgnoreGapsConsensus() : ap.av
699 .isIgnoreGapsConsensus());
700 final AlignmentAnnotation aaa = aa[selectedRow];
701 cbmi.addActionListener(new ActionListener()
703 public void actionPerformed(ActionEvent e)
705 if (aaa.groupRef != null)
707 // TODO: pass on reference to ap so the view can be updated.
708 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
709 ap.getAnnotationPanel().paint(ap.getAnnotationPanel().getGraphics());
713 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
718 // av and sequencegroup need to implement same interface for
719 if (aaa.groupRef != null)
721 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
722 MessageManager.getString("label.show_group_histogram"),
723 aa[selectedRow].groupRef.isShowConsensusHistogram());
724 chist.addActionListener(new ActionListener()
726 public void actionPerformed(ActionEvent e)
728 // TODO: pass on reference
734 aaa.groupRef.setShowConsensusHistogram(chist.getState());
736 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
740 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
741 MessageManager.getString("label.show_group_logo"),
742 aa[selectedRow].groupRef.isShowSequenceLogo());
743 cprofl.addActionListener(new ActionListener()
745 public void actionPerformed(ActionEvent e)
747 // TODO: pass on reference
753 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
755 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
759 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
760 MessageManager.getString("label.normalise_group_logo"),
761 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
762 cproflnorm.addActionListener(new ActionListener()
764 public void actionPerformed(ActionEvent e)
767 // TODO: pass on reference
773 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
774 // automatically enable logo display if we're clicked
775 aaa.groupRef.setshowSequenceLogo(true);
777 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
784 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
785 MessageManager.getString("label.show_histogram"), av.isShowConsensusHistogram());
786 chist.addActionListener(new ActionListener()
788 public void actionPerformed(ActionEvent e)
790 // TODO: pass on reference
796 av.setShowConsensusHistogram(chist.getState());
797 ap.alignFrame.setMenusForViewport();
799 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
803 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
804 MessageManager.getString("label.show_logo"), av.isShowSequenceLogo());
805 cprof.addActionListener(new ActionListener()
807 public void actionPerformed(ActionEvent e)
809 // TODO: pass on reference
815 av.setShowSequenceLogo(cprof.getState());
816 ap.alignFrame.setMenusForViewport();
818 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
822 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
823 MessageManager.getString("label.normalise_logo"), av.isNormaliseSequenceLogo());
824 cprofnorm.addActionListener(new ActionListener()
826 public void actionPerformed(ActionEvent e)
828 // TODO: pass on reference
834 av.setShowSequenceLogo(true);
835 av.setNormaliseSequenceLogo(cprofnorm.getState());
836 ap.alignFrame.setMenusForViewport();
838 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
843 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
844 consclipbrd.addActionListener(this);
845 pop.add(consclipbrd);
848 pop.show(this, evt.getX(), evt.getY());
852 * do a single sequence copy to jalview and the system clipboard
855 * sequence to be copied to clipboard
857 protected void copy_annotseqtoclipboard(SequenceI sq)
859 SequenceI[] seqs = new SequenceI[]
861 String[] omitHidden = null;
862 SequenceI[] dseqs = new SequenceI[]
863 { sq.getDatasetSequence() };
864 if (dseqs[0] == null)
866 dseqs[0] = new Sequence(sq);
867 dseqs[0].setSequence(AlignSeq.extractGaps(
868 Comparison.GapChars, sq.getSequenceAsString()));
870 sq.setDatasetSequence(dseqs[0]);
872 Alignment ds = new Alignment(dseqs);
873 if (av.hasHiddenColumns())
875 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
876 sq.getLength(), seqs);
879 String output = new FormatAdapter().formatSequences("Fasta", seqs,
882 Toolkit.getDefaultToolkit().getSystemClipboard()
883 .setContents(new StringSelection(output), Desktop.instance);
885 ArrayList<int[]> hiddenColumns = null;
886 if (av.hasHiddenColumns())
888 hiddenColumns = new ArrayList<int[]>();
889 for (int[] region : av.getColumnSelection().getHiddenColumns())
891 hiddenColumns.add(new int[]
892 { region[0], region[1] });
896 Desktop.jalviewClipboard = new Object[]
897 { seqs, ds, // what is the dataset of a consensus sequence ? need to flag
898 // sequence as special.
908 public void paintComponent(Graphics g)
911 int width = getWidth();
914 width = ap.calculateIdWidth().width + 4;
917 Graphics2D g2 = (Graphics2D) g;
920 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
921 RenderingHints.VALUE_ANTIALIAS_ON);
924 drawComponent(g2, true, width);
929 * Draw the full set of annotation Labels for the alignment at the given
933 * Graphics2D instance (needed for font scaling)
935 * Width for scaling labels
938 public void drawComponent(Graphics g, int width)
940 drawComponent(g, false, width);
943 private final boolean debugRedraw = false;
946 * Draw the full set of annotation Labels for the alignment at the given
950 * Graphics2D instance (needed for font scaling)
952 * - true indicates that only current visible area needs to be
955 * Width for scaling labels
957 public void drawComponent(Graphics g, boolean clip, int width)
959 if (av.getFont().getSize() < 10)
965 g.setFont(av.getFont());
968 FontMetrics fm = g.getFontMetrics(g.getFont());
969 g.setColor(Color.white);
970 g.fillRect(0, 0, getWidth(), getHeight());
972 g.translate(0, getScrollOffset());
973 g.setColor(Color.black);
975 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
976 int fontHeight = g.getFont().getSize();
981 Font baseFont = g.getFont();
982 FontMetrics baseMetrics = fm;
983 int ofontH = fontHeight;
986 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap.getAnnotationPanel()
987 .getVisibleVRange() : null;
988 if (clip && visr != null)
993 boolean visible = true, before = false, after = false;
996 hasHiddenRows = false;
998 for (int i = 0; i < aa.length; i++)
1003 hasHiddenRows = true;
1016 System.out.println("before vis: " + i);
1020 // don't draw what isn't visible
1023 if (olY > visHeight)
1030 System.out.println("Scroll offset: " + sOffset
1031 + " after vis: " + i);
1035 // don't draw what isn't visible
1039 g.setColor(Color.black);
1041 offset = -aa[i].height / 2;
1045 offset += fm.getHeight() / 2;
1046 offset -= fm.getDescent();
1050 offset += fm.getDescent();
1053 x = width - fm.stringWidth(aa[i].label) - 3;
1055 if (aa[i].graphGroup > -1)
1058 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1059 // computed efficiently for all visible labels
1060 for (int gg = 0; gg < aa.length; gg++)
1062 if (aa[gg].graphGroup == aa[i].graphGroup)
1067 if (groupSize * (fontHeight + 8) < aa[i].height)
1069 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1073 // scale font to fit
1074 float h = aa[i].height / (float) groupSize, s;
1081 fontHeight = -8 + (int) h;
1082 s = ((float) fontHeight) / (float) ofontH;
1083 Font f = baseFont.deriveFont(AffineTransform
1084 .getScaleInstance(s, s));
1086 fm = g.getFontMetrics();
1087 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1092 for (int gg = 0; gg < aa.length; gg++)
1094 if (aa[gg].graphGroup == aa[i].graphGroup)
1096 x = width - fm.stringWidth(aa[gg].label) - 3;
1097 g.drawString(aa[gg].label, x, y - graphExtras);
1099 if (aa[gg]._linecolour != null)
1102 g.setColor(aa[gg]._linecolour);
1103 g.drawLine(x, y - graphExtras + 3,
1104 x + fm.stringWidth(aa[gg].label), y - graphExtras
1108 g.setColor(Color.black);
1109 graphExtras += fontHeight + 8;
1113 g.setFont(baseFont);
1115 fontHeight = ofontH;
1119 g.drawString(aa[i].label, x, y + offset);
1126 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1128 else if (dragEvent != null && aa != null)
1130 g.setColor(Color.lightGray);
1131 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1132 dragEvent.getY() - getScrollOffset());
1135 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1137 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1138 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1143 public int getScrollOffset()
1145 return scrollOffset;