{ type.getLabel() }), pSessionId);
}
}
+
+ /*
+ * cache preferences in case we need to fudge them for export of
+ * split frame with 'protein scaled to codons' and 'auto id width'
+ */
+
+ final boolean autoIdWidth = Cache.getDefault("FIGURE_AUTOIDWIDTH",
+ false);
+ final Integer fixedIdWidth = Cache
+ .getIntegerProperty("FIGURE_FIXEDIDWIDTH");
+
try
{
/*
* if exporting a split frame image, the graphics object has
* width: maximum of the top and bottom image widths
* height: sum of the top and bottom image heights
+ * if 'protein scaled to codons' and 'auto id width', fudge
+ * to a fixed width (and restore preferences afterwards)
*/
- AlignmentPanel comp = null;
+ AlignmentPanel complement = null;
AlignmentDimension dim1 = getAlignmentDimension();
AlignmentDimension dim2 = new AlignmentDimension(0, 0);
+
if (forSplitFrame)
{
- comp = ((AlignViewport) av.getCodingComplement())
+ complement = ((AlignViewport) av.getCodingComplement())
.getAlignPanel();
- dim2 = comp.getAlignmentDimension();
+ dim2 = complement.getAlignmentDimension();
+ if (autoIdWidth && av.isScaleProteinAsCdna())
+ {
+ int w1 = this.getVisibleIdWidth(false);
+ int w2 = complement.getVisibleIdWidth(false);
+ Cache.setProperty("FIGURE_AUTOIDWIDTH", Boolean.FALSE.toString());
+ Cache.setProperty("FIGURE_FIXEDIDWIDTH",
+ String.valueOf(Math.max(w1, w2)));
+ }
}
final int graphicsHeight = dim1.height + dim2.height
+ borderBottomOffset;
// graphics.drawString("Hello world", 0, 0);
if (av.getCodingComplement().getWrapAlignment())
{
- comp.printWrappedAlignment(dim2.width,
+ complement.printWrappedAlignment(dim2.width,
dim2.height + borderBottomOffset, 0, graphics, false);
}
else
{
- comp.printUnwrapped(dim2.width, dim2.height, 0, graphics,
+ complement.printUnwrapped(dim2.width, dim2.height, 0, graphics,
graphics);
}
}
} catch (Exception ex)
{
ex.printStackTrace();
+ } finally
+ {
+ /*
+ * restore preference settings in case they were fudged
+ */
+ Cache.setProperty("FIGURE_AUTOIDWIDTH",
+ String.valueOf(autoIdWidth));
+ Cache.setProperty("FIGURE_FIXEDIDWIDTH",
+ String.valueOf(fixedIdWidth));
}
}