+ public void drawComponent(Graphics g, boolean clip, int givenWidth)
+ {
+ int width = givenWidth;
+ IdwidthAdjuster iwa = ap.idwidthAdjuster;
+ if ((Cache.getDefault(ADJUST_ANNOTATION_LABELS_WIDTH_PREF, true)
+ || Jalview.isHeadlessMode()) && !iwa.manuallyAdjusted())
+ {
+ Graphics2D g2d = (Graphics2D) g;
+ Graphics dummy = g2d.create();
+ int annotationIdWidth = drawLabels(dummy, clip, width, false);
+ Dimension d = ap.calculateDefaultAlignmentIdWidth();
+ int alignmentIdWidth = d.width;
+ if (!iwa.manuallyAdjusted())
+ {
+ // If no manual adjustment to ID column with has been made then adjust
+ // width match widest of alignment or annotation id widths
+ width = Math.max(alignmentIdWidth, annotationIdWidth);
+ }
+ else if (annotationIdWidth > givenWidth
+ && annotationIdWidth > alignmentIdWidth)
+ {
+ // otherwise if the annotation id width has become larger than the
+ // current id width, increase
+ width = annotationIdWidth;
+ }
+ // set the width if it's changed
+ if (width != ap.av.getIdWidth())
+ {
+ iwa.setWidth(width);
+ ap.validateAnnotationDimensions(false);
+ }
+ }
+ drawLabels(g, clip, width, true);
+ }
+
+ /**
+ * Render the full set of annotation Labels for the alignment at the given
+ * cursor. If actuallyDraw is false then no actual drawing will occur, but the
+ * widest label width will be returned.
+ *
+ * @param g
+ * Graphics2D instance (needed for font scaling)
+ * @param clip
+ * - true indicates that only current visible area needs to be
+ * rendered
+ * @param width
+ * Width for scaling labels
+ */
+ public int drawLabels(Graphics g, boolean clip, int width,
+ boolean actuallyDraw)