import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.bin.Jalview;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SearchResultsI;
int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3);
int maxwidth = Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth);
- return calculateIdWidth(-1);
+ return calculateIdWidth(-1, false, true);
}
/**
*/
protected Dimension calculateIdWidth(int maxwidth)
{
+ return calculateIdWidth(maxwidth, true, false);
+ }
+
+ public Dimension calculateIdWidth(int maxwidth,
+ boolean includeAnnotations, boolean visibleOnly)
+ {
Container c = new Container();
FontMetrics fm = c.getFontMetrics(
}
// Also check annotation label widths
- i = 0;
-
- if (al.getAlignmentAnnotation() != null)
+ if (includeAnnotations && al.getAlignmentAnnotation() != null)
{
fm = c.getFontMetrics(getAlabels().getFont());
- while (i < al.getAlignmentAnnotation().length)
+ for (i = 0; i < al.getAlignmentAnnotation().length; i++)
{
- String label = al.getAlignmentAnnotation()[i].label;
+ AlignmentAnnotation aa = al.getAlignmentAnnotation()[i];
+ if (visibleOnly && !aa.visible)
+ {
+ continue;
+ }
+ String label = aa.label;
int stringWidth = fm.stringWidth(label);
idWidth = Math.max(idWidth, stringWidth);
- i++;
}
}