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.AlignmentUtils;
24 import jalview.datamodel.Alignment;
25 import jalview.datamodel.AlignmentAnnotation;
26 import jalview.datamodel.Annotation;
27 import jalview.datamodel.Sequence;
28 import jalview.datamodel.SequenceGroup;
29 import jalview.datamodel.SequenceI;
30 import jalview.io.FormatAdapter;
31 import jalview.util.MessageManager;
33 import java.awt.Color;
34 import java.awt.Dimension;
36 import java.awt.FontMetrics;
37 import java.awt.Graphics;
38 import java.awt.Graphics2D;
39 import java.awt.Image;
40 import java.awt.MediaTracker;
41 import java.awt.RenderingHints;
42 import java.awt.Toolkit;
43 import java.awt.datatransfer.StringSelection;
44 import java.awt.event.ActionEvent;
45 import java.awt.event.ActionListener;
46 import java.awt.event.MouseEvent;
47 import java.awt.event.MouseListener;
48 import java.awt.event.MouseMotionListener;
49 import java.awt.geom.AffineTransform;
50 import java.awt.image.BufferedImage;
51 import java.util.ArrayList;
52 import java.util.Arrays;
53 import java.util.Collections;
54 import java.util.List;
55 import java.util.regex.Pattern;
57 import javax.swing.JCheckBoxMenuItem;
58 import javax.swing.JMenuItem;
59 import javax.swing.JPanel;
60 import javax.swing.JPopupMenu;
61 import javax.swing.SwingUtilities;
62 import javax.swing.ToolTipManager;
70 public class AnnotationLabels extends JPanel implements MouseListener,
71 MouseMotionListener, ActionListener
73 private static final Pattern LEFT_ANGLE_BRACKET_PATTERN = Pattern
76 String TOGGLE_LABELSCALE = MessageManager
77 .getString("label.scale_label_to_column");
79 String ADDNEW = MessageManager.getString("label.add_new_row");
81 String EDITNAME = MessageManager
82 .getString("label.edit_label_description");
84 String HIDE = MessageManager.getString("label.hide_row");
86 String DELETE = MessageManager.getString("label.delete_row");
88 String SHOWALL = MessageManager.getString("label.show_all_hidden_rows");
90 String OUTPUT_TEXT = MessageManager.getString("label.export_annotation");
92 String COPYCONS_SEQ = MessageManager
93 .getString("label.copy_consensus_sequence");
95 boolean resizePanel = false;
103 boolean resizing = false;
105 MouseEvent dragEvent;
111 private int scrollOffset = 0;
113 Font font = new Font("Arial", Font.PLAIN, 11);
115 private boolean hasHiddenRows;
118 * Creates a new AnnotationLabels object.
123 public AnnotationLabels(AlignmentPanel ap)
127 ToolTipManager.sharedInstance().registerComponent(this);
129 java.net.URL url = getClass().getResource("/images/idwidth.gif");
134 temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);
139 MediaTracker mt = new MediaTracker(this);
140 mt.addImage(temp, 0);
142 } catch (Exception ex)
146 BufferedImage bi = new BufferedImage(temp.getHeight(this),
147 temp.getWidth(this), BufferedImage.TYPE_INT_RGB);
148 Graphics2D g = (Graphics2D) bi.getGraphics();
149 g.rotate(Math.toRadians(90));
150 g.drawImage(temp, 0, -bi.getWidth(this), this);
153 addMouseListener(this);
154 addMouseMotionListener(this);
155 addMouseWheelListener(ap.getAnnotationPanel());
158 public AnnotationLabels(AlignViewport av)
169 public void setScrollOffset(int y)
176 * sets selectedRow to -2 if no annotation preset, -1 if no visible row is at
180 * coordinate position to search for a row
182 void getSelectedRow(int y)
185 AlignmentAnnotation[] aa = ap.av.getAlignment()
186 .getAlignmentAnnotation();
190 for (int i = 0; i < aa.length; i++)
198 height += aa[i].height;
216 public void actionPerformed(ActionEvent evt)
218 AlignmentAnnotation[] aa = ap.av.getAlignment()
219 .getAlignmentAnnotation();
221 if (evt.getActionCommand().equals(ADDNEW))
223 AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
224 null, new Annotation[ap.av.getAlignment().getWidth()]);
226 if (!editLabelDescription(newAnnotation))
231 ap.av.getAlignment().addAnnotation(newAnnotation);
232 ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
234 else if (evt.getActionCommand().equals(EDITNAME))
236 editLabelDescription(aa[selectedRow]);
239 else if (evt.getActionCommand().equals(HIDE))
241 aa[selectedRow].visible = false;
243 else if (evt.getActionCommand().equals(DELETE))
245 ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
247 else if (evt.getActionCommand().equals(SHOWALL))
249 for (int i = 0; i < aa.length; i++)
251 if (!aa[i].visible && aa[i].annotations != null)
253 aa[i].visible = true;
257 else if (evt.getActionCommand().equals(OUTPUT_TEXT))
259 new AnnotationExporter().exportAnnotations(ap,
260 new AlignmentAnnotation[] { aa[selectedRow] });
262 else if (evt.getActionCommand().equals(COPYCONS_SEQ))
264 SequenceI cons = null;
265 if (aa[selectedRow].groupRef != null)
267 cons = aa[selectedRow].groupRef.getConsensusSeq();
271 cons = av.getConsensusSeq();
275 copy_annotseqtoclipboard(cons);
279 else if (evt.getActionCommand().equals(TOGGLE_LABELSCALE))
281 aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
291 protected void refresh()
293 ap.validateAnnotationDimensions(false);
304 boolean editLabelDescription(AlignmentAnnotation annotation)
306 EditNameDialog dialog = new EditNameDialog(annotation.label,
307 annotation.description, " Annotation Name ",
308 "Annotation Description ", "Edit Annotation Name/Description",
316 annotation.label = dialog.getName();
318 String text = dialog.getDescription();
319 if (text != null && text.length() == 0)
323 annotation.description = text;
334 public void mousePressed(MouseEvent evt)
336 getSelectedRow(evt.getY() - getScrollOffset());
346 public void mouseReleased(MouseEvent evt)
348 int start = selectedRow;
349 getSelectedRow(evt.getY() - getScrollOffset());
350 int end = selectedRow;
354 // Swap these annotations
355 AlignmentAnnotation startAA = ap.av.getAlignment()
356 .getAlignmentAnnotation()[start];
359 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
361 AlignmentAnnotation endAA = ap.av.getAlignment()
362 .getAlignmentAnnotation()[end];
364 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
365 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
371 ap.getAnnotationPanel().repaint();
380 public void mouseEntered(MouseEvent evt)
395 public void mouseExited(MouseEvent evt)
397 if (dragEvent == null)
410 public void mouseDragged(MouseEvent evt)
416 Dimension d = ap.annotationScroller.getPreferredSize();
417 int dif = evt.getY() - oldY;
419 dif /= ap.av.getCharHeight();
420 dif *= ap.av.getCharHeight();
422 if ((d.height - dif) > 20)
424 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
426 d = ap.annotationSpaceFillerHolder.getPreferredSize();
427 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
428 d.width, d.height - dif));
429 ap.paintAlignment(true);
446 public void mouseMoved(MouseEvent evt)
448 resizePanel = evt.getY() < 10;
450 getSelectedRow(evt.getY() - getScrollOffset());
453 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
455 AlignmentAnnotation aa = ap.av.getAlignment()
456 .getAlignmentAnnotation()[selectedRow];
458 StringBuffer desc = new StringBuffer();
459 if (aa.description != null
460 && !aa.description.equals("New description"))
462 // TODO: we could refactor and merge this code with the code in
463 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
465 desc.append(aa.getDescription(true).trim());
466 // check to see if the description is an html fragment.
467 if (desc.length() < 6
468 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
470 // clean the description ready for embedding in html
471 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
472 .replaceAll("<"));
473 desc.insert(0, "<html>");
477 // remove terminating html if any
478 int i = desc.substring(desc.length() - 7).toLowerCase()
479 .lastIndexOf("</html>");
482 desc.setLength(desc.length() - 7 + i);
487 desc.append("<br/>");
489 // if (aa.hasProperties())
491 // desc.append("<table>");
492 // for (String prop : aa.getProperties())
494 // desc.append("<tr><td>" + prop + "</td><td>"
495 // + aa.getProperty(prop) + "</td><tr>");
497 // desc.append("</table>");
502 // begin the tooltip's html fragment
503 desc.append("<html>");
506 // TODO: limit precision of score to avoid noise from imprecise
508 // (64.7 becomes 64.7+/some tiny value).
509 desc.append(" Score: " + aa.score);
512 if (desc.length() > 6)
514 desc.append("</html>");
515 this.setToolTipText(desc.toString());
519 this.setToolTipText(null);
530 public void mouseClicked(MouseEvent evt)
532 final AlignmentAnnotation[] aa = ap.av.getAlignment()
533 .getAlignmentAnnotation();
534 if (SwingUtilities.isLeftMouseButton(evt))
536 if (selectedRow > -1 && selectedRow < aa.length)
538 if (aa[selectedRow].groupRef != null)
540 if (evt.getClickCount() >= 2)
542 // todo: make the ap scroll to the selection - not necessary, first
543 // click highlights/scrolls, second selects
544 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
545 ap.av.setSelectionGroup(// new SequenceGroup(
546 aa[selectedRow].groupRef); // );
547 ap.paintAlignment(false);
548 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
549 ap.av.sendSelection();
553 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(
554 aa[selectedRow].groupRef.getSequences(null));
558 else if (aa[selectedRow].sequenceRef != null)
560 if (evt.getClickCount() == 1)
564 .highlightSearchResults(
565 Arrays.asList(new SequenceI[] { aa[selectedRow].sequenceRef }));
567 else if (evt.getClickCount() >= 2)
569 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
570 SequenceGroup sg = ap.av.getSelectionGroup();
573 // we make a copy rather than edit the current selection if no
575 // see Enhancement JAL-1557
576 if (!(evt.isControlDown() || evt.isShiftDown()))
578 sg = new SequenceGroup(sg);
580 sg.addSequence(aa[selectedRow].sequenceRef, false);
584 if (evt.isControlDown())
586 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
590 // notionally, we should also add intermediate sequences from
591 // last added sequence ?
592 sg.addSequence(aa[selectedRow].sequenceRef, true);
598 sg = new SequenceGroup();
600 sg.setEndRes(ap.av.getAlignment().getWidth() - 1);
601 sg.addSequence(aa[selectedRow].sequenceRef, false);
603 ap.av.setSelectionGroup(sg);
604 ap.av.sendSelection();
605 ap.paintAlignment(false);
606 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
612 if (!SwingUtilities.isRightMouseButton(evt))
617 JPopupMenu pop = new JPopupMenu(
618 MessageManager.getString("label.annotations"));
619 JMenuItem item = new JMenuItem(ADDNEW);
620 item.addActionListener(this);
625 { // let the user make everything visible again
626 item = new JMenuItem(SHOWALL);
627 item.addActionListener(this);
630 pop.show(this, evt.getX(), evt.getY());
633 item = new JMenuItem(EDITNAME);
634 item.addActionListener(this);
636 item = new JMenuItem(HIDE);
637 item.addActionListener(this);
639 // JAL-1264 hide all sequence-specific annotations of this type
640 if (selectedRow < aa.length)
642 if (aa[selectedRow].sequenceRef != null)
644 final String label = aa[selectedRow].label;
645 JMenuItem hideType = new JMenuItem();
646 String text = MessageManager.getString("label.hide_all") + " "
648 hideType.setText(text);
649 hideType.addActionListener(new ActionListener()
652 public void actionPerformed(ActionEvent e)
654 AlignmentUtils.showOrHideSequenceAnnotations(
655 ap.av.getAlignment(), Collections.singleton(label),
657 // for (AlignmentAnnotation ann : ap.av.getAlignment()
658 // .getAlignmentAnnotation())
660 // if (ann.sequenceRef != null && ann.label != null
661 // && ann.label.equals(label))
663 // ann.visible = false;
672 item = new JMenuItem(DELETE);
673 item.addActionListener(this);
677 item = new JMenuItem(SHOWALL);
678 item.addActionListener(this);
681 item = new JMenuItem(OUTPUT_TEXT);
682 item.addActionListener(this);
684 // TODO: annotation object should be typed for autocalculated/derived
686 if (selectedRow < aa.length)
688 final String label = aa[selectedRow].label;
689 if (!aa[selectedRow].autoCalculated)
691 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
693 // display formatting settings for this row.
695 // av and sequencegroup need to implement same interface for
696 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
697 aa[selectedRow].scaleColLabel);
698 item.addActionListener(this);
702 else if (label.indexOf("Consensus") > -1)
705 // av and sequencegroup need to implement same interface for
706 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
707 MessageManager.getString("label.ignore_gaps_consensus"),
708 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
709 .getIgnoreGapsConsensus() : ap.av
710 .isIgnoreGapsConsensus());
711 final AlignmentAnnotation aaa = aa[selectedRow];
712 cbmi.addActionListener(new ActionListener()
714 public void actionPerformed(ActionEvent e)
716 if (aaa.groupRef != null)
718 // TODO: pass on reference to ap so the view can be updated.
719 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
720 ap.getAnnotationPanel().paint(
721 ap.getAnnotationPanel().getGraphics());
725 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
730 // av and sequencegroup need to implement same interface for
731 if (aaa.groupRef != null)
733 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
734 MessageManager.getString("label.show_group_histogram"),
735 aa[selectedRow].groupRef.isShowConsensusHistogram());
736 chist.addActionListener(new ActionListener()
738 public void actionPerformed(ActionEvent e)
740 // TODO: pass on reference
746 aaa.groupRef.setShowConsensusHistogram(chist.getState());
748 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
752 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
753 MessageManager.getString("label.show_group_logo"),
754 aa[selectedRow].groupRef.isShowSequenceLogo());
755 cprofl.addActionListener(new ActionListener()
757 public void actionPerformed(ActionEvent e)
759 // TODO: pass on reference
765 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
767 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
771 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
772 MessageManager.getString("label.normalise_group_logo"),
773 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
774 cproflnorm.addActionListener(new ActionListener()
776 public void actionPerformed(ActionEvent e)
779 // TODO: pass on reference
785 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
786 // automatically enable logo display if we're clicked
787 aaa.groupRef.setshowSequenceLogo(true);
789 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
796 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
797 MessageManager.getString("label.show_histogram"),
798 av.isShowConsensusHistogram());
799 chist.addActionListener(new ActionListener()
801 public void actionPerformed(ActionEvent e)
803 // TODO: pass on reference
809 av.setShowConsensusHistogram(chist.getState());
810 ap.alignFrame.setMenusForViewport();
812 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
816 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
817 MessageManager.getString("label.show_logo"),
818 av.isShowSequenceLogo());
819 cprof.addActionListener(new ActionListener()
821 public void actionPerformed(ActionEvent e)
823 // TODO: pass on reference
829 av.setShowSequenceLogo(cprof.getState());
830 ap.alignFrame.setMenusForViewport();
832 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
836 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
837 MessageManager.getString("label.normalise_logo"),
838 av.isNormaliseSequenceLogo());
839 cprofnorm.addActionListener(new ActionListener()
841 public void actionPerformed(ActionEvent e)
843 // TODO: pass on reference
849 av.setShowSequenceLogo(true);
850 av.setNormaliseSequenceLogo(cprofnorm.getState());
851 ap.alignFrame.setMenusForViewport();
853 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
858 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
859 consclipbrd.addActionListener(this);
860 pop.add(consclipbrd);
863 pop.show(this, evt.getX(), evt.getY());
867 * do a single sequence copy to jalview and the system clipboard
870 * sequence to be copied to clipboard
872 protected void copy_annotseqtoclipboard(SequenceI sq)
874 SequenceI[] seqs = new SequenceI[] { sq };
875 String[] omitHidden = null;
876 SequenceI[] dseqs = new SequenceI[] { sq.getDatasetSequence() };
877 if (dseqs[0] == null)
879 dseqs[0] = new Sequence(sq);
880 dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(
881 jalview.util.Comparison.GapChars, sq.getSequenceAsString()));
883 sq.setDatasetSequence(dseqs[0]);
885 Alignment ds = new Alignment(dseqs);
886 if (av.hasHiddenColumns())
888 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
889 sq.getLength(), seqs);
892 int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
893 List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
894 if (hiddenCols != null)
896 alignmentStartEnd = AlignFrame.getStartEnd(alignmentStartEnd,
899 String output = new FormatAdapter().formatSequences("Fasta", seqs,
900 omitHidden, alignmentStartEnd);
902 Toolkit.getDefaultToolkit().getSystemClipboard()
903 .setContents(new StringSelection(output), Desktop.instance);
905 ArrayList<int[]> hiddenColumns = null;
906 if (av.hasHiddenColumns())
908 hiddenColumns = new ArrayList<int[]>();
909 for (int[] region : av.getColumnSelection().getHiddenColumns())
911 hiddenColumns.add(new int[] { region[0], region[1] });
915 Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
917 // sequence ? need to
919 // sequence as special.
929 public void paintComponent(Graphics g)
932 int width = getWidth();
935 width = ap.calculateIdWidth().width + 4;
938 Graphics2D g2 = (Graphics2D) g;
941 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
942 RenderingHints.VALUE_ANTIALIAS_ON);
945 drawComponent(g2, true, width);
950 * Draw the full set of annotation Labels for the alignment at the given
954 * Graphics2D instance (needed for font scaling)
956 * Width for scaling labels
959 public void drawComponent(Graphics g, int width)
961 drawComponent(g, false, width);
964 private final boolean debugRedraw = false;
967 * Draw the full set of annotation Labels for the alignment at the given
971 * Graphics2D instance (needed for font scaling)
973 * - true indicates that only current visible area needs to be
976 * Width for scaling labels
978 public void drawComponent(Graphics g, boolean clip, int width)
980 if (av.getFont().getSize() < 10)
986 g.setFont(av.getFont());
989 FontMetrics fm = g.getFontMetrics(g.getFont());
990 g.setColor(Color.white);
991 g.fillRect(0, 0, getWidth(), getHeight());
993 g.translate(0, getScrollOffset());
994 g.setColor(Color.black);
996 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
997 int fontHeight = g.getFont().getSize();
1000 int graphExtras = 0;
1002 Font baseFont = g.getFont();
1003 FontMetrics baseMetrics = fm;
1004 int ofontH = fontHeight;
1007 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap
1008 .getAnnotationPanel().getVisibleVRange() : null;
1009 if (clip && visr != null)
1012 visHeight = visr[1];
1014 boolean visible = true, before = false, after = false;
1017 hasHiddenRows = false;
1019 for (int i = 0; i < aa.length; i++)
1024 hasHiddenRows = true;
1037 System.out.println("before vis: " + i);
1041 // don't draw what isn't visible
1044 if (olY > visHeight)
1051 System.out.println("Scroll offset: " + sOffset
1052 + " after vis: " + i);
1056 // don't draw what isn't visible
1060 g.setColor(Color.black);
1062 offset = -aa[i].height / 2;
1066 offset += fm.getHeight() / 2;
1067 offset -= fm.getDescent();
1071 offset += fm.getDescent();
1074 x = width - fm.stringWidth(aa[i].label) - 3;
1076 if (aa[i].graphGroup > -1)
1079 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1080 // computed efficiently for all visible labels
1081 for (int gg = 0; gg < aa.length; gg++)
1083 if (aa[gg].graphGroup == aa[i].graphGroup)
1088 if (groupSize * (fontHeight + 8) < aa[i].height)
1090 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1094 // scale font to fit
1095 float h = aa[i].height / (float) groupSize, s;
1102 fontHeight = -8 + (int) h;
1103 s = ((float) fontHeight) / (float) ofontH;
1104 Font f = baseFont.deriveFont(AffineTransform
1105 .getScaleInstance(s, s));
1107 fm = g.getFontMetrics();
1108 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1113 for (int gg = 0; gg < aa.length; gg++)
1115 if (aa[gg].graphGroup == aa[i].graphGroup)
1117 x = width - fm.stringWidth(aa[gg].label) - 3;
1118 g.drawString(aa[gg].label, x, y - graphExtras);
1120 if (aa[gg]._linecolour != null)
1123 g.setColor(aa[gg]._linecolour);
1124 g.drawLine(x, y - graphExtras + 3,
1125 x + fm.stringWidth(aa[gg].label), y - graphExtras
1129 g.setColor(Color.black);
1130 graphExtras += fontHeight + 8;
1134 g.setFont(baseFont);
1136 fontHeight = ofontH;
1140 g.drawString(aa[i].label, x, y + offset);
1147 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1149 else if (dragEvent != null && aa != null)
1151 g.setColor(Color.lightGray);
1152 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1153 dragEvent.getY() - getScrollOffset());
1156 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1158 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1159 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1164 public int getScrollOffset()
1166 return scrollOffset;