{
return calculateIdWidth(maxwidth, true, false);
}
-
+ /**
+ * Calculate the width of the alignment labels based on the displayed names
+ * and any bounds on label width set in preferences.
+ *
+ * @param maxwidth
+ * -1 or maximum width allowed for IdWidth
+ * @param includeAnnotations - when true includes width of any additional marks in annotation id panel
+ * @param visibleOnly -
+ * @return Dimension giving the maximum width of the alignment label panel
+ * that should be used.
+ */
public Dimension calculateIdWidth(int maxwidth,
boolean includeAnnotations, boolean visibleOnly)
{
{
AnnotationLabels aal = getAlabels();
int stringWidth = aal.drawLabels(null, false, idWidth, false, false,
- fm);
+ fm,false);
idWidth = Math.max(idWidth, stringWidth);
}
else
Graphics2D g2d = (Graphics2D) g;
Graphics dummy = g2d.create();
int newAnnotationIdWidth = drawLabels(dummy, clip, width, false, forGUI,
- null);
+ null, false);
dummy.dispose();
Dimension d = ap.calculateDefaultAlignmentIdWidth();
int alignmentIdWidth = d.width;
}
else
{
- int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, null);
+ int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, null, false);
width = Math.max(newAnnotationIdWidth, givenWidth);
}
- drawLabels(g, clip, width, true, forGUI, null);
+ drawLabels(g, clip, width, true, forGUI, null, false);
}
/**
* 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
* @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 actuallyDraw, boolean forGUI, FontMetrics fmetrics, boolean includeHidden)
{
if (clip)
{
for (int i = 0; i < aa.length; i++)
{
visible = true;
- if (!aa[i].visible)
+ if (!aa[i].visible && !includeHidden)
{
hasHiddenRows = true;
continue;
olY = y;
// look ahead to next annotation
for (nexAA = i + 1; nexAA < aa.length
- && !aa[nexAA].visible; nexAA++)
+ && (!aa[nexAA].visible && includeHidden); nexAA++)
;
y += aa[i].height;
if (clip)