+ int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, null);
+ width = Math.max(newAnnotationIdWidth, givenWidth);
+ }
+ drawLabels(g, clip, width, true, forGUI, null);
+ }
+
+ /**
+ * Render the full set of annotation Labels for the alignment at the given
+ * cursor. If actuallyDraw is false or g is null then no actual drawing will
+ * occur, but the widest label width will be returned. If g is null then
+ * fmetrics must be supplied.
+ *
+ * Returns the width of the annotation labels.
+ *
+ * @param g
+ * Graphics2D instance (used for rendering and font scaling if no fmetrics supplied)
+ * @param clip
+ * - true indicates that only current visible area needs to be
+ * rendered
+ * @param width
+ * Width for scaling labels
+ * @param actuallyDraw - when false, no graphics are rendered to g0
+ * @param forGUI - when false, GUI relevant marks like indicators for dragging annotation panel height are not rendered
+ * @param fmetrics
+ * FontMetrics if Graphics object g is null
+ */
+ public int drawLabels(Graphics g0, boolean clip, int width,
+ boolean actuallyDraw, boolean forGUI, FontMetrics fmetrics)
+ {
+ if (clip)
+ {
+ clip = Cache.getDefault("MOVE_SEQUENCE_ID_WITH_VISIBLE_ANNOTATIONS",
+ true);
+ }
+ Graphics g = null;
+ // create a dummy Graphics object if not drawing and one is supplied
+ if (g0 != null)
+ {
+ if (!actuallyDraw)
+ {
+ Graphics2D g2d = (Graphics2D) g0;
+ g = g2d.create();
+ }
+ else
+ {
+ g = g0;
+ }
+ }
+ int actualWidth = 0;
+ if (g != null)
+ {
+ if (av.getFont().getSize() < 10)
+ {
+ g.setFont(font);
+ }
+ else
+ {
+ g.setFont(av.getFont());
+ }