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;
330 public void mousePressed(MouseEvent evt)
332 getSelectedRow(evt.getY() - getScrollOffset());
334 if (!evt.isPopupTrigger())
339 // handle popup menu event
340 final AlignmentAnnotation[] aa = ap.av.getAlignment()
341 .getAlignmentAnnotation();
343 JPopupMenu pop = new JPopupMenu(
344 MessageManager.getString("label.annotations"));
345 JMenuItem item = new JMenuItem(ADDNEW);
346 item.addActionListener(this);
351 { // let the user make everything visible again
352 item = new JMenuItem(SHOWALL);
353 item.addActionListener(this);
356 pop.show(this, evt.getX(), evt.getY());
359 item = new JMenuItem(EDITNAME);
360 item.addActionListener(this);
362 item = new JMenuItem(HIDE);
363 item.addActionListener(this);
365 // JAL-1264 hide all sequence-specific annotations of this type
366 if (selectedRow < aa.length)
368 if (aa[selectedRow].sequenceRef != null)
370 final String label = aa[selectedRow].label;
371 JMenuItem hideType = new JMenuItem();
372 String text = MessageManager.getString("label.hide_all") + " "
374 hideType.setText(text);
375 hideType.addActionListener(new ActionListener()
378 public void actionPerformed(ActionEvent e)
380 AlignmentUtils.showOrHideSequenceAnnotations(
381 ap.av.getAlignment(), Collections.singleton(label),
383 // for (AlignmentAnnotation ann : ap.av.getAlignment()
384 // .getAlignmentAnnotation())
386 // if (ann.sequenceRef != null && ann.label != null
387 // && ann.label.equals(label))
389 // ann.visible = false;
398 item = new JMenuItem(DELETE);
399 item.addActionListener(this);
403 item = new JMenuItem(SHOWALL);
404 item.addActionListener(this);
407 item = new JMenuItem(OUTPUT_TEXT);
408 item.addActionListener(this);
410 // TODO: annotation object should be typed for autocalculated/derived
412 if (selectedRow < aa.length)
414 final String label = aa[selectedRow].label;
415 if (!aa[selectedRow].autoCalculated)
417 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
419 // display formatting settings for this row.
421 // av and sequencegroup need to implement same interface for
422 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
423 aa[selectedRow].scaleColLabel);
424 item.addActionListener(this);
428 else if (label.indexOf("Consensus") > -1)
431 // av and sequencegroup need to implement same interface for
432 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
433 MessageManager.getString("label.ignore_gaps_consensus"),
434 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
435 .getIgnoreGapsConsensus() : ap.av
436 .isIgnoreGapsConsensus());
437 final AlignmentAnnotation aaa = aa[selectedRow];
438 cbmi.addActionListener(new ActionListener()
441 public void actionPerformed(ActionEvent e)
443 if (aaa.groupRef != null)
445 // TODO: pass on reference to ap so the view can be updated.
446 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
447 ap.getAnnotationPanel().paint(
448 ap.getAnnotationPanel().getGraphics());
452 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
457 // av and sequencegroup need to implement same interface for
458 if (aaa.groupRef != null)
460 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
461 MessageManager.getString("label.show_group_histogram"),
462 aa[selectedRow].groupRef.isShowConsensusHistogram());
463 chist.addActionListener(new ActionListener()
466 public void actionPerformed(ActionEvent e)
468 // TODO: pass on reference
474 aaa.groupRef.setShowConsensusHistogram(chist.getState());
476 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
480 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
481 MessageManager.getString("label.show_group_logo"),
482 aa[selectedRow].groupRef.isShowSequenceLogo());
483 cprofl.addActionListener(new ActionListener()
486 public void actionPerformed(ActionEvent e)
488 // TODO: pass on reference
494 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
496 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
500 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
501 MessageManager.getString("label.normalise_group_logo"),
502 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
503 cproflnorm.addActionListener(new ActionListener()
506 public void actionPerformed(ActionEvent e)
509 // TODO: pass on reference
515 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
516 // automatically enable logo display if we're clicked
517 aaa.groupRef.setshowSequenceLogo(true);
519 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
526 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
527 MessageManager.getString("label.show_histogram"),
528 av.isShowConsensusHistogram());
529 chist.addActionListener(new ActionListener()
532 public void actionPerformed(ActionEvent e)
534 // TODO: pass on reference
540 av.setShowConsensusHistogram(chist.getState());
541 ap.alignFrame.setMenusForViewport();
543 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
547 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
548 MessageManager.getString("label.show_logo"),
549 av.isShowSequenceLogo());
550 cprof.addActionListener(new ActionListener()
553 public void actionPerformed(ActionEvent e)
555 // TODO: pass on reference
561 av.setShowSequenceLogo(cprof.getState());
562 ap.alignFrame.setMenusForViewport();
564 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
568 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
569 MessageManager.getString("label.normalise_logo"),
570 av.isNormaliseSequenceLogo());
571 cprofnorm.addActionListener(new ActionListener()
574 public void actionPerformed(ActionEvent e)
576 // TODO: pass on reference
582 av.setShowSequenceLogo(true);
583 av.setNormaliseSequenceLogo(cprofnorm.getState());
584 ap.alignFrame.setMenusForViewport();
586 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
591 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
592 consclipbrd.addActionListener(this);
593 pop.add(consclipbrd);
596 pop.show(this, evt.getX(), evt.getY());
607 public void mouseReleased(MouseEvent evt)
609 int start = selectedRow;
610 getSelectedRow(evt.getY() - getScrollOffset());
611 int end = selectedRow;
615 // Swap these annotations
616 AlignmentAnnotation startAA = ap.av.getAlignment()
617 .getAlignmentAnnotation()[start];
620 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
622 AlignmentAnnotation endAA = ap.av.getAlignment()
623 .getAlignmentAnnotation()[end];
625 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
626 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
632 ap.getAnnotationPanel().repaint();
642 public void mouseEntered(MouseEvent evt)
658 public void mouseExited(MouseEvent evt)
660 if (dragEvent == null)
674 public void mouseDragged(MouseEvent evt)
680 Dimension d = ap.annotationScroller.getPreferredSize();
681 int dif = evt.getY() - oldY;
683 dif /= ap.av.getCharHeight();
684 dif *= ap.av.getCharHeight();
686 if ((d.height - dif) > 20)
688 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
690 d = ap.annotationSpaceFillerHolder.getPreferredSize();
691 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
692 d.width, d.height - dif));
693 ap.paintAlignment(true);
711 public void mouseMoved(MouseEvent evt)
713 resizePanel = evt.getY() < 10;
715 getSelectedRow(evt.getY() - getScrollOffset());
718 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
720 AlignmentAnnotation aa = ap.av.getAlignment()
721 .getAlignmentAnnotation()[selectedRow];
723 StringBuffer desc = new StringBuffer();
724 if (aa.description != null
725 && !aa.description.equals("New description"))
727 // TODO: we could refactor and merge this code with the code in
728 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
730 desc.append(aa.getDescription(true).trim());
731 // check to see if the description is an html fragment.
732 if (desc.length() < 6
733 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
735 // clean the description ready for embedding in html
736 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
737 .replaceAll("<"));
738 desc.insert(0, "<html>");
742 // remove terminating html if any
743 int i = desc.substring(desc.length() - 7).toLowerCase()
744 .lastIndexOf("</html>");
747 desc.setLength(desc.length() - 7 + i);
752 desc.append("<br/>");
754 // if (aa.hasProperties())
756 // desc.append("<table>");
757 // for (String prop : aa.getProperties())
759 // desc.append("<tr><td>" + prop + "</td><td>"
760 // + aa.getProperty(prop) + "</td><tr>");
762 // desc.append("</table>");
767 // begin the tooltip's html fragment
768 desc.append("<html>");
771 // TODO: limit precision of score to avoid noise from imprecise
773 // (64.7 becomes 64.7+/some tiny value).
774 desc.append(" Score: " + aa.score);
777 if (desc.length() > 6)
779 desc.append("</html>");
780 this.setToolTipText(desc.toString());
784 this.setToolTipText(null);
790 public void mouseClicked(MouseEvent evt)
792 final AlignmentAnnotation[] aa = ap.av.getAlignment()
793 .getAlignmentAnnotation();
794 if (!evt.isPopupTrigger() && SwingUtilities.isLeftMouseButton(evt))
796 if (selectedRow > -1 && selectedRow < aa.length)
798 if (aa[selectedRow].groupRef != null)
800 if (evt.getClickCount() >= 2)
802 // todo: make the ap scroll to the selection - not necessary, first
803 // click highlights/scrolls, second selects
804 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
805 ap.av.setSelectionGroup(// new SequenceGroup(
806 aa[selectedRow].groupRef); // );
807 ap.paintAlignment(false);
808 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
809 ap.av.sendSelection();
813 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(
814 aa[selectedRow].groupRef.getSequences(null));
818 else if (aa[selectedRow].sequenceRef != null)
820 if (evt.getClickCount() == 1)
824 .highlightSearchResults(
825 Arrays.asList(new SequenceI[] { aa[selectedRow].sequenceRef }));
827 else if (evt.getClickCount() >= 2)
829 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
830 SequenceGroup sg = ap.av.getSelectionGroup();
833 // we make a copy rather than edit the current selection if no
835 // see Enhancement JAL-1557
836 if (!(evt.isControlDown() || evt.isShiftDown()))
838 sg = new SequenceGroup(sg);
840 sg.addSequence(aa[selectedRow].sequenceRef, false);
844 if (evt.isControlDown())
846 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
850 // notionally, we should also add intermediate sequences from
851 // last added sequence ?
852 sg.addSequence(aa[selectedRow].sequenceRef, true);
858 sg = new SequenceGroup();
860 sg.setEndRes(ap.av.getAlignment().getWidth() - 1);
861 sg.addSequence(aa[selectedRow].sequenceRef, false);
863 ap.av.setSelectionGroup(sg);
864 ap.av.sendSelection();
865 ap.paintAlignment(false);
866 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
876 * do a single sequence copy to jalview and the system clipboard
879 * sequence to be copied to clipboard
881 protected void copy_annotseqtoclipboard(SequenceI sq)
883 SequenceI[] seqs = new SequenceI[] { sq };
884 String[] omitHidden = null;
885 SequenceI[] dseqs = new SequenceI[] { sq.getDatasetSequence() };
886 if (dseqs[0] == null)
888 dseqs[0] = new Sequence(sq);
889 dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(
890 jalview.util.Comparison.GapChars, sq.getSequenceAsString()));
892 sq.setDatasetSequence(dseqs[0]);
894 Alignment ds = new Alignment(dseqs);
895 if (av.hasHiddenColumns())
897 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
898 sq.getLength(), seqs);
901 int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
902 List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
903 if (hiddenCols != null)
905 alignmentStartEnd = av.getAlignment().getVisibleStartAndEndIndex(
908 String output = new FormatAdapter().formatSequences("Fasta", seqs,
909 omitHidden, alignmentStartEnd);
911 Toolkit.getDefaultToolkit().getSystemClipboard()
912 .setContents(new StringSelection(output), Desktop.instance);
914 ArrayList<int[]> hiddenColumns = null;
915 if (av.hasHiddenColumns())
917 hiddenColumns = new ArrayList<int[]>();
918 for (int[] region : av.getColumnSelection().getHiddenColumns())
920 hiddenColumns.add(new int[] { region[0], region[1] });
924 Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
926 // sequence ? need to
928 // sequence as special.
939 public void paintComponent(Graphics g)
942 int width = getWidth();
945 width = ap.calculateIdWidth().width + 4;
948 Graphics2D g2 = (Graphics2D) g;
951 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
952 RenderingHints.VALUE_ANTIALIAS_ON);
955 drawComponent(g2, true, width);
960 * Draw the full set of annotation Labels for the alignment at the given
964 * Graphics2D instance (needed for font scaling)
966 * Width for scaling labels
969 public void drawComponent(Graphics g, int width)
971 drawComponent(g, false, width);
974 private final boolean debugRedraw = false;
977 * Draw the full set of annotation Labels for the alignment at the given
981 * Graphics2D instance (needed for font scaling)
983 * - true indicates that only current visible area needs to be
986 * Width for scaling labels
988 public void drawComponent(Graphics g, boolean clip, int width)
990 if (av.getFont().getSize() < 10)
996 g.setFont(av.getFont());
999 FontMetrics fm = g.getFontMetrics(g.getFont());
1000 g.setColor(Color.white);
1001 g.fillRect(0, 0, getWidth(), getHeight());
1003 g.translate(0, getScrollOffset());
1004 g.setColor(Color.black);
1006 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
1007 int fontHeight = g.getFont().getSize();
1010 int graphExtras = 0;
1012 Font baseFont = g.getFont();
1013 FontMetrics baseMetrics = fm;
1014 int ofontH = fontHeight;
1017 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap
1018 .getAnnotationPanel().getVisibleVRange() : null;
1019 if (clip && visr != null)
1022 visHeight = visr[1];
1024 boolean visible = true, before = false, after = false;
1027 hasHiddenRows = false;
1029 for (int i = 0; i < aa.length; i++)
1034 hasHiddenRows = true;
1047 System.out.println("before vis: " + i);
1051 // don't draw what isn't visible
1054 if (olY > visHeight)
1061 System.out.println("Scroll offset: " + sOffset
1062 + " after vis: " + i);
1066 // don't draw what isn't visible
1070 g.setColor(Color.black);
1072 offset = -aa[i].height / 2;
1076 offset += fm.getHeight() / 2;
1077 offset -= fm.getDescent();
1081 offset += fm.getDescent();
1084 x = width - fm.stringWidth(aa[i].label) - 3;
1086 if (aa[i].graphGroup > -1)
1089 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1090 // computed efficiently for all visible labels
1091 for (int gg = 0; gg < aa.length; gg++)
1093 if (aa[gg].graphGroup == aa[i].graphGroup)
1098 if (groupSize * (fontHeight + 8) < aa[i].height)
1100 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1104 // scale font to fit
1105 float h = aa[i].height / (float) groupSize, s;
1112 fontHeight = -8 + (int) h;
1113 s = ((float) fontHeight) / (float) ofontH;
1114 Font f = baseFont.deriveFont(AffineTransform
1115 .getScaleInstance(s, s));
1117 fm = g.getFontMetrics();
1118 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1123 for (int gg = 0; gg < aa.length; gg++)
1125 if (aa[gg].graphGroup == aa[i].graphGroup)
1127 x = width - fm.stringWidth(aa[gg].label) - 3;
1128 g.drawString(aa[gg].label, x, y - graphExtras);
1130 if (aa[gg]._linecolour != null)
1133 g.setColor(aa[gg]._linecolour);
1134 g.drawLine(x, y - graphExtras + 3,
1135 x + fm.stringWidth(aa[gg].label), y - graphExtras
1139 g.setColor(Color.black);
1140 graphExtras += fontHeight + 8;
1144 g.setFont(baseFont);
1146 fontHeight = ofontH;
1150 g.drawString(aa[i].label, x, y + offset);
1157 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1159 else if (dragEvent != null && aa != null)
1161 g.setColor(Color.lightGray);
1162 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1163 dragEvent.getY() - getScrollOffset());
1166 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1168 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1169 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1174 public int getScrollOffset()
1176 return scrollOffset;