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;
217 public void actionPerformed(ActionEvent evt)
219 AlignmentAnnotation[] aa = ap.av.getAlignment()
220 .getAlignmentAnnotation();
222 if (evt.getActionCommand().equals(ADDNEW))
224 AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
225 null, new Annotation[ap.av.getAlignment().getWidth()]);
227 if (!editLabelDescription(newAnnotation))
232 ap.av.getAlignment().addAnnotation(newAnnotation);
233 ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
235 else if (evt.getActionCommand().equals(EDITNAME))
237 editLabelDescription(aa[selectedRow]);
240 else if (evt.getActionCommand().equals(HIDE))
242 aa[selectedRow].visible = false;
244 else if (evt.getActionCommand().equals(DELETE))
246 ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
248 else if (evt.getActionCommand().equals(SHOWALL))
250 for (int i = 0; i < aa.length; i++)
252 if (!aa[i].visible && aa[i].annotations != null)
254 aa[i].visible = true;
258 else if (evt.getActionCommand().equals(OUTPUT_TEXT))
260 new AnnotationExporter().exportAnnotations(ap,
261 new AlignmentAnnotation[] { aa[selectedRow] });
263 else if (evt.getActionCommand().equals(COPYCONS_SEQ))
265 SequenceI cons = null;
266 if (aa[selectedRow].groupRef != null)
268 cons = aa[selectedRow].groupRef.getConsensusSeq();
272 cons = av.getConsensusSeq();
276 copy_annotseqtoclipboard(cons);
280 else if (evt.getActionCommand().equals(TOGGLE_LABELSCALE))
282 aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
292 protected void refresh()
294 ap.validateAnnotationDimensions(false);
305 boolean editLabelDescription(AlignmentAnnotation annotation)
307 EditNameDialog dialog = new EditNameDialog(annotation.label,
308 annotation.description, " Annotation Name ",
309 "Annotation Description ", "Edit Annotation Name/Description",
317 annotation.label = dialog.getName();
319 String text = dialog.getDescription();
320 if (text != null && text.length() == 0)
324 annotation.description = text;
336 public void mousePressed(MouseEvent evt)
338 getSelectedRow(evt.getY() - getScrollOffset());
349 public void mouseReleased(MouseEvent evt)
351 int start = selectedRow;
352 getSelectedRow(evt.getY() - getScrollOffset());
353 int end = selectedRow;
357 // Swap these annotations
358 AlignmentAnnotation startAA = ap.av.getAlignment()
359 .getAlignmentAnnotation()[start];
362 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
364 AlignmentAnnotation endAA = ap.av.getAlignment()
365 .getAlignmentAnnotation()[end];
367 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
368 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
374 ap.getAnnotationPanel().repaint();
384 public void mouseEntered(MouseEvent evt)
400 public void mouseExited(MouseEvent evt)
402 if (dragEvent == null)
416 public void mouseDragged(MouseEvent evt)
422 Dimension d = ap.annotationScroller.getPreferredSize();
423 int dif = evt.getY() - oldY;
425 dif /= ap.av.getCharHeight();
426 dif *= ap.av.getCharHeight();
428 if ((d.height - dif) > 20)
430 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
432 d = ap.annotationSpaceFillerHolder.getPreferredSize();
433 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
434 d.width, d.height - dif));
435 ap.paintAlignment(true);
453 public void mouseMoved(MouseEvent evt)
455 resizePanel = evt.getY() < 10;
457 getSelectedRow(evt.getY() - getScrollOffset());
460 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
462 AlignmentAnnotation aa = ap.av.getAlignment()
463 .getAlignmentAnnotation()[selectedRow];
465 StringBuffer desc = new StringBuffer();
466 if (aa.description != null
467 && !aa.description.equals("New description"))
469 // TODO: we could refactor and merge this code with the code in
470 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
472 desc.append(aa.getDescription(true).trim());
473 // check to see if the description is an html fragment.
474 if (desc.length() < 6
475 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
477 // clean the description ready for embedding in html
478 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
479 .replaceAll("<"));
480 desc.insert(0, "<html>");
484 // remove terminating html if any
485 int i = desc.substring(desc.length() - 7).toLowerCase()
486 .lastIndexOf("</html>");
489 desc.setLength(desc.length() - 7 + i);
494 desc.append("<br/>");
496 // if (aa.hasProperties())
498 // desc.append("<table>");
499 // for (String prop : aa.getProperties())
501 // desc.append("<tr><td>" + prop + "</td><td>"
502 // + aa.getProperty(prop) + "</td><tr>");
504 // desc.append("</table>");
509 // begin the tooltip's html fragment
510 desc.append("<html>");
513 // TODO: limit precision of score to avoid noise from imprecise
515 // (64.7 becomes 64.7+/some tiny value).
516 desc.append(" Score: " + aa.score);
519 if (desc.length() > 6)
521 desc.append("</html>");
522 this.setToolTipText(desc.toString());
526 this.setToolTipText(null);
538 public void mouseClicked(MouseEvent evt)
540 final AlignmentAnnotation[] aa = ap.av.getAlignment()
541 .getAlignmentAnnotation();
542 if (SwingUtilities.isLeftMouseButton(evt))
544 if (selectedRow > -1 && selectedRow < aa.length)
546 if (aa[selectedRow].groupRef != null)
548 if (evt.getClickCount() >= 2)
550 // todo: make the ap scroll to the selection - not necessary, first
551 // click highlights/scrolls, second selects
552 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
553 ap.av.setSelectionGroup(// new SequenceGroup(
554 aa[selectedRow].groupRef); // );
555 ap.paintAlignment(false);
556 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
557 ap.av.sendSelection();
561 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(
562 aa[selectedRow].groupRef.getSequences(null));
566 else if (aa[selectedRow].sequenceRef != null)
568 if (evt.getClickCount() == 1)
572 .highlightSearchResults(
573 Arrays.asList(new SequenceI[] { aa[selectedRow].sequenceRef }));
575 else if (evt.getClickCount() >= 2)
577 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
578 SequenceGroup sg = ap.av.getSelectionGroup();
581 // we make a copy rather than edit the current selection if no
583 // see Enhancement JAL-1557
584 if (!(evt.isControlDown() || evt.isShiftDown()))
586 sg = new SequenceGroup(sg);
588 sg.addSequence(aa[selectedRow].sequenceRef, false);
592 if (evt.isControlDown())
594 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
598 // notionally, we should also add intermediate sequences from
599 // last added sequence ?
600 sg.addSequence(aa[selectedRow].sequenceRef, true);
606 sg = new SequenceGroup();
608 sg.setEndRes(ap.av.getAlignment().getWidth() - 1);
609 sg.addSequence(aa[selectedRow].sequenceRef, false);
611 ap.av.setSelectionGroup(sg);
612 ap.av.sendSelection();
613 ap.paintAlignment(false);
614 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
620 if (!SwingUtilities.isRightMouseButton(evt))
625 JPopupMenu pop = new JPopupMenu(
626 MessageManager.getString("label.annotations"));
627 JMenuItem item = new JMenuItem(ADDNEW);
628 item.addActionListener(this);
633 { // let the user make everything visible again
634 item = new JMenuItem(SHOWALL);
635 item.addActionListener(this);
638 pop.show(this, evt.getX(), evt.getY());
641 item = new JMenuItem(EDITNAME);
642 item.addActionListener(this);
644 item = new JMenuItem(HIDE);
645 item.addActionListener(this);
647 // JAL-1264 hide all sequence-specific annotations of this type
648 if (selectedRow < aa.length)
650 if (aa[selectedRow].sequenceRef != null)
652 final String label = aa[selectedRow].label;
653 JMenuItem hideType = new JMenuItem();
654 String text = MessageManager.getString("label.hide_all") + " "
656 hideType.setText(text);
657 hideType.addActionListener(new ActionListener()
660 public void actionPerformed(ActionEvent e)
662 AlignmentUtils.showOrHideSequenceAnnotations(
663 ap.av.getAlignment(), Collections.singleton(label),
665 // for (AlignmentAnnotation ann : ap.av.getAlignment()
666 // .getAlignmentAnnotation())
668 // if (ann.sequenceRef != null && ann.label != null
669 // && ann.label.equals(label))
671 // ann.visible = false;
680 item = new JMenuItem(DELETE);
681 item.addActionListener(this);
685 item = new JMenuItem(SHOWALL);
686 item.addActionListener(this);
689 item = new JMenuItem(OUTPUT_TEXT);
690 item.addActionListener(this);
692 // TODO: annotation object should be typed for autocalculated/derived
694 if (selectedRow < aa.length)
696 final String label = aa[selectedRow].label;
697 if (!aa[selectedRow].autoCalculated)
699 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
701 // display formatting settings for this row.
703 // av and sequencegroup need to implement same interface for
704 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
705 aa[selectedRow].scaleColLabel);
706 item.addActionListener(this);
710 else if (label.indexOf("Consensus") > -1)
713 // av and sequencegroup need to implement same interface for
714 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
715 MessageManager.getString("label.ignore_gaps_consensus"),
716 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
717 .getIgnoreGapsConsensus() : ap.av
718 .isIgnoreGapsConsensus());
719 final AlignmentAnnotation aaa = aa[selectedRow];
720 cbmi.addActionListener(new ActionListener()
723 public void actionPerformed(ActionEvent e)
725 if (aaa.groupRef != null)
727 // TODO: pass on reference to ap so the view can be updated.
728 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
729 ap.getAnnotationPanel().paint(
730 ap.getAnnotationPanel().getGraphics());
734 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
739 // av and sequencegroup need to implement same interface for
740 if (aaa.groupRef != null)
742 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
743 MessageManager.getString("label.show_group_histogram"),
744 aa[selectedRow].groupRef.isShowConsensusHistogram());
745 chist.addActionListener(new ActionListener()
748 public void actionPerformed(ActionEvent e)
750 // TODO: pass on reference
756 aaa.groupRef.setShowConsensusHistogram(chist.getState());
758 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
762 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
763 MessageManager.getString("label.show_group_logo"),
764 aa[selectedRow].groupRef.isShowSequenceLogo());
765 cprofl.addActionListener(new ActionListener()
768 public void actionPerformed(ActionEvent e)
770 // TODO: pass on reference
776 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
778 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
782 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
783 MessageManager.getString("label.normalise_group_logo"),
784 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
785 cproflnorm.addActionListener(new ActionListener()
788 public void actionPerformed(ActionEvent e)
791 // TODO: pass on reference
797 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
798 // automatically enable logo display if we're clicked
799 aaa.groupRef.setshowSequenceLogo(true);
801 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
808 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
809 MessageManager.getString("label.show_histogram"),
810 av.isShowConsensusHistogram());
811 chist.addActionListener(new ActionListener()
814 public void actionPerformed(ActionEvent e)
816 // TODO: pass on reference
822 av.setShowConsensusHistogram(chist.getState());
823 ap.alignFrame.setMenusForViewport();
825 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
829 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
830 MessageManager.getString("label.show_logo"),
831 av.isShowSequenceLogo());
832 cprof.addActionListener(new ActionListener()
835 public void actionPerformed(ActionEvent e)
837 // TODO: pass on reference
843 av.setShowSequenceLogo(cprof.getState());
844 ap.alignFrame.setMenusForViewport();
846 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
850 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
851 MessageManager.getString("label.normalise_logo"),
852 av.isNormaliseSequenceLogo());
853 cprofnorm.addActionListener(new ActionListener()
856 public void actionPerformed(ActionEvent e)
858 // TODO: pass on reference
864 av.setShowSequenceLogo(true);
865 av.setNormaliseSequenceLogo(cprofnorm.getState());
866 ap.alignFrame.setMenusForViewport();
868 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
873 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
874 consclipbrd.addActionListener(this);
875 pop.add(consclipbrd);
878 pop.show(this, evt.getX(), evt.getY());
882 * do a single sequence copy to jalview and the system clipboard
885 * sequence to be copied to clipboard
887 protected void copy_annotseqtoclipboard(SequenceI sq)
889 SequenceI[] seqs = new SequenceI[] { sq };
890 String[] omitHidden = null;
891 SequenceI[] dseqs = new SequenceI[] { sq.getDatasetSequence() };
892 if (dseqs[0] == null)
894 dseqs[0] = new Sequence(sq);
895 dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(
896 jalview.util.Comparison.GapChars, sq.getSequenceAsString()));
898 sq.setDatasetSequence(dseqs[0]);
900 Alignment ds = new Alignment(dseqs);
901 if (av.hasHiddenColumns())
903 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
904 sq.getLength(), seqs);
907 int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
908 List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
909 if (hiddenCols != null)
911 alignmentStartEnd = av.getAlignment().getVisibleStartAndEndIndex(
914 String output = new FormatAdapter().formatSequences("Fasta", seqs,
915 omitHidden, alignmentStartEnd);
917 Toolkit.getDefaultToolkit().getSystemClipboard()
918 .setContents(new StringSelection(output), Desktop.instance);
920 ArrayList<int[]> hiddenColumns = null;
921 if (av.hasHiddenColumns())
923 hiddenColumns = new ArrayList<int[]>();
924 for (int[] region : av.getColumnSelection().getHiddenColumns())
926 hiddenColumns.add(new int[] { region[0], region[1] });
930 Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
932 // sequence ? need to
934 // sequence as special.
945 public void paintComponent(Graphics g)
948 int width = getWidth();
951 width = ap.calculateIdWidth().width + 4;
954 Graphics2D g2 = (Graphics2D) g;
957 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
958 RenderingHints.VALUE_ANTIALIAS_ON);
961 drawComponent(g2, true, width);
966 * Draw the full set of annotation Labels for the alignment at the given
970 * Graphics2D instance (needed for font scaling)
972 * Width for scaling labels
975 public void drawComponent(Graphics g, int width)
977 drawComponent(g, false, width);
980 private final boolean debugRedraw = false;
983 * Draw the full set of annotation Labels for the alignment at the given
987 * Graphics2D instance (needed for font scaling)
989 * - true indicates that only current visible area needs to be
992 * Width for scaling labels
994 public void drawComponent(Graphics g, boolean clip, int width)
996 if (av.getFont().getSize() < 10)
1002 g.setFont(av.getFont());
1005 FontMetrics fm = g.getFontMetrics(g.getFont());
1006 g.setColor(Color.white);
1007 g.fillRect(0, 0, getWidth(), getHeight());
1009 g.translate(0, getScrollOffset());
1010 g.setColor(Color.black);
1012 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
1013 int fontHeight = g.getFont().getSize();
1016 int graphExtras = 0;
1018 Font baseFont = g.getFont();
1019 FontMetrics baseMetrics = fm;
1020 int ofontH = fontHeight;
1023 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap
1024 .getAnnotationPanel().getVisibleVRange() : null;
1025 if (clip && visr != null)
1028 visHeight = visr[1];
1030 boolean visible = true, before = false, after = false;
1033 hasHiddenRows = false;
1035 for (int i = 0; i < aa.length; i++)
1040 hasHiddenRows = true;
1053 System.out.println("before vis: " + i);
1057 // don't draw what isn't visible
1060 if (olY > visHeight)
1067 System.out.println("Scroll offset: " + sOffset
1068 + " after vis: " + i);
1072 // don't draw what isn't visible
1076 g.setColor(Color.black);
1078 offset = -aa[i].height / 2;
1082 offset += fm.getHeight() / 2;
1083 offset -= fm.getDescent();
1087 offset += fm.getDescent();
1090 x = width - fm.stringWidth(aa[i].label) - 3;
1092 if (aa[i].graphGroup > -1)
1095 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1096 // computed efficiently for all visible labels
1097 for (int gg = 0; gg < aa.length; gg++)
1099 if (aa[gg].graphGroup == aa[i].graphGroup)
1104 if (groupSize * (fontHeight + 8) < aa[i].height)
1106 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1110 // scale font to fit
1111 float h = aa[i].height / (float) groupSize, s;
1118 fontHeight = -8 + (int) h;
1119 s = ((float) fontHeight) / (float) ofontH;
1120 Font f = baseFont.deriveFont(AffineTransform
1121 .getScaleInstance(s, s));
1123 fm = g.getFontMetrics();
1124 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1129 for (int gg = 0; gg < aa.length; gg++)
1131 if (aa[gg].graphGroup == aa[i].graphGroup)
1133 x = width - fm.stringWidth(aa[gg].label) - 3;
1134 g.drawString(aa[gg].label, x, y - graphExtras);
1136 if (aa[gg]._linecolour != null)
1139 g.setColor(aa[gg]._linecolour);
1140 g.drawLine(x, y - graphExtras + 3,
1141 x + fm.stringWidth(aa[gg].label), y - graphExtras
1145 g.setColor(Color.black);
1146 graphExtras += fontHeight + 8;
1150 g.setFont(baseFont);
1152 fontHeight = ofontH;
1156 g.drawString(aa[i].label, x, y + offset);
1163 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1165 else if (dragEvent != null && aa != null)
1167 g.setColor(Color.lightGray);
1168 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1169 dragEvent.getY() - getScrollOffset());
1172 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1174 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1175 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1180 public int getScrollOffset()
1182 return scrollOffset;