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.compile("<");
75 String TOGGLE_LABELSCALE = MessageManager.getString("label.scale_label_to_column");
77 String ADDNEW = MessageManager.getString("label.add_new_row");
79 String EDITNAME = MessageManager.getString("label.edit_label_description");
81 String HIDE = MessageManager.getString("label.hide_row");
83 String DELETE = MessageManager.getString("label.delete_row");
85 String SHOWALL = MessageManager.getString("label.show_all_hidden_rows");
87 String OUTPUT_TEXT = MessageManager.getString("label.export_annotation");
89 String COPYCONS_SEQ = MessageManager.getString("label.copy_consensus_sequence");
91 boolean resizePanel = false;
99 boolean resizing = false;
101 MouseEvent dragEvent;
107 private int scrollOffset = 0;
109 Font font = new Font("Arial", Font.PLAIN, 11);
111 private boolean hasHiddenRows;
114 * Creates a new AnnotationLabels object.
119 public AnnotationLabels(AlignmentPanel ap)
123 ToolTipManager.sharedInstance().registerComponent(this);
125 java.net.URL url = getClass().getResource("/images/idwidth.gif");
130 temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);
135 MediaTracker mt = new MediaTracker(this);
136 mt.addImage(temp, 0);
138 } catch (Exception ex)
142 BufferedImage bi = new BufferedImage(temp.getHeight(this),
143 temp.getWidth(this), BufferedImage.TYPE_INT_RGB);
144 Graphics2D g = (Graphics2D) bi.getGraphics();
145 g.rotate(Math.toRadians(90));
146 g.drawImage(temp, 0, -bi.getWidth(this), this);
149 addMouseListener(this);
150 addMouseMotionListener(this);
151 addMouseWheelListener(ap.getAnnotationPanel());
154 public AnnotationLabels(AlignViewport av)
165 public void setScrollOffset(int y)
172 * sets selectedRow to -2 if no annotation preset, -1 if no visible row is at
176 * coordinate position to search for a row
178 void getSelectedRow(int y)
181 AlignmentAnnotation[] aa = ap.av.getAlignment()
182 .getAlignmentAnnotation();
186 for (int i = 0; i < aa.length; i++)
194 height += aa[i].height;
212 public void actionPerformed(ActionEvent evt)
214 AlignmentAnnotation[] aa = ap.av.getAlignment()
215 .getAlignmentAnnotation();
217 if (evt.getActionCommand().equals(ADDNEW))
219 AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
220 null, new Annotation[ap.av.getAlignment().getWidth()]);
222 if (!editLabelDescription(newAnnotation))
227 ap.av.getAlignment().addAnnotation(newAnnotation);
228 ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
230 else if (evt.getActionCommand().equals(EDITNAME))
232 editLabelDescription(aa[selectedRow]);
235 else if (evt.getActionCommand().equals(HIDE))
237 aa[selectedRow].visible = false;
239 else if (evt.getActionCommand().equals(DELETE))
241 ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
243 else if (evt.getActionCommand().equals(SHOWALL))
245 for (int i = 0; i < aa.length; i++)
247 if (!aa[i].visible && aa[i].annotations != null)
249 aa[i].visible = true;
253 else if (evt.getActionCommand().equals(OUTPUT_TEXT))
255 new AnnotationExporter().exportAnnotations(ap,
256 new AlignmentAnnotation[]
257 { aa[selectedRow] });
259 else if (evt.getActionCommand().equals(COPYCONS_SEQ))
261 SequenceI cons = null;
262 if (aa[selectedRow].groupRef != null)
264 cons = aa[selectedRow].groupRef.getConsensusSeq();
268 cons = av.getConsensusSeq();
272 copy_annotseqtoclipboard(cons);
276 else if (evt.getActionCommand().equals(TOGGLE_LABELSCALE))
278 aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
288 protected void refresh()
290 ap.validateAnnotationDimensions(false);
301 boolean editLabelDescription(AlignmentAnnotation annotation)
303 EditNameDialog dialog = new EditNameDialog(annotation.label,
304 annotation.description, " Annotation Name ",
305 "Annotation Description ", "Edit Annotation Name/Description",
313 annotation.label = dialog.getName();
315 String text = dialog.getDescription();
316 if (text != null && text.length() == 0)
320 annotation.description = text;
331 public void mousePressed(MouseEvent evt)
333 getSelectedRow(evt.getY() - getScrollOffset());
343 public void mouseReleased(MouseEvent evt)
345 int start = selectedRow;
346 getSelectedRow(evt.getY() - getScrollOffset());
347 int end = selectedRow;
351 // Swap these annotations
352 AlignmentAnnotation startAA = ap.av.getAlignment()
353 .getAlignmentAnnotation()[start];
356 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
358 AlignmentAnnotation endAA = ap.av.getAlignment()
359 .getAlignmentAnnotation()[end];
361 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
362 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
368 ap.getAnnotationPanel().repaint();
377 public void mouseEntered(MouseEvent evt)
392 public void mouseExited(MouseEvent evt)
394 if (dragEvent == null)
407 public void mouseDragged(MouseEvent evt)
413 Dimension d = ap.annotationScroller.getPreferredSize();
414 int dif = evt.getY() - oldY;
416 dif /= ap.av.getCharHeight();
417 dif *= ap.av.getCharHeight();
419 if ((d.height - dif) > 20)
421 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
423 d = ap.annotationSpaceFillerHolder.getPreferredSize();
424 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
425 d.width, d.height - dif));
426 ap.paintAlignment(true);
443 public void mouseMoved(MouseEvent evt)
445 resizePanel = evt.getY() < 10;
447 getSelectedRow(evt.getY() - getScrollOffset());
450 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
452 AlignmentAnnotation aa = ap.av.getAlignment()
453 .getAlignmentAnnotation()[selectedRow];
455 StringBuffer desc = new StringBuffer();
456 if (aa.description != null
457 && !aa.description.equals("New description"))
459 // TODO: we could refactor and merge this code with the code in
460 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
462 desc.append(aa.getDescription(true).trim());
463 // check to see if the description is an html fragment.
464 if (desc.length() < 6
465 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
467 // clean the description ready for embedding in html
468 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
469 .replaceAll("<"));
470 desc.insert(0, "<html>");
474 // remove terminating html if any
475 int i = desc.substring(desc.length() - 7).toLowerCase()
476 .lastIndexOf("</html>");
479 desc.setLength(desc.length() - 7 + i);
484 desc.append("<br/>");
486 // if (aa.hasProperties())
488 // desc.append("<table>");
489 // for (String prop : aa.getProperties())
491 // desc.append("<tr><td>" + prop + "</td><td>"
492 // + aa.getProperty(prop) + "</td><tr>");
494 // desc.append("</table>");
499 // begin the tooltip's html fragment
500 desc.append("<html>");
503 // TODO: limit precision of score to avoid noise from imprecise
505 // (64.7 becomes 64.7+/some tiny value).
506 desc.append(" Score: " + aa.score);
509 if (desc.length() > 6)
511 desc.append("</html>");
512 this.setToolTipText(desc.toString());
516 this.setToolTipText(null);
527 public void mouseClicked(MouseEvent evt)
529 final AlignmentAnnotation[] aa = ap.av.getAlignment()
530 .getAlignmentAnnotation();
531 if (SwingUtilities.isLeftMouseButton(evt))
533 if (selectedRow > -1 && selectedRow < aa.length)
535 if (aa[selectedRow].groupRef != null)
537 if (evt.getClickCount() >= 2)
539 // todo: make the ap scroll to the selection - not necessary, first
540 // click highlights/scrolls, second selects
541 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
542 ap.av.setSelectionGroup(// new SequenceGroup(
543 aa[selectedRow].groupRef); // );
544 ap.paintAlignment(false);
545 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
546 ap.av.sendSelection();
550 ap.getSeqPanel().ap.getIdPanel()
551 .highlightSearchResults(aa[selectedRow].groupRef
552 .getSequences(null));
556 else if (aa[selectedRow].sequenceRef != null)
558 if (evt.getClickCount() == 1)
560 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(Arrays
561 .asList(new SequenceI[]
562 { aa[selectedRow].sequenceRef }));
564 else if (evt.getClickCount() >= 2)
566 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
567 SequenceGroup sg = ap.av.getSelectionGroup();
570 // we make a copy rather than edit the current selection if no modifiers pressed
571 // see Enhancement JAL-1557
572 if (!(evt.isControlDown() || evt.isShiftDown()))
574 sg = new SequenceGroup(sg);
576 sg.addSequence(aa[selectedRow].sequenceRef, false);
578 if (evt.isControlDown())
580 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
582 // notionally, we should also add intermediate sequences from last added sequence ?
583 sg.addSequence(aa[selectedRow].sequenceRef, true);
587 sg = new SequenceGroup();
589 sg.setEndRes(ap.av.getAlignment().getWidth()-1);
590 sg.addSequence(aa[selectedRow].sequenceRef, false);
592 ap.av.setSelectionGroup(sg);
593 ap.av.sendSelection();
594 ap.paintAlignment(false);
595 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
601 if (!SwingUtilities.isRightMouseButton(evt))
606 JPopupMenu pop = new JPopupMenu(
607 MessageManager.getString("label.annotations"));
608 JMenuItem item = new JMenuItem(ADDNEW);
609 item.addActionListener(this);
614 { // let the user make everything visible again
615 item = new JMenuItem(SHOWALL);
616 item.addActionListener(this);
619 pop.show(this, evt.getX(), evt.getY());
622 item = new JMenuItem(EDITNAME);
623 item.addActionListener(this);
625 item = new JMenuItem(HIDE);
626 item.addActionListener(this);
628 // JAL-1264 hide all sequence-specific annotations of this type
629 if (selectedRow < aa.length)
631 if (aa[selectedRow].sequenceRef != null)
633 final String label = aa[selectedRow].label;
634 JMenuItem hideType = new JMenuItem();
635 String text = MessageManager.getString("label.hide_all") + " " + label;
636 hideType.setText(text);
637 hideType.addActionListener(new ActionListener()
640 public void actionPerformed(ActionEvent e)
642 AlignmentUtils.showOrHideSequenceAnnotations(
643 ap.av.getAlignment(), Collections.singleton(label),
645 // for (AlignmentAnnotation ann : ap.av.getAlignment()
646 // .getAlignmentAnnotation())
648 // if (ann.sequenceRef != null && ann.label != null
649 // && ann.label.equals(label))
651 // ann.visible = false;
660 item = new JMenuItem(DELETE);
661 item.addActionListener(this);
665 item = new JMenuItem(SHOWALL);
666 item.addActionListener(this);
669 item = new JMenuItem(OUTPUT_TEXT);
670 item.addActionListener(this);
672 // TODO: annotation object should be typed for autocalculated/derived
674 if (selectedRow < aa.length)
676 final String label = aa[selectedRow].label;
677 if (!aa[selectedRow].autoCalculated)
679 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
681 // display formatting settings for this row.
683 // av and sequencegroup need to implement same interface for
684 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
685 aa[selectedRow].scaleColLabel);
686 item.addActionListener(this);
690 else if (label.indexOf("Consensus") > -1)
693 // av and sequencegroup need to implement same interface for
694 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
695 MessageManager.getString("label.ignore_gaps_consensus"),
696 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
697 .getIgnoreGapsConsensus() : ap.av
698 .isIgnoreGapsConsensus());
699 final AlignmentAnnotation aaa = aa[selectedRow];
700 cbmi.addActionListener(new ActionListener()
702 public void actionPerformed(ActionEvent e)
704 if (aaa.groupRef != null)
706 // TODO: pass on reference to ap so the view can be updated.
707 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
708 ap.getAnnotationPanel().paint(ap.getAnnotationPanel().getGraphics());
712 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
717 // av and sequencegroup need to implement same interface for
718 if (aaa.groupRef != null)
720 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
721 MessageManager.getString("label.show_group_histogram"),
722 aa[selectedRow].groupRef.isShowConsensusHistogram());
723 chist.addActionListener(new ActionListener()
725 public void actionPerformed(ActionEvent e)
727 // TODO: pass on reference
733 aaa.groupRef.setShowConsensusHistogram(chist.getState());
735 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
739 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
740 MessageManager.getString("label.show_group_logo"),
741 aa[selectedRow].groupRef.isShowSequenceLogo());
742 cprofl.addActionListener(new ActionListener()
744 public void actionPerformed(ActionEvent e)
746 // TODO: pass on reference
752 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
754 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
758 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
759 MessageManager.getString("label.normalise_group_logo"),
760 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
761 cproflnorm.addActionListener(new ActionListener()
763 public void actionPerformed(ActionEvent e)
766 // TODO: pass on reference
772 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
773 // automatically enable logo display if we're clicked
774 aaa.groupRef.setshowSequenceLogo(true);
776 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
783 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
784 MessageManager.getString("label.show_histogram"), av.isShowConsensusHistogram());
785 chist.addActionListener(new ActionListener()
787 public void actionPerformed(ActionEvent e)
789 // TODO: pass on reference
795 av.setShowConsensusHistogram(chist.getState());
796 ap.alignFrame.setMenusForViewport();
798 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
802 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
803 MessageManager.getString("label.show_logo"), av.isShowSequenceLogo());
804 cprof.addActionListener(new ActionListener()
806 public void actionPerformed(ActionEvent e)
808 // TODO: pass on reference
814 av.setShowSequenceLogo(cprof.getState());
815 ap.alignFrame.setMenusForViewport();
817 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
821 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
822 MessageManager.getString("label.normalise_logo"), av.isNormaliseSequenceLogo());
823 cprofnorm.addActionListener(new ActionListener()
825 public void actionPerformed(ActionEvent e)
827 // TODO: pass on reference
833 av.setShowSequenceLogo(true);
834 av.setNormaliseSequenceLogo(cprofnorm.getState());
835 ap.alignFrame.setMenusForViewport();
837 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
842 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
843 consclipbrd.addActionListener(this);
844 pop.add(consclipbrd);
847 pop.show(this, evt.getX(), evt.getY());
851 * do a single sequence copy to jalview and the system clipboard
854 * sequence to be copied to clipboard
856 protected void copy_annotseqtoclipboard(SequenceI sq)
858 SequenceI[] seqs = new SequenceI[]
860 String[] omitHidden = null;
861 SequenceI[] dseqs = new SequenceI[]
862 { sq.getDatasetSequence() };
863 if (dseqs[0] == null)
865 dseqs[0] = new Sequence(sq);
866 dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(
867 jalview.util.Comparison.GapChars, sq.getSequenceAsString()));
869 sq.setDatasetSequence(dseqs[0]);
871 Alignment ds = new Alignment(dseqs);
872 if (av.hasHiddenColumns())
874 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
875 sq.getLength(), seqs);
878 int[] alignmentStartEnd = new int[]
879 { 0, ds.getWidth() - 1 };
880 List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
881 if (hiddenCols != null)
883 alignmentStartEnd = AlignFrame.getStartEnd(alignmentStartEnd,
886 String output = new FormatAdapter().formatSequences("Fasta", seqs,
887 omitHidden, alignmentStartEnd);
889 Toolkit.getDefaultToolkit().getSystemClipboard()
890 .setContents(new StringSelection(output), Desktop.instance);
892 ArrayList<int[]> hiddenColumns = null;
893 if (av.hasHiddenColumns())
895 hiddenColumns = new ArrayList<int[]>();
896 for (int[] region : av.getColumnSelection().getHiddenColumns())
898 hiddenColumns.add(new int[]
899 { region[0], region[1] });
903 Desktop.jalviewClipboard = new Object[]
904 { seqs, ds, // what is the dataset of a consensus sequence ? need to flag
905 // sequence as special.
915 public void paintComponent(Graphics g)
918 int width = getWidth();
921 width = ap.calculateIdWidth().width + 4;
924 Graphics2D g2 = (Graphics2D) g;
927 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
928 RenderingHints.VALUE_ANTIALIAS_ON);
931 drawComponent(g2, true, width);
936 * Draw the full set of annotation Labels for the alignment at the given
940 * Graphics2D instance (needed for font scaling)
942 * Width for scaling labels
945 public void drawComponent(Graphics g, int width)
947 drawComponent(g, false, width);
950 private final boolean debugRedraw = false;
953 * Draw the full set of annotation Labels for the alignment at the given
957 * Graphics2D instance (needed for font scaling)
959 * - true indicates that only current visible area needs to be
962 * Width for scaling labels
964 public void drawComponent(Graphics g, boolean clip, int width)
966 if (av.getFont().getSize() < 10)
972 g.setFont(av.getFont());
975 FontMetrics fm = g.getFontMetrics(g.getFont());
976 g.setColor(Color.white);
977 g.fillRect(0, 0, getWidth(), getHeight());
979 g.translate(0, getScrollOffset());
980 g.setColor(Color.black);
982 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
983 int fontHeight = g.getFont().getSize();
988 Font baseFont = g.getFont();
989 FontMetrics baseMetrics = fm;
990 int ofontH = fontHeight;
993 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap.getAnnotationPanel()
994 .getVisibleVRange() : null;
995 if (clip && visr != null)
1000 boolean visible = true, before = false, after = false;
1003 hasHiddenRows = false;
1005 for (int i = 0; i < aa.length; i++)
1010 hasHiddenRows = true;
1023 System.out.println("before vis: " + i);
1027 // don't draw what isn't visible
1030 if (olY > visHeight)
1037 System.out.println("Scroll offset: " + sOffset
1038 + " after vis: " + i);
1042 // don't draw what isn't visible
1046 g.setColor(Color.black);
1048 offset = -aa[i].height / 2;
1052 offset += fm.getHeight() / 2;
1053 offset -= fm.getDescent();
1057 offset += fm.getDescent();
1060 x = width - fm.stringWidth(aa[i].label) - 3;
1062 if (aa[i].graphGroup > -1)
1065 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1066 // computed efficiently for all visible labels
1067 for (int gg = 0; gg < aa.length; gg++)
1069 if (aa[gg].graphGroup == aa[i].graphGroup)
1074 if (groupSize * (fontHeight + 8) < aa[i].height)
1076 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1080 // scale font to fit
1081 float h = aa[i].height / (float) groupSize, s;
1088 fontHeight = -8 + (int) h;
1089 s = ((float) fontHeight) / (float) ofontH;
1090 Font f = baseFont.deriveFont(AffineTransform
1091 .getScaleInstance(s, s));
1093 fm = g.getFontMetrics();
1094 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1099 for (int gg = 0; gg < aa.length; gg++)
1101 if (aa[gg].graphGroup == aa[i].graphGroup)
1103 x = width - fm.stringWidth(aa[gg].label) - 3;
1104 g.drawString(aa[gg].label, x, y - graphExtras);
1106 if (aa[gg]._linecolour != null)
1109 g.setColor(aa[gg]._linecolour);
1110 g.drawLine(x, y - graphExtras + 3,
1111 x + fm.stringWidth(aa[gg].label), y - graphExtras
1115 g.setColor(Color.black);
1116 graphExtras += fontHeight + 8;
1120 g.setFont(baseFont);
1122 fontHeight = ofontH;
1126 g.drawString(aa[i].label, x, y + offset);
1133 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1135 else if (dragEvent != null && aa != null)
1137 g.setColor(Color.lightGray);
1138 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1139 dragEvent.getY() - getScrollOffset());
1142 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1144 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1145 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1150 public int getScrollOffset()
1152 return scrollOffset;