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]);
247 ap.av.getCalcManager().removeWorkerForAnnotation(aa[selectedRow]);
249 else if (evt.getActionCommand().equals(SHOWALL))
251 for (int i = 0; i < aa.length; i++)
253 if (!aa[i].visible && aa[i].annotations != null)
255 aa[i].visible = true;
259 else if (evt.getActionCommand().equals(OUTPUT_TEXT))
261 new AnnotationExporter().exportAnnotations(ap,
262 new AlignmentAnnotation[] { aa[selectedRow] });
264 else if (evt.getActionCommand().equals(COPYCONS_SEQ))
266 SequenceI cons = null;
267 if (aa[selectedRow].groupRef != null)
269 cons = aa[selectedRow].groupRef.getConsensusSeq();
273 cons = av.getConsensusSeq();
277 copy_annotseqtoclipboard(cons);
281 else if (evt.getActionCommand().equals(TOGGLE_LABELSCALE))
283 aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel;
293 protected void refresh()
295 ap.validateAnnotationDimensions(false);
306 boolean editLabelDescription(AlignmentAnnotation annotation)
308 EditNameDialog dialog = new EditNameDialog(annotation.label,
309 annotation.description, " Annotation Name ",
310 "Annotation Description ", "Edit Annotation Name/Description",
318 annotation.label = dialog.getName();
320 String text = dialog.getDescription();
321 if (text != null && text.length() == 0)
325 annotation.description = text;
337 public void mousePressed(MouseEvent evt)
339 getSelectedRow(evt.getY() - getScrollOffset());
350 public void mouseReleased(MouseEvent evt)
352 int start = selectedRow;
353 getSelectedRow(evt.getY() - getScrollOffset());
354 int end = selectedRow;
358 // Swap these annotations
359 AlignmentAnnotation startAA = ap.av.getAlignment()
360 .getAlignmentAnnotation()[start];
363 end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
365 AlignmentAnnotation endAA = ap.av.getAlignment()
366 .getAlignmentAnnotation()[end];
368 ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
369 ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
375 ap.getAnnotationPanel().repaint();
385 public void mouseEntered(MouseEvent evt)
401 public void mouseExited(MouseEvent evt)
403 if (dragEvent == null)
417 public void mouseDragged(MouseEvent evt)
423 Dimension d = ap.annotationScroller.getPreferredSize();
424 int dif = evt.getY() - oldY;
426 dif /= ap.av.getCharHeight();
427 dif *= ap.av.getCharHeight();
429 if ((d.height - dif) > 20)
431 ap.annotationScroller.setPreferredSize(new Dimension(d.width,
433 d = ap.annotationSpaceFillerHolder.getPreferredSize();
434 ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(
435 d.width, d.height - dif));
436 ap.paintAlignment(true);
454 public void mouseMoved(MouseEvent evt)
456 resizePanel = evt.getY() < 10;
458 getSelectedRow(evt.getY() - getScrollOffset());
461 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
463 AlignmentAnnotation aa = ap.av.getAlignment()
464 .getAlignmentAnnotation()[selectedRow];
466 StringBuffer desc = new StringBuffer();
467 if (aa.description != null
468 && !aa.description.equals("New description"))
470 // TODO: we could refactor and merge this code with the code in
471 // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
473 desc.append(aa.getDescription(true).trim());
474 // check to see if the description is an html fragment.
475 if (desc.length() < 6
476 || (desc.substring(0, 6).toLowerCase().indexOf("<html>") < 0))
478 // clean the description ready for embedding in html
479 desc = new StringBuffer(LEFT_ANGLE_BRACKET_PATTERN.matcher(desc)
480 .replaceAll("<"));
481 desc.insert(0, "<html>");
485 // remove terminating html if any
486 int i = desc.substring(desc.length() - 7).toLowerCase()
487 .lastIndexOf("</html>");
490 desc.setLength(desc.length() - 7 + i);
495 desc.append("<br/>");
497 // if (aa.hasProperties())
499 // desc.append("<table>");
500 // for (String prop : aa.getProperties())
502 // desc.append("<tr><td>" + prop + "</td><td>"
503 // + aa.getProperty(prop) + "</td><tr>");
505 // desc.append("</table>");
510 // begin the tooltip's html fragment
511 desc.append("<html>");
514 // TODO: limit precision of score to avoid noise from imprecise
516 // (64.7 becomes 64.7+/some tiny value).
517 desc.append(" Score: " + aa.score);
520 if (desc.length() > 6)
522 desc.append("</html>");
523 this.setToolTipText(desc.toString());
527 this.setToolTipText(null);
539 public void mouseClicked(MouseEvent evt)
541 final AlignmentAnnotation[] aa = ap.av.getAlignment()
542 .getAlignmentAnnotation();
543 if (SwingUtilities.isLeftMouseButton(evt))
545 if (selectedRow > -1 && selectedRow < aa.length)
547 if (aa[selectedRow].groupRef != null)
549 if (evt.getClickCount() >= 2)
551 // todo: make the ap scroll to the selection - not necessary, first
552 // click highlights/scrolls, second selects
553 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
554 ap.av.setSelectionGroup(// new SequenceGroup(
555 aa[selectedRow].groupRef); // );
556 ap.paintAlignment(false);
557 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
558 ap.av.sendSelection();
562 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(
563 aa[selectedRow].groupRef.getSequences(null));
567 else if (aa[selectedRow].sequenceRef != null)
569 if (evt.getClickCount() == 1)
573 .highlightSearchResults(
574 Arrays.asList(new SequenceI[] { aa[selectedRow].sequenceRef }));
576 else if (evt.getClickCount() >= 2)
578 ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
579 SequenceGroup sg = ap.av.getSelectionGroup();
582 // we make a copy rather than edit the current selection if no
584 // see Enhancement JAL-1557
585 if (!(evt.isControlDown() || evt.isShiftDown()))
587 sg = new SequenceGroup(sg);
589 sg.addSequence(aa[selectedRow].sequenceRef, false);
593 if (evt.isControlDown())
595 sg.addOrRemove(aa[selectedRow].sequenceRef, true);
599 // notionally, we should also add intermediate sequences from
600 // last added sequence ?
601 sg.addSequence(aa[selectedRow].sequenceRef, true);
607 sg = new SequenceGroup();
609 sg.setEndRes(ap.av.getAlignment().getWidth() - 1);
610 sg.addSequence(aa[selectedRow].sequenceRef, false);
612 ap.av.setSelectionGroup(sg);
613 ap.av.sendSelection();
614 ap.paintAlignment(false);
615 PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
621 // if (!evt.isPopupTrigger())
626 JPopupMenu pop = new JPopupMenu(
627 MessageManager.getString("label.annotations"));
628 JMenuItem item = new JMenuItem(ADDNEW);
629 item.addActionListener(this);
634 { // let the user make everything visible again
635 item = new JMenuItem(SHOWALL);
636 item.addActionListener(this);
639 pop.show(this, evt.getX(), evt.getY());
642 item = new JMenuItem(EDITNAME);
643 item.addActionListener(this);
645 item = new JMenuItem(HIDE);
646 item.addActionListener(this);
648 // JAL-1264 hide all sequence-specific annotations of this type
649 if (selectedRow < aa.length)
651 if (aa[selectedRow].sequenceRef != null)
653 final String label = aa[selectedRow].label;
654 JMenuItem hideType = new JMenuItem();
655 String text = MessageManager.getString("label.hide_all") + " "
657 hideType.setText(text);
658 hideType.addActionListener(new ActionListener()
661 public void actionPerformed(ActionEvent e)
663 AlignmentUtils.showOrHideSequenceAnnotations(
664 ap.av.getAlignment(), Collections.singleton(label),
666 // for (AlignmentAnnotation ann : ap.av.getAlignment()
667 // .getAlignmentAnnotation())
669 // if (ann.sequenceRef != null && ann.label != null
670 // && ann.label.equals(label))
672 // ann.visible = false;
681 item = new JMenuItem(DELETE);
682 item.addActionListener(this);
686 item = new JMenuItem(SHOWALL);
687 item.addActionListener(this);
690 item = new JMenuItem(OUTPUT_TEXT);
691 item.addActionListener(this);
693 // TODO: annotation object should be typed for autocalculated/derived
695 if (selectedRow < aa.length)
697 final String label = aa[selectedRow].label;
698 if (!aa[selectedRow].autoCalculated)
700 if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
702 // display formatting settings for this row.
704 // av and sequencegroup need to implement same interface for
705 item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
706 aa[selectedRow].scaleColLabel);
707 item.addActionListener(this);
711 else if (label.indexOf("Consensus") > -1)
714 // av and sequencegroup need to implement same interface for
715 final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
716 MessageManager.getString("label.ignore_gaps_consensus"),
717 (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
718 .getIgnoreGapsConsensus() : ap.av
719 .isIgnoreGapsConsensus());
720 final AlignmentAnnotation aaa = aa[selectedRow];
721 cbmi.addActionListener(new ActionListener()
724 public void actionPerformed(ActionEvent e)
726 if (aaa.groupRef != null)
728 // TODO: pass on reference to ap so the view can be updated.
729 aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
730 ap.getAnnotationPanel().paint(
731 ap.getAnnotationPanel().getGraphics());
735 ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
740 // av and sequencegroup need to implement same interface for
741 if (aaa.groupRef != null)
743 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
744 MessageManager.getString("label.show_group_histogram"),
745 aa[selectedRow].groupRef.isShowConsensusHistogram());
746 chist.addActionListener(new ActionListener()
749 public void actionPerformed(ActionEvent e)
751 // TODO: pass on reference
757 aaa.groupRef.setShowConsensusHistogram(chist.getState());
759 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
763 final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
764 MessageManager.getString("label.show_group_logo"),
765 aa[selectedRow].groupRef.isShowSequenceLogo());
766 cprofl.addActionListener(new ActionListener()
769 public void actionPerformed(ActionEvent e)
771 // TODO: pass on reference
777 aaa.groupRef.setshowSequenceLogo(cprofl.getState());
779 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
783 final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
784 MessageManager.getString("label.normalise_group_logo"),
785 aa[selectedRow].groupRef.isNormaliseSequenceLogo());
786 cproflnorm.addActionListener(new ActionListener()
789 public void actionPerformed(ActionEvent e)
792 // TODO: pass on reference
798 aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
799 // automatically enable logo display if we're clicked
800 aaa.groupRef.setshowSequenceLogo(true);
802 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
809 final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
810 MessageManager.getString("label.show_histogram"),
811 av.isShowConsensusHistogram());
812 chist.addActionListener(new ActionListener()
815 public void actionPerformed(ActionEvent e)
817 // TODO: pass on reference
823 av.setShowConsensusHistogram(chist.getState());
824 ap.alignFrame.setMenusForViewport();
826 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
830 final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
831 MessageManager.getString("label.show_logo"),
832 av.isShowSequenceLogo());
833 cprof.addActionListener(new ActionListener()
836 public void actionPerformed(ActionEvent e)
838 // TODO: pass on reference
844 av.setShowSequenceLogo(cprof.getState());
845 ap.alignFrame.setMenusForViewport();
847 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
851 final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
852 MessageManager.getString("label.normalise_logo"),
853 av.isNormaliseSequenceLogo());
854 cprofnorm.addActionListener(new ActionListener()
857 public void actionPerformed(ActionEvent e)
859 // TODO: pass on reference
865 av.setShowSequenceLogo(true);
866 av.setNormaliseSequenceLogo(cprofnorm.getState());
867 ap.alignFrame.setMenusForViewport();
869 // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
874 final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
875 consclipbrd.addActionListener(this);
876 pop.add(consclipbrd);
879 pop.show(this, evt.getX(), evt.getY());
883 * do a single sequence copy to jalview and the system clipboard
886 * sequence to be copied to clipboard
888 protected void copy_annotseqtoclipboard(SequenceI sq)
890 SequenceI[] seqs = new SequenceI[] { sq };
891 String[] omitHidden = null;
892 SequenceI[] dseqs = new SequenceI[] { sq.getDatasetSequence() };
893 if (dseqs[0] == null)
895 dseqs[0] = new Sequence(sq);
896 dseqs[0].setSequence(jalview.analysis.AlignSeq.extractGaps(
897 jalview.util.Comparison.GapChars, sq.getSequenceAsString()));
899 sq.setDatasetSequence(dseqs[0]);
901 Alignment ds = new Alignment(dseqs);
902 if (av.hasHiddenColumns())
904 omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
905 sq.getLength(), seqs);
908 int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
909 List<int[]> hiddenCols = av.getColumnSelection().getHiddenColumns();
910 if (hiddenCols != null)
912 alignmentStartEnd = av.getAlignment().getVisibleStartAndEndIndex(
915 String output = new FormatAdapter().formatSequences("Fasta", seqs,
916 omitHidden, alignmentStartEnd);
918 Toolkit.getDefaultToolkit().getSystemClipboard()
919 .setContents(new StringSelection(output), Desktop.instance);
921 ArrayList<int[]> hiddenColumns = null;
922 if (av.hasHiddenColumns())
924 hiddenColumns = new ArrayList<int[]>();
925 for (int[] region : av.getColumnSelection().getHiddenColumns())
927 hiddenColumns.add(new int[] { region[0], region[1] });
931 Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
933 // sequence ? need to
935 // sequence as special.
946 public void paintComponent(Graphics g)
949 int width = getWidth();
952 width = ap.calculateIdWidth().width + 4;
955 Graphics2D g2 = (Graphics2D) g;
958 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
959 RenderingHints.VALUE_ANTIALIAS_ON);
962 drawComponent(g2, true, width);
967 * Draw the full set of annotation Labels for the alignment at the given
971 * Graphics2D instance (needed for font scaling)
973 * Width for scaling labels
976 public void drawComponent(Graphics g, int width)
978 drawComponent(g, false, width);
981 private final boolean debugRedraw = false;
984 * Draw the full set of annotation Labels for the alignment at the given
988 * Graphics2D instance (needed for font scaling)
990 * - true indicates that only current visible area needs to be
993 * Width for scaling labels
995 public void drawComponent(Graphics g, boolean clip, int width)
997 if (av.getFont().getSize() < 10)
1003 g.setFont(av.getFont());
1006 FontMetrics fm = g.getFontMetrics(g.getFont());
1007 g.setColor(Color.white);
1008 g.fillRect(0, 0, getWidth(), getHeight());
1010 g.translate(0, getScrollOffset());
1011 g.setColor(Color.black);
1013 AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
1014 int fontHeight = g.getFont().getSize();
1017 int graphExtras = 0;
1019 Font baseFont = g.getFont();
1020 FontMetrics baseMetrics = fm;
1021 int ofontH = fontHeight;
1024 int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap
1025 .getAnnotationPanel().getVisibleVRange() : null;
1026 if (clip && visr != null)
1029 visHeight = visr[1];
1031 boolean visible = true, before = false, after = false;
1034 hasHiddenRows = false;
1036 for (int i = 0; i < aa.length; i++)
1041 hasHiddenRows = true;
1054 System.out.println("before vis: " + i);
1058 // don't draw what isn't visible
1061 if (olY > visHeight)
1068 System.out.println("Scroll offset: " + sOffset
1069 + " after vis: " + i);
1073 // don't draw what isn't visible
1077 g.setColor(Color.black);
1079 offset = -aa[i].height / 2;
1083 offset += fm.getHeight() / 2;
1084 offset -= fm.getDescent();
1088 offset += fm.getDescent();
1091 x = width - fm.stringWidth(aa[i].label) - 3;
1093 if (aa[i].graphGroup > -1)
1096 // TODO: JAL-1291 revise rendering model so the graphGroup map is
1097 // computed efficiently for all visible labels
1098 for (int gg = 0; gg < aa.length; gg++)
1100 if (aa[gg].graphGroup == aa[i].graphGroup)
1105 if (groupSize * (fontHeight + 8) < aa[i].height)
1107 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1111 // scale font to fit
1112 float h = aa[i].height / (float) groupSize, s;
1119 fontHeight = -8 + (int) h;
1120 s = ((float) fontHeight) / (float) ofontH;
1121 Font f = baseFont.deriveFont(AffineTransform
1122 .getScaleInstance(s, s));
1124 fm = g.getFontMetrics();
1125 graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
1130 for (int gg = 0; gg < aa.length; gg++)
1132 if (aa[gg].graphGroup == aa[i].graphGroup)
1134 x = width - fm.stringWidth(aa[gg].label) - 3;
1135 g.drawString(aa[gg].label, x, y - graphExtras);
1137 if (aa[gg]._linecolour != null)
1140 g.setColor(aa[gg]._linecolour);
1141 g.drawLine(x, y - graphExtras + 3,
1142 x + fm.stringWidth(aa[gg].label), y - graphExtras
1146 g.setColor(Color.black);
1147 graphExtras += fontHeight + 8;
1151 g.setFont(baseFont);
1153 fontHeight = ofontH;
1157 g.drawString(aa[i].label, x, y + offset);
1164 g.drawImage(image, 2, 0 - getScrollOffset(), this);
1166 else if (dragEvent != null && aa != null)
1168 g.setColor(Color.lightGray);
1169 g.drawString(aa[selectedRow].label, dragEvent.getX(),
1170 dragEvent.getY() - getScrollOffset());
1173 if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
1175 g.drawString(MessageManager.getString("label.right_click"), 2, 8);
1176 g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
1181 public int getScrollOffset()
1183 return scrollOffset;