+ /**
+ * 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.
+ *
+ * @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
+ * @param includeHidden
+ * - when true returned width includes labels in hidden row width
+ * calculation
+ * @return the width of the annotation labels.
+ */
+ public int drawLabels(Graphics g0, boolean clip, int width,
+ boolean actuallyDraw, boolean forGUI, FontMetrics fmetrics,
+ boolean includeHidden)
+ {
+ 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());
+ }
+ }
+
+ FontMetrics fm = fmetrics == null ? g.getFontMetrics(g.getFont())
+ : fmetrics;
+ if (actuallyDraw)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ if (!Cache.getDefault(RESIZE_MARGINS_MARK_PREF, false)
+ && !av.getWrapAlignment() && forGUI)
+ {
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(0, HEIGHT_ADJUSTER_HEIGHT / 4, HEIGHT_ADJUSTER_WIDTH / 4,
+ HEIGHT_ADJUSTER_HEIGHT / 4);
+ g.drawLine(0, 3 * HEIGHT_ADJUSTER_HEIGHT / 4,
+ HEIGHT_ADJUSTER_WIDTH / 4, 3 * HEIGHT_ADJUSTER_HEIGHT / 4);